diff options
author | Staffan Olsson <staffan@repos.se> | 2018-02-01 21:20:38 +0100 |
---|---|---|
committer | Staffan Olsson <staffan@repos.se> | 2018-02-01 21:20:38 +0100 |
commit | 82337a2ff88672d60ff5103c839dfe2374de345c (patch) | |
tree | 630fe9b3655f57240ee1b3d13b3d9c23362f305e | |
parent | 4a49ab065e468e251db4c72da98376086a0c520e (diff) | |
download | kubernetes-kafka-82337a2ff88672d60ff5103c839dfe2374de345c.tar.gz kubernetes-kafka-82337a2ff88672d60ff5103c839dfe2374de345c.tar.bz2 kubernetes-kafka-82337a2ff88672d60ff5103c839dfe2374de345c.zip |
This test will only pass with luck, or maybe with lots of replicas
-rw-r--r-- | kafka/test/consumer-group.yml | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/kafka/test/consumer-group.yml b/kafka/test/consumer-group.yml index e19268e..055d16e 100644 --- a/kafka/test/consumer-group.yml +++ b/kafka/test/consumer-group.yml @@ -19,14 +19,15 @@ data: UNIQUE="${HOSTNAME}@$(date -u -Ins)" - PREVIOUS=$(tail -n 1 /shared/consumed.tmp) echo "${UNIQUE: -41:5}:Test $UNIQUE" >> /shared/produce.tmp sleep $PC_WAIT - LAST=$(tail -n 1 /shared/consumed.tmp) + PREVIOUS=$(cat /shared/consumed.tmp | grep -v '%' || echo "-1") + kafkacat -b $BOOTSTRAP -G test-kafkacat-consumergroup test-kafkacat-consumergroup -f '%o\n' -u -c 1 | tee /shared/consumed.tmp + LAST=$(cat /shared/consumed.tmp | grep -v '%') [ -z "$LAST" ] && echo "Nothing consumed" && exit 1 # should fail if the test has only one replica - if (( (N + 1) > M )); then + if (( ($PREVIOUS + 1) == $LAST )); then echo "Consumed offset increased from $PREVIOUS to $LAST. Diff should be >1 when there's more than 1 replica in the consumer group." exit 10 fi @@ -105,23 +106,6 @@ spec: mountPath: /test - name: shared mountPath: /shared - - name: consumer - image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 - env: - - name: BOOTSTRAP - value: bootstrap.kafka:9092 - command: - - /bin/bash - - -cex - - > - kafkacat -b $BOOTSTRAP -G test-kafkacat-consumergroup test-kafkacat-consumergroup -f '%o\n' -u -d broker | - tee /shared/consumed.tmp - ; - volumeMounts: - - name: config - mountPath: /test - - name: shared - mountPath: /shared - name: testcase image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 env: @@ -138,7 +122,7 @@ spec: - -e - /test/test.sh initialDelaySeconds: 10 - periodSeconds: 10 + periodSeconds: 35 livenessProbe: exec: command: |