Skip to content

Commit e7ddd01

Browse files
committed
test: add test for standalone Dynamic Grid
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent b1fa21c commit e7ddd01

File tree

7 files changed

+123
-0
lines changed

7 files changed

+123
-0
lines changed

.circleci/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ workflows:
8787
use-random-user: false
8888
platforms: linux/arm64
8989
machine-type: ubuntu2204arm64
90+
- docker-test:
91+
name: "Docker test - Dynamic Grid Standalone"
92+
test-strategy: test_standalone_docker
93+
use-random-user: false
94+
platforms: linux/arm64
95+
machine-type: ubuntu2204arm64
9096
- docker-test:
9197
name: "Docker test - Parallel execution"
9298
test-strategy: test_parallel

.github/workflows/docker-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ jobs:
5454
use-random-user: false
5555
test-video: true
5656
build-all: false
57+
- test-strategy: test_standalone_docker
58+
use-random-user: false
59+
test-video: true
60+
build-all: false
5761
- test-strategy: test_parallel
5862
use-random-user: false
5963
test-video: false

Makefile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,52 @@ test_node_docker: hub standalone_docker standalone_chrome standalone_firefox sta
728728
done
729729
make test_video_integrity
730730

731+
test_standalone_docker: standalone_docker standalone_chrome standalone_firefox standalone_edge standalone_chromium video
732+
sudo rm -rf ./tests/tests
733+
sudo rm -rf ./tests/videos; mkdir -p ./tests/videos/Downloads
734+
sudo chmod -R 777 ./tests/videos
735+
if [ "$(PLATFORMS)" = "linux/amd64" ]; then \
736+
list_nodes="DeploymentAutoscaling" ; \
737+
else \
738+
list_nodes="NodeChromium NodeFirefox" ; \
739+
fi; \
740+
for node in $${list_nodes} ; do \
741+
cd tests || true ; \
742+
DOWNLOADS_DIR="./videos/Downloads" ; \
743+
sudo rm -rf $$DOWNLOADS_DIR/* ; \
744+
echo NAMESPACE=$(NAME) > .env ; \
745+
echo TAG=$(TAG_VERSION) >> .env ; \
746+
echo VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) >> .env ; \
747+
echo TEST_DRAIN_AFTER_SESSION_COUNT=$(or $(TEST_DRAIN_AFTER_SESSION_COUNT), 0) >> .env ; \
748+
echo TEST_PARALLEL_HARDENING=$(or $(TEST_PARALLEL_HARDENING), "true") >> .env ; \
749+
echo LOG_LEVEL=$(or $(LOG_LEVEL), "INFO") >> .env ; \
750+
echo REQUEST_TIMEOUT=$(or $(REQUEST_TIMEOUT), 300) >> .env ; \
751+
echo SELENIUM_ENABLE_MANAGED_DOWNLOADS=$(or $(SELENIUM_ENABLE_MANAGED_DOWNLOADS), "true") >> .env ; \
752+
echo TEST_DELAY_AFTER_TEST=$(or $(TEST_DELAY_AFTER_TEST), 0) >> .env ; \
753+
echo NODE=$$node >> .env ; \
754+
echo UID=$$(id -u) >> .env ; \
755+
echo BINDING_VERSION=$(BINDING_VERSION) >> .env ; \
756+
echo HOST_IP=$$(hostname -I | awk '{print $$1}') >> .env ; \
757+
if [ "$(PLATFORMS)" = "linux/amd64" ]; then \
758+
echo NODE_EDGE=edge >> .env ; \
759+
else \
760+
echo NODE_EDGE=chromium >> .env ; \
761+
fi; \
762+
if [ $$node = "NodeChrome" ] ; then \
763+
echo NODE_CHROME=chrome >> .env ; \
764+
fi ; \
765+
if [ $$node = "NodeChromium" ] ; then \
766+
echo NODE_CHROME=chromium >> .env ; \
767+
else \
768+
echo NODE_CHROME=chromium >> .env ; \
769+
fi ; \
770+
export $$(cat .env | xargs) ; \
771+
envsubst < standalone_docker_config.toml > ./videos/config.toml ; \
772+
DOCKER_DEFAULT_PLATFORM=$(PLATFORMS) docker compose -f docker-compose-v3-test-standalone-docker.yaml up --no-log-prefix --build --exit-code-from tests ; \
773+
if [ $$? -ne 0 ]; then exit 1; fi ; \
774+
done
775+
make test_video_integrity
776+
731777
test_custom_ca_cert:
732778
VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) ./tests/customCACert/bootstrap.sh
733779

tests/docker-compose-v3-test-node-docker.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ services:
2121
- SE_EVENT_BUS_PUBLISH_PORT=4442
2222
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
2323
- SE_NODE_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
24+
- SE_OPTS=--enable-managed-downloads ${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
2425
- SE_BROWSER_ARGS_DISABLE_DSHM=--disable-dev-shm-usage
2526
- SE_LOG_LEVEL=${LOG_LEVEL}
2627

tests/docker-compose-v3-test-node-relay.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ services:
1717
standalone:
1818
image: ${NAMESPACE}/standalone-${BROWSER}:${TAG}
1919
shm_size: 2gb
20+
environment:
21+
- SE_OPTS=--enable-cdp true
22+
- SE_NODE_ENABLE_CDP=true
2023

2124
selenium-hub:
2225
image: ${NAMESPACE}/hub:${TAG}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: "3"
2+
services:
3+
standalone-docker:
4+
image: ${NAMESPACE}/standalone-docker:${TAG}
5+
volumes:
6+
- ./videos:/opt/selenium/assets
7+
- ./videos/config.toml:/opt/selenium/config.toml
8+
- /var/run/docker.sock:/var/run/docker.sock
9+
environment:
10+
- SE_VNC_NO_PASSWORD=true
11+
- SE_START_VNC=true
12+
- SE_LOG_LEVEL=${LOG_LEVEL}
13+
- SE_NODE_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
14+
- SE_NODE_GRID_URL=http://0.0.0.0:4444
15+
- SE_OPTS=--log-level ${LOG_LEVEL} --enable-managed-downloads ${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
16+
container_name: selenium-hub
17+
ports:
18+
- "4444:4444"
19+
healthcheck:
20+
test: "/opt/bin/check-grid.sh --host 0.0.0.0 --port 4444"
21+
interval: 15s
22+
timeout: 30s
23+
retries: 5
24+
25+
tests:
26+
image: docker-selenium-tests:latest
27+
build:
28+
context: ./
29+
dockerfile: ./Dockerfile
30+
depends_on:
31+
- standalone-docker
32+
environment:
33+
- RUN_IN_DOCKER_COMPOSE=true
34+
- SELENIUM_GRID_HOST=selenium-hub
35+
- BINDING_VERSION=${BINDING_VERSION}
36+
- SELENIUM_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
37+
- TEST_PARALLEL_HARDENING=${TEST_PARALLEL_HARDENING}
38+
- TEST_DELAY_AFTER_TEST=${TEST_DELAY_AFTER_TEST}
39+
command: ["/bin/bash", "-c", "./bootstrap.sh ${NODE}"]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[docker]
2+
configs = [
3+
"${NAMESPACE}/standalone-firefox:${TAG}", '{"browserName": "firefox", "platformName": "linux"}',
4+
"${NAMESPACE}/standalone-${NODE_CHROME}:${TAG}", '{"browserName": "chrome", "platformName": "linux"}',
5+
"${NAMESPACE}/standalone-${NODE_EDGE}:${TAG}", '{"browserName": "MicrosoftEdge", "platformName": "linux"}'
6+
]
7+
8+
url = "http://127.0.0.1:2375"
9+
10+
video-image = "${NAMESPACE}/video:${VIDEO_TAG}"
11+
12+
[node]
13+
enable-managed-downloads = "${SELENIUM_ENABLE_MANAGED_DOWNLOADS}"
14+
override-max-sessions = true
15+
max-sessions = 10
16+
session-timeout = 1000
17+
enable-cdp = true
18+
selenium-manager = true
19+
20+
[sessionqueue]
21+
session-request-timeout = "${REQUEST_TIMEOUT}"
22+
23+
[router]
24+
disable-ui = false

0 commit comments

Comments
 (0)