Skip to content

Commit 8423ab4

Browse files
committed
[ci] Fix workflows stable for ARM64 tests
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 4024ce8 commit 8423ab4

File tree

6 files changed

+51
-31
lines changed

6 files changed

+51
-31
lines changed

.circleci/config.yml

Lines changed: 15 additions & 12 deletions
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"
@@ -213,9 +213,10 @@ 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: |
220221
N=3
221222
while [ $N -gt 0 ]; do
@@ -224,15 +225,17 @@ jobs:
224225
make ${TEST_STRATEGY}")
225226
status=$?
226227
if [ $status -eq 0 ]; then
228+
echo "${output}"
227229
echo "Tests passed"
228230
exit 0
229231
else
232+
echo "${output}"
230233
echo "Tests failed. Retrying..."
231234
N=$((N-1))
232235
sleep 10
233236
fi
234237
done
235-
exit 1
238+
exit $status
236239
237240
kubernetes-test:
238241
parameters:
@@ -263,6 +266,8 @@ jobs:
263266
HELM_VERSION: << parameters.helm-version >>
264267
DOCKER_VERSION: << parameters.docker-version >>
265268
TEST_UPGRADE_CHART: << parameters.test-upgrade >>
269+
TEST_MULTIPLE_VERSIONS: false
270+
TEST_MULTIPLE_PLATFORMS: false
266271
steps:
267272
- run:
268273
name: "Prepare workflow environment variables"
@@ -299,7 +304,7 @@ jobs:
299304
sleep 10
300305
fi
301306
done
302-
exit 1
307+
exit $status
303308
- run:
304309
name: "Build Helm charts"
305310
command: |
@@ -309,15 +314,13 @@ jobs:
309314
source $BASH_ENV
310315
- run:
311316
name: "Test Selenium Grid on Kubernetes"
312-
no_output_timeout: 30m
317+
no_output_timeout: 60m
313318
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
318319
N=3
319320
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+
output=$(eval "PLATFORMS=${PLATFORMS} NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false \
322+
TEST_MULTIPLE_VERSIONS=${TEST_MULTIPLE_VERSIONS} TEST_MULTIPLE_PLATFORMS=${TEST_MULTIPLE_PLATFORMS} \
323+
make chart_test_autoscaling_${TEST_STRATEGY} && make test_video_integrity")
321324
status=$?
322325
if [ $status -eq 0 ]; then
323326
echo "${output}"
@@ -330,7 +333,7 @@ jobs:
330333
sleep 10
331334
fi
332335
done
333-
exit 1
336+
exit $status
334337
- run:
335338
name: "Clean-up Kubernetes environment"
336339
command: |

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

Lines changed: 3 additions & 1 deletion
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: |

charts/selenium-grid/multiple-nodes-platform.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ crossBrowsers:
2020
platformName: 'Linux'
2121
browserVersion: ''
2222
firefoxNode:
23-
- nameOverride: '{{ $.Release.Name }}-node-chrome-platform-any'
23+
- nameOverride: '{{ $.Release.Name }}-node-firefox-platform-any'
2424
hpa:
2525
platformName: ''
2626
browserVersion: ''

tests/SeleniumTests/__init__.py

Lines changed: 3 additions & 1 deletion
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

Lines changed: 19 additions & 13 deletions
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

Lines changed: 10 additions & 3 deletions
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)