From a3b969cb1bb1fddecbab46dad5c4a0da516fb25e Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Sun, 15 Oct 2017 19:54:46 +0200 Subject: Converted to latest Yolean/kube-test boilerplate --- test/basic-with-kafkacat.yml | 50 +++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/test/basic-with-kafkacat.yml b/test/basic-with-kafkacat.yml index 78e423c..9025f20 100644 --- a/test/basic-with-kafkacat.yml +++ b/test/basic-with-kafkacat.yml @@ -1,19 +1,17 @@ --- kind: ConfigMap metadata: - name: basic-with-kafkacat - namespace: test-kafka + name: test-basic-with-kafkacat + namespace: default apiVersion: v1 data: setup.sh: |- touch /tmp/testlog - tail -f /tmp/testlog - continue.sh: |- - exit 0 + tail -f /tmp/testlog - run.sh: |- + test.sh: |- exec >> /tmp/testlog exec 2>&1 @@ -22,13 +20,19 @@ data: echo "Test $unique" | kafkacat -P -b $BOOTSTRAP -t test-basic-with-kafkacat -v kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -e | grep $unique + exit 0 + + quit-on-nonzero-exit.sh: |- + exec >> /tmp/testlog + exec 2>&1 + exit 0 --- apiVersion: batch/v1 kind: Job metadata: - name: basic-with-kafkacat - namespace: test-kafka + name: test-basic-with-kafkacat + namespace: default spec: template: spec: @@ -52,51 +56,53 @@ spec: apiVersion: apps/v1beta1 kind: Deployment metadata: - name: basic-with-kafkacat - namespace: test-kafka + name: test-basic-with-kafkacat + namespace: default spec: replicas: 1 + strategy: + type: Recreate template: metadata: labels: - test-target: kafka + test-target: kube-test test-type: readiness + # for example: + # readonly - can be used in production + # isolated - read/write but in a manner that does not affect other services + # load - unsuitable for production because it uses significant resources + # chaos - unsuitable for production because it injects failure modes + #test-use: spec: containers: - name: testcase - # common test images - #image: solsson/curl@sha256:8b0927b81d10043e70f3e05e33e36fb9b3b0cbfcbccdb9f04fd53f67a270b874 image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef - #image: solsson/kubectl-kafkacat@sha256:3715a7ede3f168f677ee6faf311ff6887aff31f660cfeecad5d87b4f18516321 env: - name: BOOTSTRAP #value: kafka-0.broker.kafka.svc.cluster.local:9092,kafka-1.broker.kafka.svc.cluster.local:9092,kafka-2.broker.kafka.svc.cluster.local:9092 value: kafka-0.broker.kafka.svc.cluster.local:9092 - - name: ZOOKEEPER - value: zookeeper.kafka.svc.cluster.local:2181 - # Test set up command: - /bin/bash - -e - /test/setup.sh - # Test run, again and again readinessProbe: exec: command: - /bin/bash - -e - - /test/run.sh - # Test quit on nonzero exit + - /test/test.sh + initialDelaySeconds: 10 + periodSeconds: 10 livenessProbe: exec: command: - /bin/bash - -e - - /test/continue.sh + - /test/quit-on-nonzero-exit.sh volumeMounts: - name: config mountPath: /test volumes: - name: config configMap: - name: basic-with-kafkacat + name: test-basic-with-kafkacat -- cgit v1.2.3 From 41938168dc6312439de842e649ce1a13b64e1c11 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Sun, 15 Oct 2017 20:41:57 +0200 Subject: not working --- test/basic-with-kafkacat.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/test/basic-with-kafkacat.yml b/test/basic-with-kafkacat.yml index 9025f20..ca750ac 100644 --- a/test/basic-with-kafkacat.yml +++ b/test/basic-with-kafkacat.yml @@ -9,6 +9,11 @@ data: setup.sh: |- touch /tmp/testlog + touch /tmp/produce + tail -f /tmp/produce | kafkacat -P -b $BOOTSTRAP -t test-basic-with-kafkacat -v > /tmp/producer.out 2> /tmp/producer.err & + + kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -q -f '[%p,%o] %s\n' > /tmp/consumer.out 2> /tmp/consumer.err & + tail -f /tmp/testlog test.sh: |- @@ -16,9 +21,19 @@ data: exec 2>&1 unique=$(date -Ins) + echo "Test $unique" >> /tmp/produce + sleep 1 + LAST=$(tail -n 1 /tmp/consumer.out | tee -a /tmp/testlog) - echo "Test $unique" | kafkacat -P -b $BOOTSTRAP -t test-basic-with-kafkacat -v - kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -e | grep $unique + [ "$LAST" == *"$unique" ] || { + echo "Last message '$LAST' doesn't contain marker '$unique'" + #kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -e | grep $unique + #echo "Producer output:" + #cat /tmp/producer.out + #echo "Producer err:" + #cat /tmp/producer.err + #exit 1 + } exit 0 -- cgit v1.2.3 From 7e93d306fe67ecd750f49b1ac20407ffeaa1647b Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Mon, 16 Oct 2017 08:44:12 +0200 Subject: More ideas --- test/basic-with-kafkacat.yml | 60 +++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/test/basic-with-kafkacat.yml b/test/basic-with-kafkacat.yml index ca750ac..d7a9fe0 100644 --- a/test/basic-with-kafkacat.yml +++ b/test/basic-with-kafkacat.yml @@ -9,31 +9,21 @@ data: setup.sh: |- touch /tmp/testlog - touch /tmp/produce - tail -f /tmp/produce | kafkacat -P -b $BOOTSTRAP -t test-basic-with-kafkacat -v > /tmp/producer.out 2> /tmp/producer.err & - - kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -q -f '[%p,%o] %s\n' > /tmp/consumer.out 2> /tmp/consumer.err & - tail -f /tmp/testlog test.sh: |- exec >> /tmp/testlog exec 2>&1 - unique=$(date -Ins) - echo "Test $unique" >> /tmp/produce - sleep 1 - LAST=$(tail -n 1 /tmp/consumer.out | tee -a /tmp/testlog) + LAST_TS=$(kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '%T\n' -c 1 -u) + NOW=$(date -u +%s%3N) + echo "$NOW ($(date +%FT%H:%M:%S.%3N)):" + echo "$LAST_TS" + echo "$((($NOW - $LAST_TS)/1000)) seconds old" - [ "$LAST" == *"$unique" ] || { - echo "Last message '$LAST' doesn't contain marker '$unique'" - #kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -e | grep $unique - #echo "Producer output:" - #cat /tmp/producer.out - #echo "Producer err:" - #cat /tmp/producer.err - #exit 1 - } + #Q_TS=$(date -u +%s%3N) + Q_TS=$LAST_TS + kafkacat -Q -b $BOOTSTRAP -t test-basic-with-kafkacat:0:$Q_TS exit 0 @@ -90,6 +80,38 @@ spec: #test-use: spec: containers: + - name: producer + image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef + env: + - name: BOOTSTRAP + value: kafka-0.broker.kafka.svc.cluster.local:9092 + command: + - /bin/bash + - -cex + - > + 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; + volumeMounts: + - name: config + mountPath: /test + - name: shared + mountPath: /shared + - name: consumer + image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef + env: + - name: BOOTSTRAP + value: kafka-0.broker.kafka.svc.cluster.local:9092 + command: + - /bin/bash + - -cex + - > + kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '[%p,%o] %s\n' -u + volumeMounts: + - name: config + mountPath: /test + - name: shared + mountPath: /shared - name: testcase image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef env: @@ -121,3 +143,5 @@ spec: - name: config configMap: name: test-basic-with-kafkacat + - name: shared + emptyDir: {} -- cgit v1.2.3 From dc6bbf0501ae0aba9a4677a77bd669d9099436f3 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Mon, 16 Oct 2017 10:16:27 +0200 Subject: Logs broker connect/disconnect state --- test/basic-with-kafkacat.yml | 45 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/test/basic-with-kafkacat.yml b/test/basic-with-kafkacat.yml index d7a9fe0..31a7002 100644 --- a/test/basic-with-kafkacat.yml +++ b/test/basic-with-kafkacat.yml @@ -15,15 +15,39 @@ data: exec >> /tmp/testlog exec 2>&1 - LAST_TS=$(kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '%T\n' -c 1 -u) + PRODUCE_WAIT=.1 + 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) + + LAST_TS=$(echo $LAST | awk -F'= ' '{print $1}') + LAST_MSG=$(echo $LAST | awk -F'= ' '{print $2}') NOW=$(date -u +%s%3N) - echo "$NOW ($(date +%FT%H:%M:%S.%3N)):" - echo "$LAST_TS" - echo "$((($NOW - $LAST_TS)/1000)) seconds old" + DIFF_S=$((($NOW - $LAST_TS)/1000)) + DIFF_MS=$((($NOW - $LAST_TS)%1000)) + #echo "$NOW ($(date +%FT%H:%M:%S.%3N)):" + #echo "$LAST_TS" + + if [ $DIFF_S -gt $MAX_AGE ]; then + echo "Last message is $DIFF_S.$DIFF_MS old:" + echo "$LAST_MSG" + exit 10 + fi - #Q_TS=$(date -u +%s%3N) - Q_TS=$LAST_TS - kafkacat -Q -b $BOOTSTRAP -t test-basic-with-kafkacat:0:$Q_TS + if [[ "$LAST_MSG" != *"$UNIQUE" ]]; then + echo "Last message (at $LAST_TS) isn't from this test run ($UNIQUE):" + echo "$LAST_MSG" + exit 11 + fi + + # get info about this message + kafkacat -Q -b $BOOTSTRAP -t test-basic-with-kafkacat:0:$LAST_TS + + # We haven't asserted that the consumer works, so we'll just have to assume that it will exit if it fails exit 0 @@ -91,7 +115,7 @@ spec: - > 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; + kafkacat -P -b $BOOTSTRAP -t test-basic-with-kafkacat -v -T -d broker; volumeMounts: - name: config mountPath: /test @@ -106,7 +130,7 @@ spec: - /bin/bash - -cex - > - kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '[%p,%o] %s\n' -u + kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '[%p,%o] %s\n' -u -d broker; volumeMounts: - name: config mountPath: /test @@ -116,7 +140,6 @@ spec: image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef env: - name: BOOTSTRAP - #value: kafka-0.broker.kafka.svc.cluster.local:9092,kafka-1.broker.kafka.svc.cluster.local:9092,kafka-2.broker.kafka.svc.cluster.local:9092 value: kafka-0.broker.kafka.svc.cluster.local:9092 command: - /bin/bash @@ -139,6 +162,8 @@ spec: volumeMounts: - name: config mountPath: /test + - name: shared + mountPath: /shared volumes: - name: config configMap: -- cgit v1.2.3 From f4387f1c89f6cc4d1d1778dd0aabba54c7eef8c1 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Mon, 16 Oct 2017 10:36:24 +0200 Subject: Don't fail the test if bootstrap fails ... but only if producers and consumers (which must maintain a broker list) fail --- test/basic-with-kafkacat.yml | 24 +++++++++++++++--------- 1 file 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 -- cgit v1.2.3 From a3196474939f399ec23272738df3a536386abe7b Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Mon, 16 Oct 2017 10:51:12 +0200 Subject: Divides a couple of librdkafka timoeuts by 100 --- test/basic-with-kafkacat.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/basic-with-kafkacat.yml b/test/basic-with-kafkacat.yml index d5ec996..78b5819 100644 --- a/test/basic-with-kafkacat.yml +++ b/test/basic-with-kafkacat.yml @@ -45,8 +45,9 @@ data: fi # get info about this message - 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" + kafkacat -Q -b $BOOTSTRAP -t test-basic-with-kafkacat:0:$LAST_TS \ + -X socket.timeout.ms=600 -X session.timeout.ms=300 -X request.timeout.ms=50 -X metadata.request.timeout.ms=600 + [ $? -eq 0 ] || echo "At $(date +%FT%H:%M:%S.%3N) bootstrap broker(s) 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 -- cgit v1.2.3 From 03b4233a3d5753e4ba97e54cab3545171380a2e1 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Thu, 19 Oct 2017 14:51:27 +0200 Subject: Return to grouping the tests in a namespace, ... if you haven't created it, you probably don't want the tests. --- test/basic-with-kafkacat.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/basic-with-kafkacat.yml b/test/basic-with-kafkacat.yml index 78b5819..c9af0fc 100644 --- a/test/basic-with-kafkacat.yml +++ b/test/basic-with-kafkacat.yml @@ -2,7 +2,7 @@ kind: ConfigMap metadata: name: test-basic-with-kafkacat - namespace: default + namespace: test-kafka apiVersion: v1 data: @@ -64,7 +64,7 @@ apiVersion: batch/v1 kind: Job metadata: name: test-basic-with-kafkacat - namespace: default + namespace: test-kafka spec: template: spec: @@ -89,7 +89,7 @@ apiVersion: apps/v1beta1 kind: Deployment metadata: name: test-basic-with-kafkacat - namespace: default + namespace: test-kafka spec: replicas: 1 strategy: -- cgit v1.2.3 From dbf77898c4e6c1617fa7b8ec28347072ec86ec0f Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Wed, 25 Oct 2017 13:17:17 +0200 Subject: TODO I guess labels must be unique for each test now? --- test/basic-with-kafkacat.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/basic-with-kafkacat.yml b/test/basic-with-kafkacat.yml index c9af0fc..e72cfbc 100644 --- a/test/basic-with-kafkacat.yml +++ b/test/basic-with-kafkacat.yml @@ -85,7 +85,7 @@ spec: - "2" restartPolicy: Never --- -apiVersion: apps/v1beta1 +apiVersion: apps/v1beta2 kind: Deployment metadata: name: test-basic-with-kafkacat @@ -94,10 +94,14 @@ spec: replicas: 1 strategy: type: Recreate + selector: + matchLabels: + test-target: kafka + test-type: readiness template: metadata: labels: - test-target: kube-test + test-target: kafka test-type: readiness # for example: # readonly - can be used in production -- cgit v1.2.3 From 96a3adc570e5a2ec5a18de6bd7e17e9790a36d97 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Sun, 5 Nov 2017 21:15:09 +0100 Subject: Converts (console-) produce-consume test to online ... style like kafkacat, but without the timestamp diff feature because I couldn't get message timestamp out of the console consumer. Also I had to increase PC_WAIT. --- test/basic-produce-consume.yml | 113 --------------------------- test/produce-consume.yml | 168 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 168 insertions(+), 113 deletions(-) delete mode 100644 test/basic-produce-consume.yml create mode 100644 test/produce-consume.yml diff --git a/test/basic-produce-consume.yml b/test/basic-produce-consume.yml deleted file mode 100644 index 32ec4ec..0000000 --- a/test/basic-produce-consume.yml +++ /dev/null @@ -1,113 +0,0 @@ ---- -kind: ConfigMap -metadata: - name: basic-produce-consume - namespace: test-kafka -apiVersion: v1 -data: - - setup.sh: |- - touch /tmp/testlog - - ./bin/kafka-topics.sh --zookeeper $ZOOKEEPER \ - --create --if-not-exists --topic test-basic-produce-consume \ - --partitions 1 --replication-factor 1 - - # Despite the deprecation warning --zookeeper nothing is consumed when using --bootstrap-server - ./bin/kafka-console-consumer.sh --zookeeper $ZOOKEEPER --topic test-basic-produce-consume > /tmp/testconsumed & - - tail -f /tmp/testlog - - continue.sh: |- - exit 0 - - run.sh: |- - exec >> /tmp/testlog - exec 2>&1 - - unique=$(date -Ins) - - echo "Test $unique" | ./bin/kafka-console-producer.sh --broker-list $BOOTSTRAP --topic test-basic-produce-consume - echo "" - tail -n 1 /tmp/testconsumed | grep $unique - - # How to make this test fail: - #apt-get update && apt-get install -y --no-install-recommends procps - #pkill java - - exit 0 ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: basic-produce-consume - namespace: test-kafka -spec: - template: - spec: - containers: - - name: topic-create - image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d - command: - - ./bin/kafka-topics.sh - - --zookeeper - - zookeeper.kafka.svc.cluster.local:2181 - - --create - - --if-not-exists - - --topic - - test-basic-produce-consume - - --partitions - - "1" - - --replication-factor - - "2" - restartPolicy: Never ---- -apiVersion: apps/v1beta1 -kind: Deployment -metadata: - name: basic-produce-consume - namespace: test-kafka -spec: - replicas: 1 - template: - metadata: - labels: - test-target: kafka - test-type: readiness - spec: - containers: - - name: testcase - image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d - env: - - name: BOOTSTRAP - value: kafka-0.broker.kafka.svc.cluster.local:9092,kafka-1.broker.kafka.svc.cluster.local:9092,kafka-2.broker.kafka.svc.cluster.local:9092 - - name: ZOOKEEPER - value: zookeeper.kafka.svc.cluster.local:2181 - # Test set up - command: - - /bin/bash - - -e - - /test/setup.sh - # Test run, again and again - readinessProbe: - exec: - command: - - /bin/bash - - -e - - /test/run.sh - # JVM start is slow, can we keep producer started and restore the default preriod 10s? - periodSeconds: 30 - # Test quit on nonzero exit - livenessProbe: - exec: - command: - - /bin/bash - - -e - - /test/continue.sh - volumeMounts: - - name: config - mountPath: /test - volumes: - - name: config - configMap: - name: basic-produce-consume diff --git a/test/produce-consume.yml b/test/produce-consume.yml new file mode 100644 index 0000000..f568c56 --- /dev/null +++ b/test/produce-consume.yml @@ -0,0 +1,168 @@ +--- +kind: ConfigMap +metadata: + name: produce-consume + namespace: test-kafka +apiVersion: v1 +data: + + setup.sh: |- + touch /tmp/testlog + + tail -f /tmp/testlog + + test.sh: |- + exec >> /tmp/testlog + exec 2>&1 + + # As low as in kafkacat based test didn't work, but this value can likely be squeezed + PC_WAIT=2.0 + + UNIQUE="${HOSTNAME}@$(date -u -Ins)" + + echo "Test $UNIQUE" >> /shared/produce.tmp + sleep $PC_WAIT + LAST=$(tail -n 1 /shared/consumed.tmp) + [ -z "$LAST" ] && echo "Nothing consumed yet" && exit 1 + + # Haven't found how to get message timestamp in console-consumer, see kafkacat based test instead + LAST_MSG=$LAST + + if [[ "$LAST_MSG" != *"$UNIQUE" ]]; then + echo "Last message (at $(date +%FT%T)) isn't from this test run ($UNIQUE):" + echo "$LAST_MSG" + exit 11 + fi + + echo "OK ($LAST_MSG at $(date +%FT%T))" + # We haven't asserted that the consumer works, so we'll just have to assume that it will exit if it fails + + exit 0 + + quit-on-nonzero-exit.sh: |- + exec >> /tmp/testlog + exec 2>&1 + + exit 0 +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: produce-consume + namespace: test-kafka +spec: + template: + spec: + containers: + - name: topic-create + image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d + command: + - ./bin/kafka-topics.sh + - --zookeeper + - zookeeper.kafka.svc.cluster.local:2181 + - --create + - --if-not-exists + - --topic + - test-produce-consume + - --partitions + - "1" + - --replication-factor + - "2" + restartPolicy: Never +--- +apiVersion: apps/v1beta2 +kind: Deployment +metadata: + name: produce-consume + namespace: test-kafka +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + test-target: kafka + test-type: readiness + template: + metadata: + labels: + test-target: kafka + test-type: readiness + # for example: + # readonly - can be used in production + # isolated - read/write but in a manner that does not affect other services + # load - unsuitable for production because it uses significant resources + # chaos - unsuitable for production because it injects failure modes + #test-use: + spec: + containers: + - name: producer + image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d + env: + - name: BOOTSTRAP + value: kafka-0.broker.kafka.svc.cluster.local:9092 + command: + - /bin/bash + - -cex + - > + echo "--- start $HOSTNAME $(date --iso-8601='ns' -u) ---" >> /shared/produce.tmp + ; + tail -f /shared/produce.tmp | + ./bin/kafka-console-producer.sh --broker-list $BOOTSTRAP --topic test-produce-consume + ; + volumeMounts: + - name: config + mountPath: /test + - name: shared + mountPath: /shared + - name: consumer + image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d + env: + - name: BOOTSTRAP + value: kafka-0.broker.kafka.svc.cluster.local:9092 + command: + - /bin/bash + - -cex + - > + ./bin/kafka-console-consumer.sh --bootstrap-server $BOOTSTRAP --topic test-produce-consume | + tee /shared/consumed.tmp + ; + volumeMounts: + - name: config + mountPath: /test + - name: shared + mountPath: /shared + - name: testcase + image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef + env: + - name: BOOTSTRAP + value: kafka-0.broker.kafka.svc.cluster.local:9092 + command: + - /bin/bash + - -e + - /test/setup.sh + readinessProbe: + exec: + command: + - /bin/bash + - -e + - /test/test.sh + initialDelaySeconds: 10 + periodSeconds: 10 + livenessProbe: + exec: + command: + - /bin/bash + - -e + - /test/quit-on-nonzero-exit.sh + volumeMounts: + - name: config + mountPath: /test + - name: shared + mountPath: /shared + volumes: + - name: config + configMap: + name: produce-consume + - name: shared + emptyDir: {} -- cgit v1.2.3 From af35ae1f485b77ad5cfa1c877b7665caf2249ab6 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Mon, 6 Nov 2017 19:53:12 +0100 Subject: Adds a key to each message, while testing ... for regressions with https://github.com/solsson/kafkacat/tree/fixedkey --- test/basic-with-kafkacat.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/basic-with-kafkacat.yml b/test/basic-with-kafkacat.yml index e72cfbc..d6bb8e7 100644 --- a/test/basic-with-kafkacat.yml +++ b/test/basic-with-kafkacat.yml @@ -20,7 +20,7 @@ data: UNIQUE="${HOSTNAME}@$(date -u -Ins)" - echo "Test $UNIQUE" >> /shared/produce.tmp + echo "${UNIQUE: -41:5}:Test $UNIQUE" >> /shared/produce.tmp sleep $PC_WAIT LAST=$(tail -n 1 /shared/consumed.tmp) @@ -112,7 +112,7 @@ spec: spec: containers: - name: producer - image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef + image: solsson/kafkacat-fixedkey@sha256:c9c78aef3090519b64ecc279c06df6914c94720a27469200c079f1871b10fa8f env: - name: BOOTSTRAP value: kafka-0.broker.kafka.svc.cluster.local:9092 @@ -123,7 +123,7 @@ spec: 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 -K ':' ; volumeMounts: - name: config @@ -139,7 +139,7 @@ spec: - /bin/bash - -cex - > - kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '%T;%p;%o;%s\n' -u -d broker | + kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '%T;%k:%p;%o;%s\n' -u -d broker | tee /shared/consumed.tmp ; volumeMounts: -- cgit v1.2.3 From a08c4920e5ff7ad99a0a79704c21424ec5a7fa19 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Mon, 6 Nov 2017 21:28:29 +0100 Subject: Fixed key option changed in the kafkacat PR --- test/basic-with-kafkacat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/basic-with-kafkacat.yml b/test/basic-with-kafkacat.yml index d6bb8e7..5cdbdf0 100644 --- a/test/basic-with-kafkacat.yml +++ b/test/basic-with-kafkacat.yml @@ -112,7 +112,7 @@ spec: spec: containers: - name: producer - image: solsson/kafkacat-fixedkey@sha256:c9c78aef3090519b64ecc279c06df6914c94720a27469200c079f1871b10fa8f + image: solsson/kafkacat-fixedkey@sha256:e23753bc0900e7b95d29f8c9cb05440eb27d854f367d407ce4ab2955093ad360 env: - name: BOOTSTRAP value: kafka-0.broker.kafka.svc.cluster.local:9092 -- cgit v1.2.3 From f491e458a78f3376768bb18fe6e546cdea89c5aa Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Tue, 7 Nov 2017 09:40:31 +0100 Subject: kafkacat based on same image as solsson/kafka:1.0.0 --- test/basic-with-kafkacat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/basic-with-kafkacat.yml b/test/basic-with-kafkacat.yml index 5cdbdf0..86641cf 100644 --- a/test/basic-with-kafkacat.yml +++ b/test/basic-with-kafkacat.yml @@ -112,7 +112,7 @@ spec: spec: containers: - name: producer - image: solsson/kafkacat-fixedkey@sha256:e23753bc0900e7b95d29f8c9cb05440eb27d854f367d407ce4ab2955093ad360 + image: solsson/kafkacat-fixedkey@sha256:fb27acf4c7ca25eca6a6cffe145cb492ee4d4c87cba0459787fb43f8040f6d7b env: - name: BOOTSTRAP value: kafka-0.broker.kafka.svc.cluster.local:9092 -- cgit v1.2.3 From d0c1440e3bdf59b802ff28ab25e2bacf24ebbb05 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Thu, 9 Nov 2017 13:14:16 +0100 Subject: Kafkacat support for -k has been merged now --- test/basic-with-kafkacat.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/basic-with-kafkacat.yml b/test/basic-with-kafkacat.yml index 86641cf..ae8a0ed 100644 --- a/test/basic-with-kafkacat.yml +++ b/test/basic-with-kafkacat.yml @@ -112,7 +112,7 @@ spec: spec: containers: - name: producer - image: solsson/kafkacat-fixedkey@sha256:fb27acf4c7ca25eca6a6cffe145cb492ee4d4c87cba0459787fb43f8040f6d7b + image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 env: - name: BOOTSTRAP value: kafka-0.broker.kafka.svc.cluster.local:9092 @@ -131,7 +131,7 @@ spec: - name: shared mountPath: /shared - name: consumer - image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef + image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 env: - name: BOOTSTRAP value: kafka-0.broker.kafka.svc.cluster.local:9092 @@ -148,7 +148,7 @@ spec: - name: shared mountPath: /shared - name: testcase - image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef + image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 env: - name: BOOTSTRAP value: kafka-0.broker.kafka.svc.cluster.local:9092 -- cgit v1.2.3 From 8b8dc66f1bbe7dc3c9b83212387be060902bccac Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Thu, 9 Nov 2017 14:03:10 +0100 Subject: Renames test to focues on the type of client used --- test/basic-with-kafkacat.yml | 183 ------------------------------------------- test/kafkacat.yml | 183 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 183 insertions(+), 183 deletions(-) delete mode 100644 test/basic-with-kafkacat.yml create mode 100644 test/kafkacat.yml diff --git a/test/basic-with-kafkacat.yml b/test/basic-with-kafkacat.yml deleted file mode 100644 index ae8a0ed..0000000 --- a/test/basic-with-kafkacat.yml +++ /dev/null @@ -1,183 +0,0 @@ ---- -kind: ConfigMap -metadata: - name: test-basic-with-kafkacat - namespace: test-kafka -apiVersion: v1 -data: - - setup.sh: |- - touch /tmp/testlog - - tail -f /tmp/testlog - - test.sh: |- - exec >> /tmp/testlog - exec 2>&1 - - PC_WAIT=.2 - MAX_AGE=5 - - UNIQUE="${HOSTNAME}@$(date -u -Ins)" - - echo "${UNIQUE: -41:5}:Test $UNIQUE" >> /shared/produce.tmp - 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 $4}') - NOW=$(date -u +%s%3N) - DIFF_S=$((($NOW - $LAST_TS)/1000)) - DIFF_MS=$((($NOW - $LAST_TS)%1000)) - #echo "$NOW ($(date +%FT%H:%M:%S.%3N)):" - #echo "$LAST_TS" - - if [ $DIFF_S -gt $MAX_AGE ]; then - echo "Last message is $DIFF_S.$DIFF_MS old:" - echo "$LAST_MSG" - exit 10 - fi - - if [[ "$LAST_MSG" != *"$UNIQUE" ]]; then - echo "Last message (at $LAST_TS) isn't from this test run ($UNIQUE):" - echo "$LAST_MSG" - exit 11 - fi - - # get info about this message - kafkacat -Q -b $BOOTSTRAP -t test-basic-with-kafkacat:0:$LAST_TS \ - -X socket.timeout.ms=600 -X session.timeout.ms=300 -X request.timeout.ms=50 -X metadata.request.timeout.ms=600 - [ $? -eq 0 ] || echo "At $(date +%FT%H:%M:%S.%3N) bootstrap broker(s) 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 - - exit 0 - - quit-on-nonzero-exit.sh: |- - exec >> /tmp/testlog - exec 2>&1 - - exit 0 ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: test-basic-with-kafkacat - namespace: test-kafka -spec: - template: - spec: - containers: - - name: topic-create - image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d - command: - - ./bin/kafka-topics.sh - - --zookeeper - - zookeeper.kafka.svc.cluster.local:2181 - - --create - - --if-not-exists - - --topic - - test-basic-with-kafkacat - - --partitions - - "1" - - --replication-factor - - "2" - restartPolicy: Never ---- -apiVersion: apps/v1beta2 -kind: Deployment -metadata: - name: test-basic-with-kafkacat - namespace: test-kafka -spec: - replicas: 1 - strategy: - type: Recreate - selector: - matchLabels: - test-target: kafka - test-type: readiness - template: - metadata: - labels: - test-target: kafka - test-type: readiness - # for example: - # readonly - can be used in production - # isolated - read/write but in a manner that does not affect other services - # load - unsuitable for production because it uses significant resources - # chaos - unsuitable for production because it injects failure modes - #test-use: - spec: - containers: - - name: producer - image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 - env: - - name: BOOTSTRAP - value: kafka-0.broker.kafka.svc.cluster.local:9092 - command: - - /bin/bash - - -cex - - > - 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 -K ':' - ; - volumeMounts: - - name: config - mountPath: /test - - name: shared - mountPath: /shared - - name: consumer - image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 - env: - - name: BOOTSTRAP - value: kafka-0.broker.kafka.svc.cluster.local:9092 - command: - - /bin/bash - - -cex - - > - kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '%T;%k:%p;%o;%s\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: - - name: BOOTSTRAP - value: kafka-0.broker.kafka.svc.cluster.local:9092 - command: - - /bin/bash - - -e - - /test/setup.sh - readinessProbe: - exec: - command: - - /bin/bash - - -e - - /test/test.sh - initialDelaySeconds: 10 - periodSeconds: 10 - livenessProbe: - exec: - command: - - /bin/bash - - -e - - /test/quit-on-nonzero-exit.sh - volumeMounts: - - name: config - mountPath: /test - - name: shared - mountPath: /shared - volumes: - - name: config - configMap: - name: test-basic-with-kafkacat - - name: shared - emptyDir: {} diff --git a/test/kafkacat.yml b/test/kafkacat.yml new file mode 100644 index 0000000..b14f7f0 --- /dev/null +++ b/test/kafkacat.yml @@ -0,0 +1,183 @@ +--- +kind: ConfigMap +metadata: + name: test-kafkacat + namespace: test-kafka +apiVersion: v1 +data: + + setup.sh: |- + touch /tmp/testlog + + tail -f /tmp/testlog + + test.sh: |- + exec >> /tmp/testlog + exec 2>&1 + + PC_WAIT=.2 + MAX_AGE=5 + + UNIQUE="${HOSTNAME}@$(date -u -Ins)" + + echo "${UNIQUE: -41:5}:Test $UNIQUE" >> /shared/produce.tmp + 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 $4}') + NOW=$(date -u +%s%3N) + DIFF_S=$((($NOW - $LAST_TS)/1000)) + DIFF_MS=$((($NOW - $LAST_TS)%1000)) + #echo "$NOW ($(date +%FT%H:%M:%S.%3N)):" + #echo "$LAST_TS" + + if [ $DIFF_S -gt $MAX_AGE ]; then + echo "Last message is $DIFF_S.$DIFF_MS old:" + echo "$LAST_MSG" + exit 10 + fi + + if [[ "$LAST_MSG" != *"$UNIQUE" ]]; then + echo "Last message (at $LAST_TS) isn't from this test run ($UNIQUE):" + echo "$LAST_MSG" + exit 11 + fi + + # get info about this message + kafkacat -Q -b $BOOTSTRAP -t test-kafkacat:0:$LAST_TS \ + -X socket.timeout.ms=600 -X session.timeout.ms=300 -X request.timeout.ms=50 -X metadata.request.timeout.ms=600 + [ $? -eq 0 ] || echo "At $(date +%FT%H:%M:%S.%3N) bootstrap broker(s) 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 + + exit 0 + + quit-on-nonzero-exit.sh: |- + exec >> /tmp/testlog + exec 2>&1 + + exit 0 +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: test-kafkacat + namespace: test-kafka +spec: + template: + spec: + containers: + - name: topic-create + image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d + command: + - ./bin/kafka-topics.sh + - --zookeeper + - zookeeper.kafka.svc.cluster.local:2181 + - --create + - --if-not-exists + - --topic + - test-kafkacat + - --partitions + - "1" + - --replication-factor + - "2" + restartPolicy: Never +--- +apiVersion: apps/v1beta2 +kind: Deployment +metadata: + name: test-kafkacat + namespace: test-kafka +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + test-target: kafka + test-type: readiness + template: + metadata: + labels: + test-target: kafka + test-type: readiness + # for example: + # readonly - can be used in production + # isolated - read/write but in a manner that does not affect other services + # load - unsuitable for production because it uses significant resources + # chaos - unsuitable for production because it injects failure modes + #test-use: + spec: + containers: + - name: producer + image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 + env: + - name: BOOTSTRAP + value: kafka-0.broker.kafka.svc.cluster.local:9092 + command: + - /bin/bash + - -cex + - > + echo "--- start $HOSTNAME $(date --iso-8601='ns' -u) ---" >> /shared/produce.tmp + ; + tail -f /shared/produce.tmp | + kafkacat -P -b $BOOTSTRAP -t test-kafkacat -v -T -d broker -K ':' + ; + volumeMounts: + - name: config + mountPath: /test + - name: shared + mountPath: /shared + - name: consumer + image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 + env: + - name: BOOTSTRAP + value: kafka-0.broker.kafka.svc.cluster.local:9092 + command: + - /bin/bash + - -cex + - > + kafkacat -C -b $BOOTSTRAP -t test-kafkacat -o -1 -f '%T;%k:%p;%o;%s\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: + - name: BOOTSTRAP + value: kafka-0.broker.kafka.svc.cluster.local:9092 + command: + - /bin/bash + - -e + - /test/setup.sh + readinessProbe: + exec: + command: + - /bin/bash + - -e + - /test/test.sh + initialDelaySeconds: 10 + periodSeconds: 10 + livenessProbe: + exec: + command: + - /bin/bash + - -e + - /test/quit-on-nonzero-exit.sh + volumeMounts: + - name: config + mountPath: /test + - name: shared + mountPath: /shared + volumes: + - name: config + configMap: + name: test-kafkacat + - name: shared + emptyDir: {} -- cgit v1.2.3 From 56aad28fd15f0470e4d52eec7052bc7495828628 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Thu, 9 Nov 2017 14:03:30 +0100 Subject: Avoids overlap in matchLabels between test deployments --- test/kafkacat.yml | 4 ++-- test/produce-consume.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/kafkacat.yml b/test/kafkacat.yml index b14f7f0..639cc60 100644 --- a/test/kafkacat.yml +++ b/test/kafkacat.yml @@ -96,12 +96,12 @@ spec: type: Recreate selector: matchLabels: - test-target: kafka + test-target: kafka-client-kafkacat test-type: readiness template: metadata: labels: - test-target: kafka + test-target: kafka-client-kafkacat test-type: readiness # for example: # readonly - can be used in production diff --git a/test/produce-consume.yml b/test/produce-consume.yml index f568c56..876cf2a 100644 --- a/test/produce-consume.yml +++ b/test/produce-consume.yml @@ -81,12 +81,12 @@ spec: type: Recreate selector: matchLabels: - test-target: kafka + test-target: kafka-client-console test-type: readiness template: metadata: labels: - test-target: kafka + test-target: kafka-client-console test-type: readiness # for example: # readonly - can be used in production -- cgit v1.2.3 From 6fd8fc0ceb13dee4578b0ba5280c0beecf857270 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Thu, 9 Nov 2017 14:06:18 +0100 Subject: Identifies topic jobs, and the resulting pods, by name --- test/kafkacat.yml | 2 +- test/produce-consume.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/kafkacat.yml b/test/kafkacat.yml index 639cc60..f21c280 100644 --- a/test/kafkacat.yml +++ b/test/kafkacat.yml @@ -63,7 +63,7 @@ data: apiVersion: batch/v1 kind: Job metadata: - name: test-kafkacat + name: topic-test-kafkacat namespace: test-kafka spec: template: diff --git a/test/produce-consume.yml b/test/produce-consume.yml index 876cf2a..519cccc 100644 --- a/test/produce-consume.yml +++ b/test/produce-consume.yml @@ -48,7 +48,7 @@ data: apiVersion: batch/v1 kind: Job metadata: - name: produce-consume + name: topic-test-produce-consume namespace: test-kafka spec: template: -- cgit v1.2.3 From 233ade373c10b0d3d8b66cd6e57fc62b293c3f1a Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Thu, 9 Nov 2017 14:10:49 +0100 Subject: Switches to ReplicaSet from Deployment, because configmap ... resources as scripts void the Deployment behavior anyway. And besides, there's no need to manage these tests like production resources. --- test/kafkacat.yml | 4 +--- test/produce-consume.yml | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/test/kafkacat.yml b/test/kafkacat.yml index f21c280..61465c7 100644 --- a/test/kafkacat.yml +++ b/test/kafkacat.yml @@ -86,14 +86,12 @@ spec: restartPolicy: Never --- apiVersion: apps/v1beta2 -kind: Deployment +kind: ReplicaSet metadata: name: test-kafkacat namespace: test-kafka spec: replicas: 1 - strategy: - type: Recreate selector: matchLabels: test-target: kafka-client-kafkacat diff --git a/test/produce-consume.yml b/test/produce-consume.yml index 519cccc..a326f01 100644 --- a/test/produce-consume.yml +++ b/test/produce-consume.yml @@ -71,14 +71,12 @@ spec: restartPolicy: Never --- apiVersion: apps/v1beta2 -kind: Deployment +kind: ReplicaSet metadata: name: produce-consume namespace: test-kafka spec: replicas: 1 - strategy: - type: Recreate selector: matchLabels: test-target: kafka-client-console -- cgit v1.2.3 From 7d1eec36ed68887760043535c266e8a58f2d6186 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Thu, 9 Nov 2017 14:32:21 +0100 Subject: Naming fix --- test/kafkacat.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/kafkacat.yml b/test/kafkacat.yml index 61465c7..7fb636f 100644 --- a/test/kafkacat.yml +++ b/test/kafkacat.yml @@ -1,7 +1,7 @@ --- kind: ConfigMap metadata: - name: test-kafkacat + name: kafkacat namespace: test-kafka apiVersion: v1 data: @@ -88,7 +88,7 @@ spec: apiVersion: apps/v1beta2 kind: ReplicaSet metadata: - name: test-kafkacat + name: kafkacat namespace: test-kafka spec: replicas: 1 @@ -176,6 +176,6 @@ spec: volumes: - name: config configMap: - name: test-kafkacat + name: kafkacat - name: shared emptyDir: {} -- cgit v1.2.3 From 57ed995c60f9166be5695999d2fc45938235d0d0 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Thu, 9 Nov 2017 14:35:40 +0100 Subject: Use the bootstrap service (#52) for repeated bootstraps The test should still pass if any single broker is down. --- test/kafkacat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/kafkacat.yml b/test/kafkacat.yml index 7fb636f..61a265c 100644 --- a/test/kafkacat.yml +++ b/test/kafkacat.yml @@ -149,7 +149,7 @@ spec: image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 env: - name: BOOTSTRAP - value: kafka-0.broker.kafka.svc.cluster.local:9092 + value: bootstrap.kafka:9092 command: - /bin/bash - -e -- cgit v1.2.3 From 75e3db4e7ab2a62546d82b3ee19e295e7142320c Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Thu, 9 Nov 2017 15:04:25 +0100 Subject: Adapts readme to 56aad28 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 66f329f..901cefd 100644 --- a/README.md +++ b/README.md @@ -80,5 +80,5 @@ Like the rest of this repo they have `kubectl` as the only local dependency. ``` kubectl apply -f test/ # Anything that isn't READY here is a failed test -kubectl get pods -l test-target=kafka,test-type=readiness -w --all-namespaces +kubectl get pods -l test-type=readiness -w --namespace=test-kafka ``` -- cgit v1.2.3