Skip to content

Commit 2ab6fe2

Browse files
committed
More ideas
1 parent ec15775 commit 2ab6fe2

File tree

1 file changed

+42
-18
lines changed

1 file changed

+42
-18
lines changed

test/basic-with-kafkacat.yml

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,21 @@ data:
99
setup.sh: |-
1010
touch /tmp/testlog
1111
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-
1712
tail -f /tmp/testlog
1813
1914
test.sh: |-
2015
exec >> /tmp/testlog
2116
exec 2>&1
2217
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"
2723
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
3727
3828
exit 0
3929
@@ -90,6 +80,38 @@ spec:
9080
#test-use:
9181
spec:
9282
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
93115
- name: testcase
94116
image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef
95117
env:
@@ -121,3 +143,5 @@ spec:
121143
- name: config
122144
configMap:
123145
name: test-basic-with-kafkacat
146+
- name: shared
147+
emptyDir: {}

0 commit comments

Comments
 (0)