Skip to content

Commit 75c201f

Browse files
committed
Merge branch 'improvement/ZENKO-4286' into q/2.11
2 parents 411ec41 + 9703de5 commit 75c201f

File tree

5 files changed

+48
-4
lines changed

5 files changed

+48
-4
lines changed

.github/scripts/end2end/common.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,41 @@ wait_for_all_pods_behind_services() {
6161
done
6262
done
6363
}
64+
65+
# wait for consumer group to be in a stable state (no rebance + at least one consumer connected)
66+
wait_for_consumer_group() {
67+
namespace=$1
68+
# Getting the name of the first kafka pod
69+
kafka_pod=$(kubectl get pods -n $namespace -l brokerId=0,kafka_cr=end2end-base-queue,app=kafka -o jsonpath='{.items[0].metadata.name}')
70+
consumer_group=$2
71+
# When a pod is restarted the previous consumer is kept in the group until the session timeout expires
72+
expected_members=$3
73+
timeout_s=$4
74+
interval_s=${5:-5}
75+
kubectl exec -it $kafka_pod -n $namespace -- bash -c '
76+
export KAFKA_OPTS=
77+
consumer_group=$1
78+
expected_members=$2
79+
timeout_s=$3
80+
interval_s=$4
81+
start_time=$(date +%s)
82+
while true; do
83+
# The state becomes "Stable" when no rebalance is happening and at least one consumer is connected
84+
state=$(kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group $consumer_group --state | awk '"'"'NF>1 && $(NF-1) != "STATE" {print (NF>1?$(NF-1):"None")} {next}'"'"')
85+
members=$(kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group $consumer_group --state | awk '"'"'NF>1 && $NF != "#MEMBERS" {print (NF>1?$NF:"None")} {next}'"'"')
86+
echo "Consumer group $consumer_group state: $state, members: $members"
87+
if [ "$state" == "Stable" ] && [ "$members" -eq "$expected_members" ]; then
88+
echo "Consumer group $consumer_group is now consuming."
89+
exit 0
90+
fi
91+
# Check if we have reached the timeout
92+
current_time=$(date +%s)
93+
elapsed_time=$((current_time - start_time))
94+
if [ "$elapsed_time" -ge "$timeout_s" ]; then
95+
echo "Error: Timed out waiting for consumer group $consumer_group to start consuming."
96+
exit 1
97+
fi
98+
sleep $interval_s
99+
done
100+
' -- "$consumer_group" "$expected_members" "$timeout_s" "$interval_s"
101+
}

.github/scripts/end2end/configs/zenko.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
ingestionProcessor:
3535
concurrency: 2
3636
logging:
37-
logLevel: trace
37+
logLevel: debug
3838
mongodb:
3939
provider: External
4040
endpoints:

.github/scripts/end2end/configure-e2e.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,10 @@ sleep 10
109109

110110
kubectl wait --for condition=DeploymentFailure=false --timeout 25m -n ${NAMESPACE} zenko/${ZENKO_NAME}
111111
kubectl wait --for condition=DeploymentInProgress=false --timeout 25m -n ${NAMESPACE} zenko/${ZENKO_NAME}
112+
113+
114+
if [ $ENABLE_RING_TESTS = true ]; then
115+
# wait for ingestion processor to start consuming from Kafka
116+
ingestion_processor_replicas=$(kubectl -n $NAMESPACE get deploy/end2end-backbeat-ingestion-processor -o jsonpath='{.spec.replicas}')
117+
wait_for_consumer_group $NAMESPACE $UUID.backbeat-ingestion-group $ingestion_processor_replicas 300
118+
fi

tests/zenko_tests/node_tests/backbeat/tests/ingestion/ingestionS3CPauseResume.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ describe('Ingestion pause resume', function () {
9393
'non-existent-location',
9494
(err, data) => {
9595
assert.ifError(err);
96-
assert.strictEqual(data.code, 404);
9796
assert.strictEqual(data.RouteNotFound, true);
9897
return done();
9998
},

tests/zenko_tests/node_tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@
4646
"test_expiration": "mocha --tags ${MOCHA_TAGS} --exit -t 900000 --reporter mocha-multi-reporters --reporter-options configFile=config.json backbeat/tests/lifecycle/expiration.js",
4747
"test_transition": "mocha --tags ${MOCHA_TAGS} --exit -t 900000 --reporter mocha-multi-reporters --reporter-options configFile=config.json backbeat/tests/lifecycle/transition.js",
4848
"test_lifecycle": "mocha --tags ${MOCHA_TAGS} --exit -t 1800000 --reporter mocha-multi-reporters --reporter-options configFile=config.json --recursive backbeat/tests/lifecycle",
49-
"test_ingestion_oob_s3c": "mocha --tags ${MOCHA_TAGS} --exit -t 100000 --reporter mocha-multi-reporters --reporter-options configFile=config.json --recursive backbeat/tests/ingestion",
49+
"test_ingestion_oob_s3c": "mocha --tags ${MOCHA_TAGS} --exit -t 180000 --reporter mocha-multi-reporters --reporter-options configFile=config.json --recursive backbeat/tests/ingestion",
5050
"test_location_quota": "mocha --tags ${MOCHA_TAGS} --exit -t 10000 --reporter mocha-multi-reporters --reporter-options configFile=config.json --recursive cloudserver/locationQuota/tests",
5151
"test_bucket_get_v2": "mocha --tags ${MOCHA_TAGS} --exit -t 10000 --reporter mocha-multi-reporters --reporter-options configFile=config.json --recursive cloudserver/bucketGetV2/tests",
5252
"test_bucket_policy": "mocha --tags ${MOCHA_TAGS} --exit -t 10000 --reporter mocha-multi-reporters --reporter-options configFile=config.json --recursive cloudserver/bucketPolicy/tests",
5353
"test_operator": "mocha --tags ${MOCHA_TAGS} --exit -t 10000 --reporter mocha-multi-reporters --reporter-options configFile=config.json ./init_test.js",
5454
"test_smoke": "mocha --tags ${MOCHA_TAGS} --exit -t 10000 --reporter mocha-multi-reporters --reporter-options configFile=config.json --recursive smoke_tests",
5555
"test_iam_policies": "mocha --tags ${MOCHA_TAGS} --exit -t 15000 --reporter mocha-multi-reporters --reporter-options configFile=config.json --recursive iam_policies",
56-
"test_all_extensions": "run-p --aggregate-output test_aws_crr test_expiration test_transition",
56+
"test_all_extensions": "run-p --aggregate-output test_aws_crr test_expiration test_transition test_ingestion_oob_s3c",
5757
"test_object_api": "mocha --tags ${MOCHA_TAGS} --exit -t 10000 --reporter mocha-multi-reporters --reporter-options configFile=config.json --recursive cloudserver/keyFormatVersion/tests",
5858
"lint": "eslint $(find . -name '*.js' -not -path '*/node_modules/*')"
5959
},

0 commit comments

Comments
 (0)