Skip to content

Commit 710783e

Browse files
authored
[ci] Fix workflows stable for ARM64 tests (#2553)
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
1 parent dce6831 commit 710783e

File tree

5 files changed

+80
-56
lines changed

5 files changed

+80
-56
lines changed

.circleci/config.yml

+45-38
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ workflows:
134134
test-strategy: test_parallel
135135
use-random-user: false
136136
platforms: linux/arm64
137-
machine-type: ubuntu2204arm64
138-
firefox-install-lang-package: true
137+
machine-type: ubuntu2204arm64large
138+
firefox-install-lang-package: false
139139
enable-managed-downloads: true
140140
- docker-test:
141141
name: "Docker test - Node relay commands"
@@ -202,7 +202,7 @@ jobs:
202202
command: |
203203
N=3
204204
while [ $N -gt 0 ]; do
205-
output=$(eval "PLATFORMS=${PLATFORMS} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build")
205+
PLATFORMS=${PLATFORMS} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
206206
status=$?
207207
if [ $status -eq 0 ]; then
208208
echo "Build images passed"
@@ -213,26 +213,31 @@ jobs:
213213
sleep 10
214214
fi
215215
done
216-
exit 1
216+
exit $status
217217
- run:
218218
name: "Test Docker images"
219+
no_output_timeout: 60m
219220
command: |
220-
N=3
221-
while [ $N -gt 0 ]; do
222-
output=$(eval "USE_RANDOM_USER_ID=${USE_RANDOM_USER} PLATFORMS=${PLATFORMS} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} \
221+
max_iteration=3
222+
iteration=1
223+
until USE_RANDOM_USER_ID=${USE_RANDOM_USER} PLATFORMS=${PLATFORMS} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} \
223224
TEST_FIREFOX_INSTALL_LANG_PACKAGE=${TEST_FIREFOX_INSTALL_LANG_PACKAGE} SELENIUM_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS} \
224-
make ${TEST_STRATEGY}")
225-
status=$?
226-
if [ $status -eq 0 ]; then
227-
echo "Tests passed"
228-
exit 0
229-
else
230-
echo "Tests failed. Retrying..."
231-
N=$((N-1))
232-
sleep 10
225+
make ${TEST_STRATEGY} >& /dev/null; [[ $? -eq 0 ]];
226+
do
227+
echo "Result unsuccessful"
228+
if [[ $iteration -eq $max_iteration ]]
229+
then
230+
break
233231
fi
232+
sleep 1
233+
((iteration++))
234234
done
235-
exit 1
235+
if [[ $iteration -eq $max_iteration ]]
236+
then
237+
echo "All of the $max_iteration trials failed!!!"
238+
else
239+
echo "Result successful"
240+
fi
236241
237242
kubernetes-test:
238243
parameters:
@@ -263,6 +268,8 @@ jobs:
263268
HELM_VERSION: << parameters.helm-version >>
264269
DOCKER_VERSION: << parameters.docker-version >>
265270
TEST_UPGRADE_CHART: << parameters.test-upgrade >>
271+
TEST_MULTIPLE_VERSIONS: false
272+
TEST_MULTIPLE_PLATFORMS: false
266273
steps:
267274
- run:
268275
name: "Prepare workflow environment variables"
@@ -288,7 +295,7 @@ jobs:
288295
command: |
289296
N=3
290297
while [ $N -gt 0 ]; do
291-
output=$(eval "PLATFORMS=${PLATFORMS} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build")
298+
PLATFORMS=${PLATFORMS} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
292299
status=$?
293300
if [ $status -eq 0 ]; then
294301
echo "Build images passed"
@@ -299,7 +306,7 @@ jobs:
299306
sleep 10
300307
fi
301308
done
302-
exit 1
309+
exit $status
303310
- run:
304311
name: "Build Helm charts"
305312
command: |
@@ -309,28 +316,28 @@ jobs:
309316
source $BASH_ENV
310317
- run:
311318
name: "Test Selenium Grid on Kubernetes"
312-
no_output_timeout: 30m
319+
no_output_timeout: 60m
313320
command: |
314-
if [ "${TEST_STRATEGY}" == "playwright_connect_grid" ]; then
315-
PLATFORMS=${PLATFORMS} NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_${TEST_STRATEGY} && make test_video_integrity
316-
exit $?
317-
fi
318-
N=3
319-
while [ $N -gt 0 ]; do
320-
output=$(eval "PLATFORMS=${PLATFORMS} NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_${TEST_STRATEGY} && make test_video_integrity")
321-
status=$?
322-
if [ $status -eq 0 ]; then
323-
echo "${output}"
324-
echo "Tests passed"
325-
exit 0
326-
else
327-
echo "${output}"
328-
echo "Tests failed. Retrying..."
329-
N=$((N-1))
330-
sleep 10
321+
max_iteration=3
322+
iteration=1
323+
until PLATFORMS=${PLATFORMS} NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false \
324+
TEST_MULTIPLE_VERSIONS=${TEST_MULTIPLE_VERSIONS} TEST_MULTIPLE_PLATFORMS=${TEST_MULTIPLE_PLATFORMS} \
325+
make chart_test_autoscaling_${TEST_STRATEGY} && make test_video_integrity >& /dev/null; [[ $? -eq 0 ]];
326+
do
327+
echo "Result unsuccessful"
328+
if [[ $iteration -eq $max_iteration ]]
329+
then
330+
break
331331
fi
332+
sleep 1
333+
((iteration++))
332334
done
333-
exit 1
335+
if [[ $iteration -eq $max_iteration ]]
336+
then
337+
echo "All of the $max_iteration trials failed!!!"
338+
else
339+
echo "Result successful"
340+
fi
334341
- run:
335342
name: "Clean-up Kubernetes environment"
336343
command: |

.github/workflows/helm-chart-test.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,9 @@ jobs:
213213
uses: actions/upload-artifact@main
214214
with:
215215
name: ${{ env.ARTIFACT_NAME }}-videos
216-
path: ./tests/videos/
216+
path: |
217+
./tests/videos/
218+
!./tests/videos/**/*.hprof
217219
- name: Test chart upgrade
218220
if: (matrix.test-upgrade == true)
219221
run: |

tests/SeleniumTests/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class SeleniumGenericTests(unittest.TestCase):
5959

6060
def test_title(self):
6161
self.driver.get('https://the-internet.herokuapp.com')
62+
wait = WebDriverWait(self.driver, WEB_DRIVER_WAIT_TIMEOUT)
63+
wait.until(EC.title_is('The Internet'))
6264
self.assertTrue(self.driver.title == 'The Internet')
6365

6466
# https://github.com/tourdedave/elemental-selenium-tips/blob/master/03-work-with-frames/python/frames.py
@@ -167,7 +169,7 @@ def setUp(self):
167169
browser_version = random.choice(LIST_CHROMIUM_VERSIONS)
168170
if browser_version:
169171
options.set_capability('browserVersion', browser_version)
170-
options.set_capability('platformName', 'Linux')
172+
options.set_capability('platformName', 'Linux')
171173
if TEST_NODE_RELAY == 'Android':
172174
options.set_capability('platformName', TEST_NODE_RELAY)
173175
options.set_capability('appium:platformVersion', TEST_ANDROID_PLATFORM_API)

tests/charts/make/chart_test.sh

+19-13
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ TEST_MULTIPLE_VERSIONS=${TEST_MULTIPLE_VERSIONS:-"false"}
6767
TEST_MULTIPLE_VERSIONS_EXPLICIT=${TEST_MULTIPLE_VERSIONS_EXPLICIT:-"true"}
6868
TEST_MULTIPLE_PLATFORMS=${TEST_MULTIPLE_PLATFORMS:-"false"}
6969

70+
wait_for_terminated() {
71+
# Wait until no pods are in "Terminating" state
72+
while true; do
73+
terminating_pods=$(kubectl get pods -n ${SELENIUM_NAMESPACE} --no-headers | grep Terminating | wc -l)
74+
if [ $terminating_pods -eq 0 ]; then
75+
echo "No pods in 'Terminating' state."
76+
break
77+
else
78+
echo "Waiting for $terminating_pods pod(s) to terminate..."
79+
sleep 2
80+
fi
81+
done
82+
}
83+
7084
cleanup() {
7185
# Get the list of pods
7286
pods=$(kubectl get pods -n ${SELENIUM_NAMESPACE} -o jsonpath='{.items[*].metadata.name}')
@@ -77,7 +91,9 @@ cleanup() {
7791
done
7892
if [ "${SKIP_CLEANUP}" = "false" ] || [ "${CI:-false}" != "false" ]; then
7993
echo "Clean up chart release and namespace"
80-
helm delete ${RELEASE_NAME} --namespace ${SELENIUM_NAMESPACE} --wait
94+
helm delete ${RELEASE_NAME} --namespace ${SELENIUM_NAMESPACE} --no-hooks || true
95+
wait_for_terminated
96+
sudo chmod -R 777 ${HOST_PATH}/logs
8197
fi
8298
}
8399

@@ -94,13 +110,13 @@ on_failure() {
94110
kubectl describe all -n ${SELENIUM_NAMESPACE} >> tests/tests/describe_all_resources_${MATRIX_BROWSER}.txt
95111
kubectl describe pod -n ${SELENIUM_NAMESPACE} >> tests/tests/describe_all_resources_${MATRIX_BROWSER}.txt
96112
echo "There is step failed with exit status $exit_status"
97-
cleanup
98113
sudo chmod -R 777 ${HOST_PATH}/logs
99114
exit $exit_status
100115
}
101116

102117
# Trap ERR signal and call on_failure function
103118
trap 'on_failure' ERR EXIT
119+
trap 'cleanup' ERR
104120

105121
if [ "${RENDER_HELM_TEMPLATE_ONLY}" != "true" ]; then
106122
rm -rf tests/tests/*
@@ -496,16 +512,6 @@ else
496512
./tests/bootstrap.sh ${MATRIX_BROWSER}
497513
fi
498514

499-
# Wait until no pods are in "Terminating" state
500-
while true; do
501-
terminating_pods=$(kubectl get pods -n ${SELENIUM_NAMESPACE} --no-headers | grep Terminating | wc -l)
502-
if [ $terminating_pods -eq 0 ]; then
503-
echo "No pods in 'Terminating' state."
504-
break
505-
else
506-
echo "Waiting for $terminating_pods pod(s) to terminate..."
507-
sleep 2
508-
fi
509-
done
515+
wait_for_terminated
510516

511517
cleanup

tests/docker-compose-v3-test-parallel.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ services:
1212
replicas: 5
1313
image: selenium/node-${NODE_CHROME}:${TAG}
1414
user: ${UID}
15+
shm_size: 2gb
1516
depends_on:
1617
- selenium-hub
1718
volumes:
@@ -28,7 +29,9 @@ services:
2829
- SE_LOG_LEVEL=${LOG_LEVEL}
2930
- SE_SUPERVISORD_LOG_LEVEL=info
3031
- SE_NODE_GRACEFUL_SHUTDOWN=true
31-
- SE_DRAIN_AFTER_SESSION_COUNT=1
32+
- SE_NODE_OVERRIDE_MAX_SESSIONS=true
33+
- SE_NODE_MAX_SESSIONS=2
34+
- SE_DRAIN_AFTER_SESSION_COUNT=4
3235
- SE_ENABLE_TLS=true
3336
- SE_JAVA_OPTS=-Dwebdriver.httpclient.readTimeout=${REQUEST_TIMEOUT}
3437
- SE_RECORD_VIDEO=true
@@ -61,7 +64,9 @@ services:
6164
- SE_LOG_LEVEL=${LOG_LEVEL}
6265
- SE_SUPERVISORD_LOG_LEVEL=info
6366
- SE_NODE_GRACEFUL_SHUTDOWN=true
64-
- SE_DRAIN_AFTER_SESSION_COUNT=3
67+
- SE_NODE_OVERRIDE_MAX_SESSIONS=true
68+
- SE_NODE_MAX_SESSIONS=2
69+
- SE_DRAIN_AFTER_SESSION_COUNT=2
6570
- SE_ENABLE_TLS=true
6671
- SE_JAVA_OPTS=-Dwebdriver.httpclient.readTimeout=${REQUEST_TIMEOUT}
6772
- SE_RECORD_VIDEO=true
@@ -92,7 +97,9 @@ services:
9297
- SE_LOG_LEVEL=${LOG_LEVEL}
9398
- SE_SUPERVISORD_LOG_LEVEL=info
9499
- SE_NODE_GRACEFUL_SHUTDOWN=true
95-
- SE_DRAIN_AFTER_SESSION_COUNT=2
100+
- SE_NODE_OVERRIDE_MAX_SESSIONS=true
101+
- SE_NODE_MAX_SESSIONS=3
102+
- SE_DRAIN_AFTER_SESSION_COUNT=3
96103
- SE_ENABLE_TLS=true
97104
- SE_JAVA_OPTS=-Dwebdriver.httpclient.readTimeout=${REQUEST_TIMEOUT}
98105
- SE_RECORD_VIDEO=true

0 commit comments

Comments
 (0)