|
9 | 9 | setup.sh: |-
|
10 | 10 | touch /tmp/testlog
|
11 | 11 |
|
12 |
| - touch /tmp/produce |
13 |
| - tail -f /tmp/produce | kafkacat -P -b $BOOTSTRAP -t test-basic-with-kafkacat -v > /tmp/producer.out 2> /tmp/producer.err & |
14 |
| -
|
15 |
| - kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -q -f '[%p,%o] %s\n' > /tmp/consumer.out 2> /tmp/consumer.err & |
16 |
| -
|
17 | 12 | tail -f /tmp/testlog
|
18 | 13 |
|
19 | 14 | test.sh: |-
|
20 | 15 | exec >> /tmp/testlog
|
21 | 16 | exec 2>&1
|
22 | 17 |
|
23 |
| - unique=$(date -Ins) |
24 |
| - echo "Test $unique" >> /tmp/produce |
25 |
| - sleep 1 |
26 |
| - LAST=$(tail -n 1 /tmp/consumer.out | tee -a /tmp/testlog) |
| 18 | + LAST_TS=$(kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '%T\n' -c 1 -u) |
| 19 | + NOW=$(date -u +%s%3N) |
| 20 | + echo "$NOW ($(date +%FT%H:%M:%S.%3N)):" |
| 21 | + echo "$LAST_TS" |
| 22 | + echo "$((($NOW - $LAST_TS)/1000)) seconds old" |
27 | 23 |
|
28 |
| - [ "$LAST" == *"$unique" ] || { |
29 |
| - echo "Last message '$LAST' doesn't contain marker '$unique'" |
30 |
| - #kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -e | grep $unique |
31 |
| - #echo "Producer output:" |
32 |
| - #cat /tmp/producer.out |
33 |
| - #echo "Producer err:" |
34 |
| - #cat /tmp/producer.err |
35 |
| - #exit 1 |
36 |
| - } |
| 24 | + #Q_TS=$(date -u +%s%3N) |
| 25 | + Q_TS=$LAST_TS |
| 26 | + kafkacat -Q -b $BOOTSTRAP -t test-basic-with-kafkacat:0:$Q_TS |
37 | 27 |
|
38 | 28 | exit 0
|
39 | 29 |
|
|
90 | 80 | #test-use:
|
91 | 81 | spec:
|
92 | 82 | containers:
|
| 83 | + - name: producer |
| 84 | + image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef |
| 85 | + env: |
| 86 | + - name: BOOTSTRAP |
| 87 | + value: kafka-0.broker.kafka.svc.cluster.local:9092 |
| 88 | + command: |
| 89 | + - /bin/bash |
| 90 | + - -cex |
| 91 | + - > |
| 92 | + echo "--- start $HOSTNAME $(date --iso-8601='ns' -u) ---" >> /shared/produce.tmp; |
| 93 | + tail -f /shared/produce.tmp | |
| 94 | + kafkacat -P -b $BOOTSTRAP -t test-basic-with-kafkacat -v -T; |
| 95 | + volumeMounts: |
| 96 | + - name: config |
| 97 | + mountPath: /test |
| 98 | + - name: shared |
| 99 | + mountPath: /shared |
| 100 | + - name: consumer |
| 101 | + image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef |
| 102 | + env: |
| 103 | + - name: BOOTSTRAP |
| 104 | + value: kafka-0.broker.kafka.svc.cluster.local:9092 |
| 105 | + command: |
| 106 | + - /bin/bash |
| 107 | + - -cex |
| 108 | + - > |
| 109 | + kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '[%p,%o] %s\n' -u |
| 110 | + volumeMounts: |
| 111 | + - name: config |
| 112 | + mountPath: /test |
| 113 | + - name: shared |
| 114 | + mountPath: /shared |
93 | 115 | - name: testcase
|
94 | 116 | image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef
|
95 | 117 | env:
|
@@ -121,3 +143,5 @@ spec:
|
121 | 143 | - name: config
|
122 | 144 | configMap:
|
123 | 145 | name: test-basic-with-kafkacat
|
| 146 | + - name: shared |
| 147 | + emptyDir: {} |
0 commit comments