@@ -15,17 +15,17 @@ data:
15
15
exec >> /tmp/testlog
16
16
exec 2>&1
17
17
18
- PRODUCE_WAIT=.1
18
+ PC_WAIT=.2
19
19
MAX_AGE=5
20
20
21
21
UNIQUE="${HOSTNAME}@$(date -u -Ins)"
22
22
23
23
echo "Test $UNIQUE" >> /shared/produce.tmp
24
- sleep $PRODUCE_WAIT
25
- LAST=$(kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '%T= %s' -c 1 -u )
24
+ sleep $PC_WAIT
25
+ LAST=$(tail -n 1 /shared/consumed.tmp )
26
26
27
- LAST_TS=$(echo $LAST | awk -F'= ' '{print $1}')
28
- LAST_MSG=$(echo $LAST | awk -F'= ' '{print $2 }')
27
+ LAST_TS=$(echo $LAST | awk -F'; ' '{print $1}')
28
+ LAST_MSG=$(echo $LAST | awk -F'; ' '{print $4 }')
29
29
NOW=$(date -u +%s%3N)
30
30
DIFF_S=$((($NOW - $LAST_TS)/1000))
31
31
DIFF_MS=$((($NOW - $LAST_TS)%1000))
45
45
fi
46
46
47
47
# get info about this message
48
- kafkacat -Q -b $BOOTSTRAP -t test-basic-with-kafkacat:0:$LAST_TS
48
+ kafkacat -Q -b $BOOTSTRAP -t test-basic-with-kafkacat:0:$LAST_TS || \
49
+ echo "At $(date +%FT%H:%M:%S.%3N) bootstrap broker might be down"
50
+ # but don't fail the test; producer and consumer should keep going if there are other brokers
49
51
50
52
# We haven't asserted that the consumer works, so we'll just have to assume that it will exit if it fails
51
53
@@ -113,9 +115,11 @@ spec:
113
115
- /bin/bash
114
116
- -cex
115
117
- >
116
- echo "--- start $HOSTNAME $(date --iso-8601='ns' -u) ---" >> /shared/produce.tmp;
118
+ echo "--- start $HOSTNAME $(date --iso-8601='ns' -u) ---" >> /shared/produce.tmp
119
+ ;
117
120
tail -f /shared/produce.tmp |
118
- kafkacat -P -b $BOOTSTRAP -t test-basic-with-kafkacat -v -T -d broker;
121
+ kafkacat -P -b $BOOTSTRAP -t test-basic-with-kafkacat -v -T -d broker
122
+ ;
119
123
volumeMounts :
120
124
- name : config
121
125
mountPath : /test
@@ -130,7 +134,9 @@ spec:
130
134
- /bin/bash
131
135
- -cex
132
136
- >
133
- kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '[%p,%o] %s\n' -u -d broker;
137
+ kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -f '%T;%p;%o;%s\n' -u -d broker |
138
+ tee /shared/consumed.tmp
139
+ ;
134
140
volumeMounts :
135
141
- name : config
136
142
mountPath : /test
0 commit comments