diff options
Diffstat (limited to 'test/basic-produce-consume.yml')
-rw-r--r-- | test/basic-produce-consume.yml | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/test/basic-produce-consume.yml b/test/basic-produce-consume.yml new file mode 100644 index 0000000..f56a01f --- /dev/null +++ b/test/basic-produce-consume.yml @@ -0,0 +1,89 @@ +--- +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-with-kafkacat \ + --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: 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:0.11.0.0@sha256:b27560de08d30ebf96d12e74f80afcaca503ad4ca3103e63b1fd43a2e4c976ce + 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 |