Skip to content

Commit 4b2e5b8

Browse files
committed
improve test reliability
wait-for-kafka.sh sometimes infinitely loops because curl gets correct response but fails with Connection reset by peer + curl http://kafka:9099/ TOPICS READY curl: (56) Recv failure: Connection reset by peer
1 parent da62c71 commit 4b2e5b8

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

dev/scripts/wait-for-kafka.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
until curl -s $KAFKA_READY_ADDRESS >/dev/null ; do
3+
until [[ "$(curl -s $KAFKA_READY_ADDRESS)" == "TOPICS READY" ]] ; do
44
>&2 echo "Kafka topics not ready yet"
55
sleep 1
66
done

scripts/go_test_on_ci.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,13 @@ set -e -o pipefail
1515
golangci-lint run --timeout 5m
1616
echo "Go code analysed successfully."
1717

18+
if [[ -n $DB_HOST ]] ; then
19+
./dev/scripts/wait-for-services.sh
20+
fi
21+
22+
if [[ -n $KAFKA_READY_ADDRESS ]] ; then
23+
./dev/scripts/wait-for-kafka.sh
24+
fi
25+
1826
# Run project tests
1927
./scripts/go_test_db.sh | ./scripts/colorize.sh

0 commit comments

Comments
 (0)