diff --git a/.github/workflows/helm-chart-test.yml b/.github/workflows/helm-chart-test.yml index 2c1cd307c..086090f2f 100644 --- a/.github/workflows/helm-chart-test.yml +++ b/.github/workflows/helm-chart-test.yml @@ -38,20 +38,22 @@ jobs: - name: Output branch name run: echo ${BRANCH} - name: Sets build date - run: echo "BUILD_DATE=$(date '+%Y%m%d')" >> $GITHUB_ENV + run: | + echo "BUILD_DATE=$(date '+%Y%m%d')" >> $GITHUB_ENV + echo "IMAGE_REGISTRY=artifactory/selenium" >> $GITHUB_ENV - name: Build Docker images - run: VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build + run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build - name: Setup Kubernetes environment run: make chart_setup_env - name: Setup Kubernetes cluster - run: VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_cluster_setup + 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 max_attempts: 3 command: | - VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_test + NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_test - name: Cleanup Kubernetes cluster if: always() run: make chart_cluster_cleanup diff --git a/charts/selenium-grid/README.md b/charts/selenium-grid/README.md index 2d444e969..2ec8a7ab0 100644 --- a/charts/selenium-grid/README.md +++ b/charts/selenium-grid/README.md @@ -129,7 +129,7 @@ This table contains the configuration parameters of the chart and their default | `chromeNode.enabled` | `true` | Enable chrome nodes | | `chromeNode.deploymentEnabled` | `true` | Enable creation of Deployment for chrome nodes | | `chromeNode.replicas` | `1` | Number of chrome nodes. Disabled if autoscaling is enabled. | -| `chromeNode.imageRegistry` | `nil` | Distribution registry to pull the image | +| `chromeNode.imageRegistry` | `nil` | Distribution registry to pull the image (this overwrites `.global.seleniumGrid.imageRegistry` value) | | `chromeNode.imageName` | `node-chrome` | Image of chrome nodes | | `chromeNode.imageTag` | `4.15.0-20231129` | Image of chrome nodes | | `chromeNode.imagePullPolicy` | `IfNotPresent` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) | @@ -169,7 +169,7 @@ This table contains the configuration parameters of the chart and their default | `firefoxNode.enabled` | `true` | Enable firefox nodes | | `firefoxNode.deploymentEnabled` | `true` | Enable creation of Deployment for firefox nodes | | `firefoxNode.replicas` | `1` | Number of firefox nodes. Disabled if autoscaling is enabled. | -| `firefoxNode.imageRegistry` | `nil` | Distribution registry to pull the image | +| `firefoxNode.imageRegistry` | `nil` | Distribution registry to pull the image (this overwrites `.global.seleniumGrid.imageRegistry` value) | | `firefoxNode.imageName` | `node-firefox` | Image of firefox nodes | | `firefoxNode.imageTag` | `4.15.0-20231129` | Image of firefox nodes | | `firefoxNode.imagePullPolicy` | `IfNotPresent` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) | @@ -209,7 +209,7 @@ This table contains the configuration parameters of the chart and their default | `edgeNode.enabled` | `true` | Enable edge nodes | | `edgeNode.deploymentEnabled` | `true` | Enable creation of Deployment for edge nodes | | `edgeNode.replicas` | `1` | Number of edge nodes. Disabled if autoscaling is enabled. | -| `edgeNode.imageRegistry` | `nil` | Distribution registry to pull the image | +| `edgeNode.imageRegistry` | `nil` | Distribution registry to pull the image (this overwrites `.global.seleniumGrid.imageRegistry` value) | | `edgeNode.imageName` | `node-edge` | Image of edge nodes | | `edgeNode.imageTag` | `4.15.0-20231129` | Image of edge nodes | | `edgeNode.imagePullPolicy` | `IfNotPresent` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) | @@ -247,7 +247,7 @@ This table contains the configuration parameters of the chart and their default | `edgeNode.scaledJobOptions` | See `values.yaml` | Override the global `autoscaling.scaledJobOptions` with specific scaled options for edge nodes | | `edgeNode.scaledObjectOptions` | See `values.yaml` | Override the global `autoscaling.scaledObjectOptions` with specific scaled options for edge nodes | | `videoRecorder.enabled` | `false` | Enable video recorder for node | -| `videoRecorder.imageRegistry` | `nil` | Distribution registry to pull the image | +| `videoRecorder.imageRegistry` | `nil` | Distribution registry to pull the image (this overwrites `.global.seleniumGrid.imageRegistry` value) | | `videoRecorder.imageName` | `video` | Selenium video recoder image name | | `videoRecorder.imageTag` | `ffmpeg-6.0-20231129` | Image tag of video recorder | | `videoRecorder.imagePullPolicy` | `IfNotPresent` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) | @@ -285,7 +285,7 @@ You can configure the Selenium Hub with these values: | Parameter | Default | Description | |---------------------------------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| -| `hub.imageRegistry` | `nil` | Distribution registry to pull the image | +| `hub.imageRegistry` | `nil` | Distribution registry to pull the image (this overwrites `.global.seleniumGrid.imageRegistry` value) | | `hub.imageName` | `hub` | Selenium Hub image name | | `hub.imageTag` | `nil` | Selenium Hub image tag (this overwrites `.global.seleniumGrid.imageTag` value) | | `hub.imagePullPolicy` | `IfNotPresent` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) | @@ -319,7 +319,7 @@ If you implement selenium-grid with separate components (`isolateComponents: tru | Parameter | Default | Description | |----------------------------------------------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| -| `components.router.imageRegistry` | `nil` | Distribution registry to pull the image | +| `components.router.imageRegistry` | `nil` | Distribution registry to pull the image (this overwrites `.global.seleniumGrid.imageRegistry` value) | | `components.router.imageName` | `router` | Router image name | | `components.router.imageTag` | `nil` | Router image tag (this overwrites `.global.seleniumGrid.imageTag` value) | | `components.router.imagePullPolicy` | `IfNotPresent` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) | @@ -337,7 +337,7 @@ If you implement selenium-grid with separate components (`isolateComponents: tru | `components.router.nodeSelector` | `{}` | Node Selector for router pods | | `components.router.affinity` | `{}` | Affinity for router pods | | `components.router.priorityClassName` | `""` | Priority class name for router pods | -| `components.distributor.imageRegistry` | `nil` | Distribution registry to pull the image | +| `components.distributor.imageRegistry` | `nil` | Distribution registry to pull the image (this overwrites `.global.seleniumGrid.imageRegistry` value) | | `components.distributor.imageName` | `distributor` | Distributor image name | | `components.distributor.imageTag` | `nil` | Distributor image tag (this overwrites `.global.seleniumGrid.imageTag` value) | | `components.distributor.imagePullPolicy` | `IfNotPresent` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) | @@ -352,7 +352,7 @@ If you implement selenium-grid with separate components (`isolateComponents: tru | `components.distributor.nodeSelector` | `{}` | Node Selector for Distributor pods | | `components.distributor.affinity` | `{}` | Affinity for Distributor pods | | `components.distributor.priorityClassName` | `""` | Priority class name for Distributor pods | -| `components.eventBus.imageRegistry` | `nil` | Distribution registry to pull the image | +| `components.eventBus.imageRegistry` | `nil` | Distribution registry to pull the image (this overwrites `.global.seleniumGrid.imageRegistry` value) | | `components.eventBus.imageName` | `event-bus` | Event Bus image name | | `components.eventBus.imageTag` | `nil` | Event Bus image tag (this overwrites `.global.seleniumGrid.imageTag` value) | | `components.eventBus.imagePullPolicy` | `IfNotPresent` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) | @@ -369,7 +369,7 @@ If you implement selenium-grid with separate components (`isolateComponents: tru | `components.eventBus.nodeSelector` | `{}` | Node Selector for Event Bus pods | | `components.eventBus.affinity` | `{}` | Affinity for Event Bus pods | | `components.eventBus.priorityClassName` | `""` | Priority class name for Event Bus pods | -| `components.sessionMap.imageRegistry` | `nil` | Distribution registry to pull the image | +| `components.sessionMap.imageRegistry` | `nil` | Distribution registry to pull the image (this overwrites `.global.seleniumGrid.imageRegistry` value) | | `components.sessionMap.imageName` | `sessions` | Session Map image name | | `components.sessionMap.imageTag` | `nil` | Session Map image tag (this overwrites `.global.seleniumGrid.imageTag` value) | | `components.sessionMap.imagePullPolicy` | `IfNotPresent` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) | @@ -383,7 +383,7 @@ If you implement selenium-grid with separate components (`isolateComponents: tru | `components.sessionMap.nodeSelector` | `{}` | Node Selector for Session Map pods | | `components.sessionMap.affinity` | `{}` | Affinity for Session Map pods | | `components.sessionMap.priorityClassName` | `""` | Priority class name for Session Map pods | -| `components.sessionQueue.imageRegistry` | `nil` | Distribution registry to pull the image | +| `components.sessionQueue.imageRegistry` | `nil` | Distribution registry to pull the image (this overwrites `.global.seleniumGrid.imageRegistry` value) | | `components.sessionQueue.imageName` | `session-queue` | Session Queue image name | | `components.sessionQueue.imageTag` | `nil` | Session Queue image tag (this overwrites `.global.seleniumGrid.imageTag` value) | | `components.sessionQueue.imagePullPolicy` | `IfNotPresent` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) | diff --git a/charts/selenium-grid/TESTING.md b/charts/selenium-grid/TESTING.md index d6e266713..cd0ece83c 100644 --- a/charts/selenium-grid/TESTING.md +++ b/charts/selenium-grid/TESTING.md @@ -19,6 +19,7 @@ All related testing to this helm chart will be documented in this file. | | Sanity tests in node | ✓ | | | Video recorder is enabled in node | ✗ | | | Node `extraEnvironmentVariables` is set value | ✓ | +| General | Set new image registry via `global.seleniumGrid.imageRegistry` | ✓ | ## Build & test Docker images with Helm charts Noted: These `make` commands are composed and tested on Linux x86_64. diff --git a/tests/K8s/chart_install.sh b/tests/K8s/chart_install.sh index 7fb7a0cb5..0a6ce7001 100755 --- a/tests/K8s/chart_install.sh +++ b/tests/K8s/chart_install.sh @@ -48,6 +48,7 @@ helm upgrade --install ${RELEASE_NAME} \ --set autoscaling.enableWithExistingKEDA=${SELENIUM_GRID_AUTOSCALING} \ --set autoscaling.scaledOptions.minReplicaCount=${SELENIUM_GRID_AUTOSCALING_MIN_REPLICA} \ --set global.seleniumGrid.imageTag=${VERSION} --set global.seleniumGrid.imageRegistry=${NAMESPACE} \ +--set global.seleniumGrid.nodesImageTag=${VERSION} \ ${CHART_PATH} --namespace ${SELENIUM_NAMESPACE} --create-namespace echo "Run Tests" diff --git a/tests/SeleniumTests/__init__.py b/tests/SeleniumTests/__init__.py index 12ee94ede..acdaa4bda 100644 --- a/tests/SeleniumTests/__init__.py +++ b/tests/SeleniumTests/__init__.py @@ -66,15 +66,16 @@ def test_play_video(self): def test_download_file(self): driver = self.driver driver.get('https://the-internet.herokuapp.com/download') + file_name = 'some-file.txt' wait = WebDriverWait(driver, 30) file_link = wait.until( - EC.element_to_be_clickable((By.LINK_TEXT, 'some-file.txt')) + EC.element_to_be_clickable((By.LINK_TEXT, file_name)) ) file_link.click() wait.until( - lambda d: len(d.get_downloadable_files()) > 0 + lambda d: str(d.get_downloadable_files()[0]).endswith(file_name) ) - self.assertTrue(len(driver.get_downloadable_files()) > 0) + self.assertTrue(str(driver.get_downloadable_files()[0]).endswith(file_name)) def tearDown(self): self.driver.quit()