Skip to content

Commit

Permalink
bug(#1824): Container ENV SE_NODE_SESSION_TIMEOUT not take effect (#2044
Browse files Browse the repository at this point in the history
)

* bug(#1824): Container ENV SE_NODE_SESSION_TIMEOUT not take effect

Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>

* Update helm-chart-test.yml for SNAPSHOT CI build

* Update helm-chart-test.yml for SNAPSHOT CI build

Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>

* Revert test

Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>

---------

Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
  • Loading branch information
VietND96 committed Dec 3, 2023
1 parent c2a5b66 commit 99448df
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 32 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/helm-chart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,30 @@ jobs:
run: |
echo "BUILD_DATE=$(date '+%Y%m%d')" >> $GITHUB_ENV
echo "IMAGE_REGISTRY=artifactory/selenium" >> $GITHUB_ENV
- name: Build Docker images
run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
- name: Setup Kubernetes environment
run: make chart_setup_env
- name: Build Docker images
run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
- name: Build and lint charts
run: |
BUILD_DATE=${BUILD_DATE} make chart_build
echo "CHART_PACKAGE_PATH=$(cat /tmp/selenium_chart_version)" >> $GITHUB_ENV
echo "CHART_FILE_NAME=$(basename $(cat /tmp/selenium_chart_version))" >> $GITHUB_ENV
- name: Setup Kubernetes cluster
run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_cluster_setup
- name: Test Selenium Grid on Kubernetes
uses: nick-invision/retry@v2.9.0
with:
timeout_minutes: 20
timeout_minutes: 30
max_attempts: 3
command: |
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_test
- name: Cleanup Kubernetes cluster
if: always()
run: make chart_cluster_cleanup
- name: Upload Helm chart package
if: always()
uses: actions/upload-artifact@v3
with:
name: ${{ env.CHART_FILE_NAME }}
path: ${{ env.CHART_PACKAGE_PATH }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,4 @@ ENV/
.DS_Store
/charts/*/charts
/charts/*/**.lock
/charts/*.tgz
37 changes: 18 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -366,32 +366,31 @@ test_video: video hub chrome firefox edge
chart_setup_env:
./tests/charts/make/chart_setup_env.sh

chart_test: chart_lint \
chart_test_template \
chart_install_chrome \
chart_install_firefox \
chart_install_edge

chart_test_template:
./tests/charts/bootstrap.sh

chart_cluster_setup:
VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) ./tests/charts/make/chart_cluster_setup.sh

chart_lint:
./tests/charts/make/chart_lint.sh
chart_cluster_cleanup:
./tests/charts/make/chart_cluster_cleanup.sh

chart_build:
VERSION=$(TAG_VERSION) ./tests/charts/make/chart_build.sh

chart_test: chart_test_template \
chart_test_chrome \
chart_test_firefox \
chart_test_edge

chart_install_chrome:
VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) ./tests/charts/make/chart_install.sh NodeChrome
chart_test_template:
./tests/charts/bootstrap.sh

chart_install_firefox:
VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) ./tests/charts/make/chart_install.sh NodeFirefox
chart_test_chrome:
VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) ./tests/charts/make/chart_test.sh NodeChrome

chart_install_edge:
VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) ./tests/charts/make/chart_install.sh NodeEdge
chart_test_firefox:
VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) ./tests/charts/make/chart_test.sh NodeFirefox

chart_cluster_cleanup:
./tests/charts/make/chart_cluster_cleanup.sh
chart_test_edge:
VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) ./tests/charts/make/chart_test.sh NodeEdge

.PHONY: \
all \
Expand Down
5 changes: 5 additions & 0 deletions NodeBase/start-selenium-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ if [ ! -z "$SE_OPTS" ]; then
echo "Appending Selenium options: ${SE_OPTS}"
fi

if [ ! -z "$SE_NODE_SESSION_TIMEOUT" ]; then
SE_OPTS="$SE_OPTS --session-timeout $SE_NODE_SESSION_TIMEOUT"
echo "Appending Selenium node session timeout via SE_OPTS: ${SE_OPTS}"
fi

if [ "$GENERATE_CONFIG" = true ]; then
echo "Generating Selenium Config"
/opt/bin/generate_config
Expand Down
9 changes: 6 additions & 3 deletions charts/selenium-grid/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ All related testing to this helm chart will be documented in this file.
cd ../..

# Build chart dependencies and lint
make chart_lint
make chart_build

# Test chart template
make chart_test_template
Expand All @@ -51,11 +51,14 @@ Run entire commands to build and test Docker images with Helm charts in local en
# Back to root directory
cd ../..

# Setup Kubernetes environment
make chart_setup_env

# Build Docker images
make build

# Setup Kubernetes environment
make chart_setup_env
# Build and lint charts
make chart_build

# Setup Kubernetes cluster
make chart_cluster_setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash

CHART_PATH=${CHART_PATH:-"charts/selenium-grid"}
# Function to be executed on command failure
on_failure() {
local exit_status=$?
Expand All @@ -22,8 +24,14 @@ python -m pip install yamale==4.0.4 \
| grep -v 'Requirement already satisfied'

cd ..
rm -rf ./charts/**/Chart.lock
rm -rf ${CHART_PATH}/Chart.lock
ct lint --all --config tests/charts/config/ct.yaml
# Helm dependencies build and lint is done by `ct lint` command
rm -rf ${CHART_PATH}/../*.tgz
helm package ${CHART_PATH} --version ${VERSION} --destination ${CHART_PATH}/..

readlink -f ${CHART_PATH}/../*.tgz > /tmp/selenium_chart_version
cat /tmp/selenium_chart_version

if [ "${CI:-false}" = "false" ]; then
deactivate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,19 @@ on_failure() {
# Trap ERR signal and call on_failure function
trap 'on_failure' ERR

HELM_COMMAND_SET_AUTOSCALING=""
if [ "${SELENIUM_GRID_AUTOSCALING}" = "true" ]; then
HELM_COMMAND_SET_AUTOSCALING="--values ${TEST_VALUES_PATH}/autoscaling-values.yaml \
--set autoscaling.enableWithExistingKEDA=${SELENIUM_GRID_AUTOSCALING} \
--set autoscaling.scaledOptions.minReplicaCount=${SELENIUM_GRID_AUTOSCALING_MIN_REPLICA}"
fi

echo "Deploy Selenium Grid Chart"
helm upgrade --install ${RELEASE_NAME} \
-f ${TEST_VALUES_PATH}/auth-ingress-values.yaml \
-f ${TEST_VALUES_PATH}/tracing-values.yaml \
-f ${TEST_VALUES_PATH}/${MATRIX_BROWSER}-values.yaml \
-f ${TEST_VALUES_PATH}/autoscaling-values.yaml \
--set autoscaling.enableWithExistingKEDA=${SELENIUM_GRID_AUTOSCALING} \
--set autoscaling.scaledOptions.minReplicaCount=${SELENIUM_GRID_AUTOSCALING_MIN_REPLICA} \
--values ${TEST_VALUES_PATH}/auth-ingress-values.yaml \
--values ${TEST_VALUES_PATH}/tracing-values.yaml \
--values ${TEST_VALUES_PATH}/${MATRIX_BROWSER}-values.yaml \
${HELM_COMMAND_SET_AUTOSCALING} \
--set global.seleniumGrid.imageTag=${VERSION} --set global.seleniumGrid.imageRegistry=${NAMESPACE} \
--set global.seleniumGrid.nodesImageTag=${VERSION} \
${CHART_PATH} --namespace ${SELENIUM_NAMESPACE} --create-namespace
Expand Down

0 comments on commit 99448df

Please sign in to comment.