Skip to content

Commit

Permalink
test: add test for standalone Dynamic Grid
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Aug 12, 2024
1 parent b1fa21c commit e7ddd01
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ workflows:
use-random-user: false
platforms: linux/arm64
machine-type: ubuntu2204arm64
- docker-test:
name: "Docker test - Dynamic Grid Standalone"
test-strategy: test_standalone_docker
use-random-user: false
platforms: linux/arm64
machine-type: ubuntu2204arm64
- docker-test:
name: "Docker test - Parallel execution"
test-strategy: test_parallel
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ jobs:
use-random-user: false
test-video: true
build-all: false
- test-strategy: test_standalone_docker
use-random-user: false
test-video: true
build-all: false
- test-strategy: test_parallel
use-random-user: false
test-video: false
Expand Down
46 changes: 46 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,52 @@ test_node_docker: hub standalone_docker standalone_chrome standalone_firefox sta
done
make test_video_integrity

test_standalone_docker: standalone_docker standalone_chrome standalone_firefox standalone_edge standalone_chromium video
sudo rm -rf ./tests/tests
sudo rm -rf ./tests/videos; mkdir -p ./tests/videos/Downloads
sudo chmod -R 777 ./tests/videos
if [ "$(PLATFORMS)" = "linux/amd64" ]; then \
list_nodes="DeploymentAutoscaling" ; \
else \
list_nodes="NodeChromium NodeFirefox" ; \
fi; \
for node in $${list_nodes} ; do \
cd tests || true ; \
DOWNLOADS_DIR="./videos/Downloads" ; \
sudo rm -rf $$DOWNLOADS_DIR/* ; \
echo NAMESPACE=$(NAME) > .env ; \
echo TAG=$(TAG_VERSION) >> .env ; \
echo VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) >> .env ; \
echo TEST_DRAIN_AFTER_SESSION_COUNT=$(or $(TEST_DRAIN_AFTER_SESSION_COUNT), 0) >> .env ; \
echo TEST_PARALLEL_HARDENING=$(or $(TEST_PARALLEL_HARDENING), "true") >> .env ; \
echo LOG_LEVEL=$(or $(LOG_LEVEL), "INFO") >> .env ; \
echo REQUEST_TIMEOUT=$(or $(REQUEST_TIMEOUT), 300) >> .env ; \
echo SELENIUM_ENABLE_MANAGED_DOWNLOADS=$(or $(SELENIUM_ENABLE_MANAGED_DOWNLOADS), "true") >> .env ; \
echo TEST_DELAY_AFTER_TEST=$(or $(TEST_DELAY_AFTER_TEST), 0) >> .env ; \
echo NODE=$$node >> .env ; \
echo UID=$$(id -u) >> .env ; \
echo BINDING_VERSION=$(BINDING_VERSION) >> .env ; \
echo HOST_IP=$$(hostname -I | awk '{print $$1}') >> .env ; \
if [ "$(PLATFORMS)" = "linux/amd64" ]; then \
echo NODE_EDGE=edge >> .env ; \
else \
echo NODE_EDGE=chromium >> .env ; \
fi; \
if [ $$node = "NodeChrome" ] ; then \
echo NODE_CHROME=chrome >> .env ; \
fi ; \
if [ $$node = "NodeChromium" ] ; then \
echo NODE_CHROME=chromium >> .env ; \
else \
echo NODE_CHROME=chromium >> .env ; \
fi ; \
export $$(cat .env | xargs) ; \
envsubst < standalone_docker_config.toml > ./videos/config.toml ; \
DOCKER_DEFAULT_PLATFORM=$(PLATFORMS) docker compose -f docker-compose-v3-test-standalone-docker.yaml up --no-log-prefix --build --exit-code-from tests ; \
if [ $$? -ne 0 ]; then exit 1; fi ; \
done
make test_video_integrity

test_custom_ca_cert:
VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) ./tests/customCACert/bootstrap.sh

Expand Down
1 change: 1 addition & 0 deletions tests/docker-compose-v3-test-node-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_NODE_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
- SE_OPTS=--enable-managed-downloads ${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
- SE_BROWSER_ARGS_DISABLE_DSHM=--disable-dev-shm-usage
- SE_LOG_LEVEL=${LOG_LEVEL}

Expand Down
3 changes: 3 additions & 0 deletions tests/docker-compose-v3-test-node-relay.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ services:
standalone:
image: ${NAMESPACE}/standalone-${BROWSER}:${TAG}
shm_size: 2gb
environment:
- SE_OPTS=--enable-cdp true
- SE_NODE_ENABLE_CDP=true

selenium-hub:
image: ${NAMESPACE}/hub:${TAG}
Expand Down
39 changes: 39 additions & 0 deletions tests/docker-compose-v3-test-standalone-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: "3"
services:
standalone-docker:
image: ${NAMESPACE}/standalone-docker:${TAG}
volumes:
- ./videos:/opt/selenium/assets
- ./videos/config.toml:/opt/selenium/config.toml
- /var/run/docker.sock:/var/run/docker.sock
environment:
- SE_VNC_NO_PASSWORD=true
- SE_START_VNC=true
- SE_LOG_LEVEL=${LOG_LEVEL}
- SE_NODE_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
- SE_NODE_GRID_URL=http://0.0.0.0:4444
- SE_OPTS=--log-level ${LOG_LEVEL} --enable-managed-downloads ${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
container_name: selenium-hub
ports:
- "4444:4444"
healthcheck:
test: "/opt/bin/check-grid.sh --host 0.0.0.0 --port 4444"
interval: 15s
timeout: 30s
retries: 5

tests:
image: docker-selenium-tests:latest
build:
context: ./
dockerfile: ./Dockerfile
depends_on:
- standalone-docker
environment:
- RUN_IN_DOCKER_COMPOSE=true
- SELENIUM_GRID_HOST=selenium-hub
- BINDING_VERSION=${BINDING_VERSION}
- SELENIUM_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
- TEST_PARALLEL_HARDENING=${TEST_PARALLEL_HARDENING}
- TEST_DELAY_AFTER_TEST=${TEST_DELAY_AFTER_TEST}
command: ["/bin/bash", "-c", "./bootstrap.sh ${NODE}"]
24 changes: 24 additions & 0 deletions tests/standalone_docker_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[docker]
configs = [
"${NAMESPACE}/standalone-firefox:${TAG}", '{"browserName": "firefox", "platformName": "linux"}',
"${NAMESPACE}/standalone-${NODE_CHROME}:${TAG}", '{"browserName": "chrome", "platformName": "linux"}',
"${NAMESPACE}/standalone-${NODE_EDGE}:${TAG}", '{"browserName": "MicrosoftEdge", "platformName": "linux"}'
]

url = "http://127.0.0.1:2375"

video-image = "${NAMESPACE}/video:${VIDEO_TAG}"

[node]
enable-managed-downloads = "${SELENIUM_ENABLE_MANAGED_DOWNLOADS}"
override-max-sessions = true
max-sessions = 10
session-timeout = 1000
enable-cdp = true
selenium-manager = true

[sessionqueue]
session-request-timeout = "${REQUEST_TIMEOUT}"

[router]
disable-ui = false

0 comments on commit e7ddd01

Please sign in to comment.