Skip to content

Commit 92d4802

Browse files
NinjaRocksclaude
andcommitted
Wait for emulator readiness log instead of TCP port check
Docker's port proxy accepts TCP on 5672 before the Service Bus emulator app binds (while SQL Edge is still initialising), so the previous TCP check passed prematurely and tests hit a not-yet-ready emulator (AMQP ConnectionRefused). Wait for the emulator's "Successfully Up" log line. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 889c439 commit 92d4802

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

.github/workflows/Azure-Build.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,26 @@ jobs:
6767
6868
- name: Start Azure Service Bus emulator
6969
working-directory: .github/azure-emulator
70-
run: docker compose up -d --wait
70+
run: docker compose up -d
7171

72-
- name: Wait for emulator AMQP port
72+
# A TCP check on 5672 is unreliable: Docker's port proxy accepts the
73+
# connection before the emulator app binds (and while SQL Edge is still
74+
# initialising). Wait for the emulator's readiness log line instead.
75+
- name: Wait for emulator to be ready
76+
working-directory: .github/azure-emulator
7377
run: |
74-
echo "Waiting for Service Bus emulator on localhost:5672..."
75-
for i in $(seq 1 30); do
76-
if (echo > /dev/tcp/localhost/5672) >/dev/null 2>&1; then
77-
echo "Emulator is accepting connections."
78+
echo "Waiting for the Service Bus emulator to report ready..."
79+
for i in $(seq 1 60); do
80+
if docker compose logs sb-emulator 2>&1 | grep -qi "Emulator Service is Successfully Up"; then
81+
echo "Emulator is ready."
82+
sleep 5 # small settle margin
7883
exit 0
7984
fi
80-
echo "Attempt $i/30 - not ready yet, waiting..."
81-
sleep 3
85+
echo "Attempt $i/60 - emulator not ready yet, waiting..."
86+
sleep 5
8287
done
83-
echo "ERROR: emulator did not become ready"
84-
docker compose -f .github/azure-emulator/docker-compose.yml logs
88+
echo "ERROR: emulator did not become ready in time"
89+
docker compose logs
8590
exit 1
8691
8792
- name: Restore & build

0 commit comments

Comments
 (0)