File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,7 @@ jobs:
166166 CI_KAFKA_HEADER_INDEX : kafka
167167 CI_DATAGEN_IMAGE : rock1017/log-generator:latest
168168 CI_OLD_CONNECTOR_VERSION : v2.0.1
169+ CI_KAFKA_VERSION_BEFORE_3_7 : ${{ matrix.kafka_version == '3.5.1' || matrix.kafka_version == '3.6.2' }}
169170
170171 steps :
171172 - name : Checkout
Original file line number Diff line number Diff line change @@ -29,9 +29,14 @@ def check_events_from_topic(target):
2929
3030 t_end = time .time () + 100
3131 time .sleep (5 )
32- while time .time () < t_end :
33- output1 = subprocess .getoutput (" echo $(/usr/local/kafka/bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 'localhost:9092' --topic kafka_connect_upgrade --time -1 | grep -e ':[[:digit:]]*:' | awk -F ':' '{sum += $3} END {print sum}')" )
34- output2 = subprocess .getoutput ("echo $(/usr/local/kafka/bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 'localhost:9092' --topic kafka_connect_upgrade --time -2 | grep -e ':[[:digit:]]*:' | awk -F ':' '{sum += $3} END {print sum}')" )
32+ while time .time () < t_end :
33+ kafka_version_flag = os .environ .get ("CI_KAFKA_VERSION_BEFORE_3_7" )
34+ if kafka_version_flag :
35+ class_name = "kafka.tools.GetOffsetShell"
36+ else :
37+ class_name = "org.apache.kafka.tools.GetOffsetShell"
38+ output1 = subprocess .getoutput (f" echo $(/usr/local/kafka/bin/kafka-run-class.sh ${ class_name } --broker-list 'localhost:9092' --topic kafka_connect_upgrade --time -1 | grep -e ':[[:digit:]]*:' | awk -F ':' '{ sum + = $3 } END { print sum } ')" )
39+ output2 = subprocess .getoutput (f"echo $(/usr/local/kafka/bin/kafka-run-class.sh ${ class_name } --broker-list 'localhost:9092' --topic kafka_connect_upgrade --time -2 | grep -e ':[[:digit:]]*:' | awk -F ':' '{ sum + = $3 } END { print sum } ')" )
3540 time .sleep (5 )
3641 if (int (output1 )- int (output2 ))== target :
3742 logger .info ("Events in the topic :" + str (int (output1 )- int (output2 )))
You can’t perform that action at this time.
0 commit comments