Skip to content

Commit f34eaae

Browse files
authored
ci: splitted collector-tracing-messaging tests into 5 builds (#2032)
- the enabling of rdkafka slows down the build
1 parent ba51a46 commit f34eaae

6 files changed

+282
-25
lines changed

.tekton/generate-test-files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const groups = {
6767
'rabbitmq'
6868
],
6969
condition: ' && ! echo "$MODIFIED_FILES" | grep -q "packages/core/src/tracing/instrumentation/messaging"',
70-
split: 4,
70+
split: 5,
7171
scope: '@instana/collector',
7272
subname: 'test:ci:tracing:messaging'
7373
},

.tekton/tasks/test-groups/collector-tracing-messaging-split-2-task.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,28 +224,28 @@ spec:
224224
retry=1
225225
while [ $retry -le 3 ]; do
226226
if [ "$(params.coverage)" == "true" ]; then
227-
if [[ 4 =~ ^[0-9]+$ ]]; then
228-
CI_TEST_SPLIT=4 CI_TEST_SPLIT_CURRENT=2 npm run coverage-ci --npm_command="test:ci:collector:tracing:messaging" --report_dir="collector-tracing-messaging-split-2"
227+
if [[ 5 =~ ^[0-9]+$ ]]; then
228+
CI_TEST_SPLIT=5 CI_TEST_SPLIT_CURRENT=2 npm run coverage-ci --npm_command="test:ci:collector:tracing:messaging" --report_dir="collector-tracing-messaging-split-2"
229229
else
230230
npm run coverage-ci --npm_command="test:ci:collector:tracing:messaging" --report_dir="collector-tracing-messaging-split-2"
231231
fi
232232
else
233-
if [[ 4 =~ ^[0-9]+$ ]]; then
234-
CI_TEST_SPLIT=4 CI_TEST_SPLIT_CURRENT=2 npx lerna run "test:ci:tracing:messaging" --stream --scope="@instana/collector"
233+
if [[ 5 =~ ^[0-9]+$ ]]; then
234+
CI_TEST_SPLIT=5 CI_TEST_SPLIT_CURRENT=2 npx lerna run "test:ci:tracing:messaging" --stream --scope="@instana/collector"
235235
else
236236
npm run "test:ci:collector:tracing:messaging"
237237
fi
238238
fi
239239
if [ $? -eq 0 ]; then
240-
if [[ 4 =~ ^[0-9]+$ ]]; then
240+
if [[ 5 =~ ^[0-9]+$ ]]; then
241241
touch "test:ci:tracing:messaging.succeeded"
242242
else
243243
touch "test:ci:collector:tracing:messaging.succeeded"
244244
fi
245245
break
246246
else
247247
if [ $retry -eq 3 ]; then
248-
if [[ 4 =~ ^[0-9]+$ ]]; then
248+
if [[ 5 =~ ^[0-9]+$ ]]; then
249249
touch "test:ci:tracing:messaging.failed"
250250
else
251251
touch "test:ci:collector:tracing:messaging.failed"

.tekton/tasks/test-groups/collector-tracing-messaging-split-3-task.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,28 +224,28 @@ spec:
224224
retry=1
225225
while [ $retry -le 3 ]; do
226226
if [ "$(params.coverage)" == "true" ]; then
227-
if [[ 4 =~ ^[0-9]+$ ]]; then
228-
CI_TEST_SPLIT=4 CI_TEST_SPLIT_CURRENT=3 npm run coverage-ci --npm_command="test:ci:collector:tracing:messaging" --report_dir="collector-tracing-messaging-split-3"
227+
if [[ 5 =~ ^[0-9]+$ ]]; then
228+
CI_TEST_SPLIT=5 CI_TEST_SPLIT_CURRENT=3 npm run coverage-ci --npm_command="test:ci:collector:tracing:messaging" --report_dir="collector-tracing-messaging-split-3"
229229
else
230230
npm run coverage-ci --npm_command="test:ci:collector:tracing:messaging" --report_dir="collector-tracing-messaging-split-3"
231231
fi
232232
else
233-
if [[ 4 =~ ^[0-9]+$ ]]; then
234-
CI_TEST_SPLIT=4 CI_TEST_SPLIT_CURRENT=3 npx lerna run "test:ci:tracing:messaging" --stream --scope="@instana/collector"
233+
if [[ 5 =~ ^[0-9]+$ ]]; then
234+
CI_TEST_SPLIT=5 CI_TEST_SPLIT_CURRENT=3 npx lerna run "test:ci:tracing:messaging" --stream --scope="@instana/collector"
235235
else
236236
npm run "test:ci:collector:tracing:messaging"
237237
fi
238238
fi
239239
if [ $? -eq 0 ]; then
240-
if [[ 4 =~ ^[0-9]+$ ]]; then
240+
if [[ 5 =~ ^[0-9]+$ ]]; then
241241
touch "test:ci:tracing:messaging.succeeded"
242242
else
243243
touch "test:ci:collector:tracing:messaging.succeeded"
244244
fi
245245
break
246246
else
247247
if [ $retry -eq 3 ]; then
248-
if [[ 4 =~ ^[0-9]+$ ]]; then
248+
if [[ 5 =~ ^[0-9]+$ ]]; then
249249
touch "test:ci:tracing:messaging.failed"
250250
else
251251
touch "test:ci:collector:tracing:messaging.failed"

.tekton/tasks/test-groups/collector-tracing-messaging-split-4-task.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,28 +224,28 @@ spec:
224224
retry=1
225225
while [ $retry -le 3 ]; do
226226
if [ "$(params.coverage)" == "true" ]; then
227-
if [[ 4 =~ ^[0-9]+$ ]]; then
228-
CI_TEST_SPLIT=4 CI_TEST_SPLIT_CURRENT=4 npm run coverage-ci --npm_command="test:ci:collector:tracing:messaging" --report_dir="collector-tracing-messaging-split-4"
227+
if [[ 5 =~ ^[0-9]+$ ]]; then
228+
CI_TEST_SPLIT=5 CI_TEST_SPLIT_CURRENT=4 npm run coverage-ci --npm_command="test:ci:collector:tracing:messaging" --report_dir="collector-tracing-messaging-split-4"
229229
else
230230
npm run coverage-ci --npm_command="test:ci:collector:tracing:messaging" --report_dir="collector-tracing-messaging-split-4"
231231
fi
232232
else
233-
if [[ 4 =~ ^[0-9]+$ ]]; then
234-
CI_TEST_SPLIT=4 CI_TEST_SPLIT_CURRENT=4 npx lerna run "test:ci:tracing:messaging" --stream --scope="@instana/collector"
233+
if [[ 5 =~ ^[0-9]+$ ]]; then
234+
CI_TEST_SPLIT=5 CI_TEST_SPLIT_CURRENT=4 npx lerna run "test:ci:tracing:messaging" --stream --scope="@instana/collector"
235235
else
236236
npm run "test:ci:collector:tracing:messaging"
237237
fi
238238
fi
239239
if [ $? -eq 0 ]; then
240-
if [[ 4 =~ ^[0-9]+$ ]]; then
240+
if [[ 5 =~ ^[0-9]+$ ]]; then
241241
touch "test:ci:tracing:messaging.succeeded"
242242
else
243243
touch "test:ci:collector:tracing:messaging.succeeded"
244244
fi
245245
break
246246
else
247247
if [ $retry -eq 3 ]; then
248-
if [[ 4 =~ ^[0-9]+$ ]]; then
248+
if [[ 5 =~ ^[0-9]+$ ]]; then
249249
touch "test:ci:tracing:messaging.failed"
250250
else
251251
touch "test:ci:collector:tracing:messaging.failed"
Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
apiVersion: tekton.dev/v1beta1
2+
kind: Task
3+
metadata:
4+
name: collector-tracing-messaging-split-5
5+
spec:
6+
sidecars:
7+
- name: zookeeper
8+
image: confluentinc/cp-zookeeper:7.9.1
9+
imagePullPolicy: IfNotPresent
10+
env:
11+
- name: "ZOOKEEPER_CLIENT_PORT"
12+
value: "2181"
13+
readinessProbe:
14+
tcpSocket:
15+
port: 2181
16+
initialDelaySeconds: 5
17+
periodSeconds: 2
18+
timeoutSeconds: 30
19+
- name: kafka
20+
image: confluentinc/cp-kafka:7.9.1
21+
imagePullPolicy: IfNotPresent
22+
env:
23+
- name: "KAFKA_BROKER_ID"
24+
value: "1"
25+
- name: "KAFKA_ZOOKEEPER_CONNECT"
26+
value: "localhost:2181"
27+
- name: "KAFKA_ADVERTISED_LISTENERS"
28+
value: "PLAINTEXT://127.0.0.1:29092,EXTERNAL://localhost:9092"
29+
- name: "KAFKA_LISTENERS"
30+
value: "EXTERNAL://:9092,PLAINTEXT://:29092"
31+
- name: "KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR"
32+
value: "1"
33+
- name: "KAFKA_DEFAULT_REPLICATION_FACTOR"
34+
value: "1"
35+
- name: "KAFKA_LISTENER_SECURITY_PROTOCOL_MAP"
36+
value: "PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT,EXTERNAL:PLAINTEXT"
37+
readinessProbe:
38+
tcpSocket:
39+
port: 9092
40+
initialDelaySeconds: 90
41+
periodSeconds: 2
42+
timeoutSeconds: 60
43+
- name: kafka-topics
44+
image: confluentinc/cp-kafka:7.9.1
45+
imagePullPolicy: IfNotPresent
46+
args:
47+
- "-lc"
48+
- "kafka_server=\"0.0.0.0:9092\"; kafka_topics=\"test test-topic test-batch-topic rdkafka-topic kafka-avro-topic\"; until kafka-topics --bootstrap-server \"$kafka_server\" --list >/dev/null 2>&1; do echo 'waiting for Kafka...'; sleep 2; done; for t in $kafka_topics; do kafka-topics --bootstrap-server \"$kafka_server\" --create --if-not-exists --topic \"$t\"; done; echo 'All topics created.'"
49+
command:
50+
- "/bin/bash"
51+
- name: schema-registry
52+
image: confluentinc/cp-schema-registry:7.9.0
53+
imagePullPolicy: IfNotPresent
54+
env:
55+
- name: "SCHEMA_REGISTRY_HOST_NAME"
56+
value: "schema-registry"
57+
- name: "SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL"
58+
value: "0.0.0.0:2181"
59+
- name: "SCHEMA_REGISTRY_LISTENERS"
60+
value: "http://0.0.0.0:8081"
61+
- name: "SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS"
62+
value: "PLAINTEXT://0.0.0.0:29092"
63+
- name: "SCHEMA_REGISTRY_DEBUG"
64+
value: "true"
65+
readinessProbe:
66+
httpGet:
67+
path: /
68+
port: 8081
69+
initialDelaySeconds: 5
70+
periodSeconds: 2
71+
timeoutSeconds: 60
72+
- name: redis
73+
image: public.ecr.aws/docker/library/redis:7.4.3
74+
imagePullPolicy: IfNotPresent
75+
- name: nats
76+
image: nats:2.9.14-linux
77+
imagePullPolicy: IfNotPresent
78+
- name: nats-streaming
79+
image: nats-streaming:0.25.3-linux
80+
imagePullPolicy: IfNotPresent
81+
args:
82+
- "-p"
83+
- "4223"
84+
- "-m"
85+
- "8223"
86+
readinessProbe:
87+
httpGet:
88+
path: /healthz
89+
port: 8223
90+
initialDelaySeconds: 5
91+
periodSeconds: 2
92+
timeoutSeconds: 15
93+
- name: nats-streaming-2
94+
image: nats-streaming:0.25.3-linux
95+
imagePullPolicy: IfNotPresent
96+
args:
97+
- "-p"
98+
- "4224"
99+
- "-m"
100+
- "8224"
101+
readinessProbe:
102+
httpGet:
103+
path: /healthz
104+
port: 8224
105+
initialDelaySeconds: 5
106+
periodSeconds: 2
107+
timeoutSeconds: 15
108+
- name: rabbitmq
109+
image: public.ecr.aws/docker/library/rabbitmq:3.13.0
110+
imagePullPolicy: IfNotPresent
111+
readinessProbe:
112+
tcpSocket:
113+
port: 5672
114+
initialDelaySeconds: 7
115+
periodSeconds: 2
116+
timeoutSeconds: 60
117+
envFrom:
118+
- configMapRef:
119+
name: environment-properties
120+
params:
121+
- name: node-version
122+
value: $(params.node-version)
123+
- name: npm-version
124+
value: $(params.npm-version)
125+
- name: repository
126+
value: $(params.repository)
127+
- name: revision
128+
value: $(params.revision)
129+
- name: continuous-delivery-context-secret
130+
value: $(params.continuous-delivery-context-secret)
131+
- name: esm
132+
value: $(params.esm)
133+
- name: coverage
134+
value: $(params.coverage)
135+
- name: prerelease
136+
value: $(params.prerelease)
137+
workspaces:
138+
- name: output
139+
mountPath: /artifacts
140+
steps:
141+
- name: run-test-group
142+
env:
143+
- name: AWS_ACCESS_KEY_ID
144+
valueFrom:
145+
secretKeyRef:
146+
name: $(params.continuous-delivery-context-secret)
147+
key: "AWS_ACCESS_KEY_ID"
148+
- name: AWS_SECRET_ACCESS_KEY
149+
valueFrom:
150+
secretKeyRef:
151+
name: $(params.continuous-delivery-context-secret)
152+
key: "AWS_SECRET_ACCESS_KEY"
153+
- name: AZURE_REDIS_CLUSTER_PWD
154+
valueFrom:
155+
secretKeyRef:
156+
name: $(params.continuous-delivery-context-secret)
157+
key: "AZURE_REDIS_CLUSTER_PWD"
158+
- name: DB2_CONNECTION_STR
159+
valueFrom:
160+
secretKeyRef:
161+
name: $(params.continuous-delivery-context-secret)
162+
key: "DB2_CONNECTION_STR"
163+
- name: GOOGLE_APPLICATION_CREDENTIALS_CONTENT
164+
valueFrom:
165+
secretKeyRef:
166+
name: $(params.continuous-delivery-context-secret)
167+
key: "GOOGLE_APPLICATION_CREDENTIALS_CONTENT"
168+
- name: AZURE_SQL_PWD
169+
valueFrom:
170+
secretKeyRef:
171+
name: $(params.continuous-delivery-context-secret)
172+
key: "AZURE_SQL_PWD"
173+
- name: AZURE_STORAGE_ACCOUNT_KEY
174+
valueFrom:
175+
secretKeyRef:
176+
name: $(params.continuous-delivery-context-secret)
177+
key: "AZURE_STORAGE_ACCOUNT_KEY"
178+
image: public.ecr.aws/docker/library/node:$(params.node-version)
179+
imagePullPolicy: IfNotPresent
180+
script: |
181+
#!/bin/bash
182+
ARTIFACTS_PATH="$(workspaces.output.path)"
183+
cd $ARTIFACTS_PATH
184+
BASE_REVISION=$(git rev-parse origin/main)
185+
CIRCLE_COMPARE_URL=""
186+
MODIFIED_FILES=""
187+
GIT_COMMIT_DESC=""
188+
if [ "$(params.prerelease)" == "true" ]; then
189+
source bin/install-prerelease.sh
190+
echo "Using node: $(node --version)"
191+
fi
192+
if [ -n "$(params.npm-version)" ]; then
193+
npm install npm@$(params.npm-version) -g
194+
fi
195+
if [ -n "$(params.revision)" ]; then
196+
CIRCLE_COMPARE_URL="$(params.repository)/compare/$BASE_REVISION..$(params.revision)"
197+
MODIFIED_FILES=$(git diff-tree --no-commit-id --name-only -r $(echo ${CIRCLE_COMPARE_URL} | cut -d/ -f 7))
198+
GIT_COMMIT_DESC=$(git log --format=%B -n 1 $(params.revision))
199+
fi
200+
echo "BASE_REVISION: $BASE_REVISION"
201+
echo "CIRCLE_COMPARE_URL: $CIRCLE_COMPARE_URL"
202+
echo "MODIFIED_FILES: $MODIFIED_FILES"
203+
echo "GIT_COMMIT_DESC: $GIT_COMMIT_DESC"
204+
if echo "$GIT_COMMIT_DESC" | grep -q '\[ci reduced\]' && ! echo "$MODIFIED_FILES" | grep -q "packages/core/src/tracing/instrumentation/messaging"; then
205+
echo "Skipping group."
206+
touch "test:ci:collector:tracing:messaging.succeeded"
207+
exit 0
208+
fi
209+
export CI=true
210+
export GCP_PROJECT="k8s-brewery"
211+
export AZURE_SQL_USERNAME="admin@instana@nodejs-team-db-server"
212+
export AZURE_SQL_SERVER="nodejs-team-db-server.database.windows.net"
213+
export AZURE_REDIS_CLUSTER="team-nodejs-redis-cluster-tekton.redis.cache.windows.net:6380"
214+
export AZURE_SQL_DATABASE="azure-nodejs-test"
215+
export AZURE_STORAGE_ACCOUNT_NAME="nodejstracerteam"
216+
if [ "$(params.esm)" == "true" ]; then
217+
export RUN_ESM=true
218+
if ! echo "test:ci:collector:tracing:messaging" | grep -q 'ci:collector'; then
219+
echo "Skipping tests because groupName does not contain 'ci:collector'."
220+
touch "test:ci:collector:tracing:messaging.succeeded"
221+
exit 0
222+
fi
223+
fi
224+
retry=1
225+
while [ $retry -le 3 ]; do
226+
if [ "$(params.coverage)" == "true" ]; then
227+
if [[ 5 =~ ^[0-9]+$ ]]; then
228+
CI_TEST_SPLIT=5 CI_TEST_SPLIT_CURRENT=5 npm run coverage-ci --npm_command="test:ci:collector:tracing:messaging" --report_dir="collector-tracing-messaging-split-5"
229+
else
230+
npm run coverage-ci --npm_command="test:ci:collector:tracing:messaging" --report_dir="collector-tracing-messaging-split-5"
231+
fi
232+
else
233+
if [[ 5 =~ ^[0-9]+$ ]]; then
234+
CI_TEST_SPLIT=5 CI_TEST_SPLIT_CURRENT=5 npx lerna run "test:ci:tracing:messaging" --stream --scope="@instana/collector"
235+
else
236+
npm run "test:ci:collector:tracing:messaging"
237+
fi
238+
fi
239+
if [ $? -eq 0 ]; then
240+
if [[ 5 =~ ^[0-9]+$ ]]; then
241+
touch "test:ci:tracing:messaging.succeeded"
242+
else
243+
touch "test:ci:collector:tracing:messaging.succeeded"
244+
fi
245+
break
246+
else
247+
if [ $retry -eq 3 ]; then
248+
if [[ 5 =~ ^[0-9]+$ ]]; then
249+
touch "test:ci:tracing:messaging.failed"
250+
else
251+
touch "test:ci:collector:tracing:messaging.failed"
252+
fi
253+
exit 1
254+
fi
255+
retry=$((retry + 1))
256+
fi
257+
done

0 commit comments

Comments
 (0)