Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add test for node docker (dynamic grid) #2177

Merged
merged 4 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-video.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test video files
name: Test Docker Selenium
concurrency:
group: ${{ github.workflow }}

Expand Down Expand Up @@ -36,7 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
test-strategy: [test_video, test_parallel]
test-strategy: [test_video, test_parallel, test_node_docker]
steps:
- uses: actions/checkout@main
- name: Output Docker info
Expand Down
23 changes: 21 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ NAME := $(or $(NAME),$(NAME),selenium)
CURRENT_DATE := $(shell date '+%Y%m%d')
BUILD_DATE := $(or $(BUILD_DATE),$(BUILD_DATE),$(CURRENT_DATE))
BASE_RELEASE := $(or $(BASE_RELEASE),$(BASE_RELEASE),selenium-4.19.0)
BASE_VERSION := $(or $(BASE_VERSION),$(BASE_VERSION),4.19.0)
BASE_VERSION := $(or $(BASE_VERSION),$(BASE_VERSION),4.19.1)
BASE_RELEASE_NIGHTLY := $(or $(BASE_RELEASE_NIGHTLY),$(BASE_RELEASE_NIGHTLY),nightly)
BASE_VERSION_NIGHTLY := $(or $(BASE_VERSION_NIGHTLY),$(BASE_VERSION_NIGHTLY),4.20.0-SNAPSHOT)
VERSION := $(or $(VERSION),$(VERSION),4.19.0)
VERSION := $(or $(VERSION),$(VERSION),4.19.1)
TAG_VERSION := $(VERSION)-$(BUILD_DATE)
CHART_VERSION_NIGHTLY := $(or $(CHART_VERSION_NIGHTLY),$(CHART_VERSION_NIGHTLY),1.0.0-nightly)
NAMESPACE := $(or $(NAMESPACE),$(NAMESPACE),$(NAME))
Expand Down Expand Up @@ -426,6 +426,25 @@ test_video: video hub chrome firefox edge
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
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

test_node_docker: docker hub chrome firefox edge
rm -rf ./tests/videos; mkdir -p ./tests/videos
for node in StandaloneChrome StandaloneFirefox StandaloneEdge ; do \
cd tests || true ; \
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), "false") >> .env ; \
echo LOG_LEVEL=$(or $(LOG_LEVEL), "INFO") >> .env ; \
echo REQUEST_TIMEOUT=$(or $(REQUEST_TIMEOUT), 30) >> .env ; \
echo NODE=$$node >> .env ; \
echo UID=$$(id -u) >> .env ; \
export $$(cat .env | xargs) ; \
envsubst < config.toml > ./videos/config.toml ; \
docker-compose -f docker-compose-v3-test-node-docker.yaml up --no-log-prefix --exit-code-from tests --build ; \
if [ $$? -ne 0 ]; then exit 1; fi ; \
done

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

Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ "${CI:-false}" = "false" ]; then
fi

python -m pip install selenium==4.19.0 \
docker===6.1.3 \
docker===7.0.0 \
| grep -v 'Requirement already satisfied'

if [ "${SELENIUM_GRID_PROTOCOL}" = "https" ]; then
Expand Down
7 changes: 7 additions & 0 deletions tests/charts/make/chart_setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ if [ "$(uname -m)" = "x86_64" ]; then
sudo apt-get install -yq docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo docker version
echo "==============================="
echo "Installing Docker compose for AMD64 / x86_64"
DOCKER_COMPOSE_VERSION="v2.26.0"
curl -fsSL -o ./docker-compose "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64"
chmod +x ./docker-compose
sudo mv ./docker-compose /usr/libexec/docker/cli-plugins
docker compose version
echo "==============================="
if [ "${CLUSTER}" = "kind" ]; then
echo "Installing kind for AMD64 / x86_64"
curl -fsSL -o ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
Expand Down
11 changes: 11 additions & 0 deletions tests/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[docker]

configs = [
"${NAMESPACE}/standalone-firefox:${TAG}", '{"browserName": "firefox", "platformName": "linux"}',
"${NAMESPACE}/standalone-chrome:${TAG}", '{"browserName": "chrome", "platformName": "linux"}',
"${NAMESPACE}/standalone-edge:${TAG}", '{"browserName": "MicrosoftEdge", "platformName": "linux"}'
]

url = "http://127.0.0.1:2375"

video-image = "${NAMESPACE}/video:${VIDEO_TAG}"
39 changes: 39 additions & 0 deletions tests/docker-compose-v3-test-node-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: "3"
services:
node-docker:
image: ${NAMESPACE}/node-docker:${TAG}
volumes:
- ./videos:/opt/selenium/assets
- ./videos/config.toml:/opt/bin/config.toml
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_NODE_ENABLE_MANAGED_DOWNLOADS=true
- SE_LOG_LEVEL=${LOG_LEVEL}

selenium-hub:
image: ${NAMESPACE}/hub:${TAG}
container_name: selenium-hub
environment:
- SE_LOG_LEVEL=${LOG_LEVEL}
- SE_SESSION_REQUEST_TIMEOUT=${REQUEST_TIMEOUT}
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"

tests:
image: docker-selenium-tests:latest
build:
context: ./
dockerfile: ./Dockerfile
depends_on:
- selenium-hub
environment:
- RUN_IN_DOCKER_COMPOSE=true
- SELENIUM_GRID_HOST=selenium-hub
command: ["./bootstrap.sh", "${NODE}"]