Skip to content

Commit cc2b0a4

Browse files
authored
test: add test for node docker (dynamic grid) (#2177)
* update: base Selenium 4.19.1 * test: add test for node docker (dynamic grid) --------- Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 6a6d1e1 commit cc2b0a4

File tree

6 files changed

+81
-5
lines changed

6 files changed

+81
-5
lines changed

.github/workflows/test-video.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test video files
1+
name: Test Docker Selenium
22
concurrency:
33
group: ${{ github.workflow }}
44

@@ -36,7 +36,7 @@ jobs:
3636
strategy:
3737
fail-fast: false
3838
matrix:
39-
test-strategy: [test_video, test_parallel]
39+
test-strategy: [test_video, test_parallel, test_node_docker]
4040
steps:
4141
- uses: actions/checkout@main
4242
- name: Output Docker info

Makefile

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ NAME := $(or $(NAME),$(NAME),selenium)
22
CURRENT_DATE := $(shell date '+%Y%m%d')
33
BUILD_DATE := $(or $(BUILD_DATE),$(BUILD_DATE),$(CURRENT_DATE))
44
BASE_RELEASE := $(or $(BASE_RELEASE),$(BASE_RELEASE),selenium-4.19.0)
5-
BASE_VERSION := $(or $(BASE_VERSION),$(BASE_VERSION),4.19.0)
5+
BASE_VERSION := $(or $(BASE_VERSION),$(BASE_VERSION),4.19.1)
66
BASE_RELEASE_NIGHTLY := $(or $(BASE_RELEASE_NIGHTLY),$(BASE_RELEASE_NIGHTLY),nightly)
77
BASE_VERSION_NIGHTLY := $(or $(BASE_VERSION_NIGHTLY),$(BASE_VERSION_NIGHTLY),4.20.0-SNAPSHOT)
8-
VERSION := $(or $(VERSION),$(VERSION),4.19.0)
8+
VERSION := $(or $(VERSION),$(VERSION),4.19.1)
99
TAG_VERSION := $(VERSION)-$(BUILD_DATE)
1010
CHART_VERSION_NIGHTLY := $(or $(CHART_VERSION_NIGHTLY),$(CHART_VERSION_NIGHTLY),1.0.0-nightly)
1111
NAMESPACE := $(or $(NAMESPACE),$(NAMESPACE),$(NAME))
@@ -426,6 +426,25 @@ test_video: video hub chrome firefox edge
426426
docker run -u $$(id -u) -v $$(pwd):$$(pwd) -w $$(pwd) $(FFMPEG_BASED_NAME)/ffmpeg:$(FFMPEG_BASED_TAG) -v error -i ./tests/videos/firefox_video.mp4 -f null - 2>error.log
427427
docker run -u $$(id -u) -v $$(pwd):$$(pwd) -w $$(pwd) $(FFMPEG_BASED_NAME)/ffmpeg:$(FFMPEG_BASED_TAG) -v error -i ./tests/videos/edge_video.mp4 -f null - 2>error.log
428428

429+
test_node_docker: docker hub chrome firefox edge
430+
rm -rf ./tests/videos; mkdir -p ./tests/videos
431+
for node in StandaloneChrome StandaloneFirefox StandaloneEdge ; do \
432+
cd tests || true ; \
433+
echo NAMESPACE=$(NAME) > .env ; \
434+
echo TAG=$(TAG_VERSION) >> .env ; \
435+
echo VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) >> .env ; \
436+
echo TEST_DRAIN_AFTER_SESSION_COUNT=$(or $(TEST_DRAIN_AFTER_SESSION_COUNT), 0) >> .env ; \
437+
echo TEST_PARALLEL_HARDENING=$(or $(TEST_PARALLEL_HARDENING), "false") >> .env ; \
438+
echo LOG_LEVEL=$(or $(LOG_LEVEL), "INFO") >> .env ; \
439+
echo REQUEST_TIMEOUT=$(or $(REQUEST_TIMEOUT), 30) >> .env ; \
440+
echo NODE=$$node >> .env ; \
441+
echo UID=$$(id -u) >> .env ; \
442+
export $$(cat .env | xargs) ; \
443+
envsubst < config.toml > ./videos/config.toml ; \
444+
docker-compose -f docker-compose-v3-test-node-docker.yaml up --no-log-prefix --exit-code-from tests --build ; \
445+
if [ $$? -ne 0 ]; then exit 1; fi ; \
446+
done
447+
429448
test_custom_ca_cert:
430449
VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) ./tests/customCACert/bootstrap.sh
431450

tests/bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if [ "${CI:-false}" = "false" ]; then
88
fi
99

1010
python -m pip install selenium==4.19.0 \
11-
docker===6.1.3 \
11+
docker===7.0.0 \
1212
| grep -v 'Requirement already satisfied'
1313

1414
if [ "${SELENIUM_GRID_PROTOCOL}" = "https" ]; then

tests/charts/make/chart_setup_env.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ if [ "$(uname -m)" = "x86_64" ]; then
2828
sudo apt-get install -yq docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
2929
sudo docker version
3030
echo "==============================="
31+
echo "Installing Docker compose for AMD64 / x86_64"
32+
DOCKER_COMPOSE_VERSION="v2.26.0"
33+
curl -fsSL -o ./docker-compose "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64"
34+
chmod +x ./docker-compose
35+
sudo mv ./docker-compose /usr/libexec/docker/cli-plugins
36+
docker compose version
37+
echo "==============================="
3138
if [ "${CLUSTER}" = "kind" ]; then
3239
echo "Installing kind for AMD64 / x86_64"
3340
curl -fsSL -o ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64

tests/config.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[docker]
2+
3+
configs = [
4+
"${NAMESPACE}/standalone-firefox:${TAG}", '{"browserName": "firefox", "platformName": "linux"}',
5+
"${NAMESPACE}/standalone-chrome:${TAG}", '{"browserName": "chrome", "platformName": "linux"}',
6+
"${NAMESPACE}/standalone-edge:${TAG}", '{"browserName": "MicrosoftEdge", "platformName": "linux"}'
7+
]
8+
9+
url = "http://127.0.0.1:2375"
10+
11+
video-image = "${NAMESPACE}/video:${VIDEO_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+
node-docker:
4+
image: ${NAMESPACE}/node-docker:${TAG}
5+
volumes:
6+
- ./videos:/opt/selenium/assets
7+
- ./videos/config.toml:/opt/bin/config.toml
8+
- /var/run/docker.sock:/var/run/docker.sock
9+
depends_on:
10+
- selenium-hub
11+
environment:
12+
- SE_EVENT_BUS_HOST=selenium-hub
13+
- SE_EVENT_BUS_PUBLISH_PORT=4442
14+
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
15+
- SE_NODE_ENABLE_MANAGED_DOWNLOADS=true
16+
- SE_LOG_LEVEL=${LOG_LEVEL}
17+
18+
selenium-hub:
19+
image: ${NAMESPACE}/hub:${TAG}
20+
container_name: selenium-hub
21+
environment:
22+
- SE_LOG_LEVEL=${LOG_LEVEL}
23+
- SE_SESSION_REQUEST_TIMEOUT=${REQUEST_TIMEOUT}
24+
ports:
25+
- "4442:4442"
26+
- "4443:4443"
27+
- "4444:4444"
28+
29+
tests:
30+
image: docker-selenium-tests:latest
31+
build:
32+
context: ./
33+
dockerfile: ./Dockerfile
34+
depends_on:
35+
- selenium-hub
36+
environment:
37+
- RUN_IN_DOCKER_COMPOSE=true
38+
- SELENIUM_GRID_HOST=selenium-hub
39+
command: ["./bootstrap.sh", "${NODE}"]

0 commit comments

Comments
 (0)