Skip to content

Commit 52ab07d

Browse files
authored
Improve kafka e2e tests stability (#311)
1 parent 541ad37 commit 52ab07d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/workflows/e2e-test.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,17 @@ jobs:
147147
run: |-
148148
# wait for 2 intents to be discovered with timeout of 30 seconds.
149149
# sleeps 10 because this is the report interval from the watcher to the mapper
150-
for i in {1..5}
150+
for i in {1..10}
151151
do
152152
OUTPUT_JSON=`otterize network-mapper export --telemetry-enabled=false -n otterize-tutorial-kafka-mapping --format=json`
153-
if [ `echo "$OUTPUT_JSON" | jq ". | length"` != 2 ] || [ `echo "$OUTPUT_JSON" | jq '[.[] | select(.spec.targets[] | has("kafka"))] | length'` != 2 ] ; then
153+
# Check for muber of items, should expect 2 - client & client2
154+
NUM_ITEMS=$(echo "$OUTPUT_JSON" | jq '. | length')
155+
# Number of kafka items
156+
NUM_OF_KAFKA_TARGETS=$(echo "$OUTPUT_JSON" | jq '[.[] | select(.spec.targets[] | has("kafka"))] | length')
157+
# Number of correct operations - records with 2 kafka operations
158+
ITEMS_WITH_CORRECT_OPERATIONS=$(echo "$OUTPUT_JSON" | jq '[.[] | .spec.targets[] | select(has("kafka")) | select(.kafka.topics[0].operations | length == 2)] | length')
159+
160+
if [ "$NUM_ITEMS" != 2 ] || [ "$NUM_OF_KAFKA_TARGETS" != 2 ] || [ "$ITEMS_WITH_CORRECT_OPERATIONS" != 2 ]; then
154161
echo "wait for discovered intents";
155162
echo _SNIFFER LOGS_
156163
kubectl logs --since=15s -n otterize-system -l app=otterize-network-sniffer

0 commit comments

Comments
 (0)