aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStaffan Olsson <staffan@repos.se>2017-10-16 10:36:24 +0200
committerStaffan Olsson <staffan@repos.se>2017-11-09 13:48:51 +0100
commitf4387f1c89f6cc4d1d1778dd0aabba54c7eef8c1 (patch)
treea5ec7a4a4226aaefaceeb36924d7e63f52e5337f
parentdc6bbf0501ae0aba9a4677a77bd669d9099436f3 (diff)
downloadkubernetes-kafka-f4387f1c89f6cc4d1d1778dd0aabba54c7eef8c1.tar.gz
kubernetes-kafka-f4387f1c89f6cc4d1d1778dd0aabba54c7eef8c1.tar.bz2
kubernetes-kafka-f4387f1c89f6cc4d1d1778dd0aabba54c7eef8c1.zip
Don't fail the test if bootstrap fails ...
but only if producers and consumers (which must maintain a broker list) fail
-rw-r--r--test/basic-with-kafkacat.yml24
1 files changed, 15 insertions, 9 deletions
diff --git a/test/basic-with-kafkacat.yml b/test/basic-with-kafkacat.yml
index 31a7002..d5ec996 100644
--- a/test/basic-with-kafkacat.yml
+++ b/test/basic-with-kafkacat.yml
@@ -15,17 +15,17 @@ data:
exec >> /tmp/testlog
exec 2>&1
- PRODUCE_WAIT=.1
+ PC_WAIT=.2
MAX_AGE=5
UNIQUE="${HOSTNAME}@$(date -u -Ins)"
echo "Test $UNIQUE" >> /shared/produce.tmp
- sleep $PRODUCE_WAIT
- LAST=$(kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '%T= %s' -c 1 -u)
+ sleep $PC_WAIT
+ LAST=$(tail -n 1 /shared/consumed.tmp)
- LAST_TS=$(echo $LAST | awk -F'= ' '{print $1}')
- LAST_MSG=$(echo $LAST | awk -F'= ' '{print $2}')
+ LAST_TS=$(echo $LAST | awk -F';' '{print $1}')
+ LAST_MSG=$(echo $LAST | awk -F';' '{print $4}')
NOW=$(date -u +%s%3N)
DIFF_S=$((($NOW - $LAST_TS)/1000))
DIFF_MS=$((($NOW - $LAST_TS)%1000))
@@ -45,7 +45,9 @@ data:
fi
# get info about this message
- kafkacat -Q -b $BOOTSTRAP -t test-basic-with-kafkacat:0:$LAST_TS
+ kafkacat -Q -b $BOOTSTRAP -t test-basic-with-kafkacat:0:$LAST_TS || \
+ echo "At $(date +%FT%H:%M:%S.%3N) bootstrap broker might be down"
+ # but don't fail the test; producer and consumer should keep going if there are other brokers
# We haven't asserted that the consumer works, so we'll just have to assume that it will exit if it fails
@@ -113,9 +115,11 @@ spec:
- /bin/bash
- -cex
- >
- echo "--- start $HOSTNAME $(date --iso-8601='ns' -u) ---" >> /shared/produce.tmp;
+ echo "--- start $HOSTNAME $(date --iso-8601='ns' -u) ---" >> /shared/produce.tmp
+ ;
tail -f /shared/produce.tmp |
- kafkacat -P -b $BOOTSTRAP -t test-basic-with-kafkacat -v -T -d broker;
+ kafkacat -P -b $BOOTSTRAP -t test-basic-with-kafkacat -v -T -d broker
+ ;
volumeMounts:
- name: config
mountPath: /test
@@ -130,7 +134,9 @@ spec:
- /bin/bash
- -cex
- >
- kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '[%p,%o] %s\n' -u -d broker;
+ kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '%T;%p;%o;%s\n' -u -d broker |
+ tee /shared/consumed.tmp
+ ;
volumeMounts:
- name: config
mountPath: /test