Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
test(chart): add tests for the case ingress is enabled with `hostname…
Browse files Browse the repository at this point in the history
…` set

Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
  • Loading branch information
VietND96 committed Feb 21, 2024
1 parent f231d40 commit 438ec42
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/helm-chart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
test-strategy: job_https
cluster: 'kind'
- k8s-version: 'v1.28.7'
test-strategy: job
test-strategy: job_hostname
cluster: 'minikube'
- k8s-version: 'v1.29.2'
test-strategy: deployment_https
Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -447,12 +447,12 @@ chart_test_edge:
./tests/charts/make/chart_test.sh NodeEdge

chart_test_autoscaling_deployment_https:
SE_FULL_DISTRIBUTED_MODE=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_PORT=443 \
SE_FULL_DISTRIBUTED_MODE=true SE_ENABLE_INGRESS_HOSTNAME=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_PORT=443 \
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
./tests/charts/make/chart_test.sh DeploymentAutoscaling

chart_test_autoscaling_deployment:
SE_ENABLE_TRACING=true SELENIUM_GRID_TEST_HEADLESS=true \
SE_ENABLE_TRACING=true SELENIUM_GRID_TEST_HEADLESS=true SELENIUM_GRID_HOST=$$(hostname -i) \
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
./tests/charts/make/chart_test.sh DeploymentAutoscaling

Expand All @@ -461,8 +461,13 @@ chart_test_autoscaling_job_https:
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
./tests/charts/make/chart_test.sh JobAutoscaling

chart_test_autoscaling_job_hostname:
SE_ENABLE_TRACING=true SE_ENABLE_INGRESS_HOSTNAME=true \
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
./tests/charts/make/chart_test.sh JobAutoscaling

chart_test_autoscaling_job:
SE_ENABLE_TRACING=true SE_FULL_DISTRIBUTED_MODE=true \
SE_ENABLE_TRACING=true SE_FULL_DISTRIBUTED_MODE=true SE_ENABLE_INGRESS_HOSTNAME=true \
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
./tests/charts/make/chart_test.sh JobAutoscaling

Expand Down
2 changes: 2 additions & 0 deletions charts/selenium-grid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ helm install selenium-grid docker-selenium/selenium-grid --version <version>
# In both cases grid exposed by default using ingress. You may want to set hostname for the grid. Default hostname is selenium-grid.local.
helm install selenium-grid --set ingress.hostname=selenium-grid.k8s.local docker-selenium/chart/selenium-grid/.
# Verify ingress configuration via kubectl get ingress

# Notes: In case you want to set hostname is selenium-grid.local. You need to add the IP and hostname to the local host file in `/etc/hosts`
sudo -- sh -c -e "echo \"$(hostname -i) selenium-grid.local\" >> /etc/hosts"
```

### Installing the Nightly chart
Expand Down
2 changes: 1 addition & 1 deletion charts/selenium-grid/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ All related testing to this helm chart will be documented in this file.
| | Auto scaling with `autoscaling.scaledOptions.minReplicaCount` is `0` | &check; | Cluster |
| | Parallel tests execution against node autoscaling | &check; | Cluster |
| Ingress | Ingress is enabled without `hostname` | &check; | Cluster |
| | Ingress is enabled with `hostname` is set | &cross; | |
| | Ingress is enabled with `hostname` is set | &check; | Cluster |
| | Hub `sub-path` is set with Ingress `ImplementationSpecific` paths | &check; | Cluster |
| | `ingress.nginx` configs for NGINX ingress controller annotations | &check; | Template |
| Distributed components | `isolateComponents` is enabled | &check; | Cluster |
Expand Down
1 change: 0 additions & 1 deletion tests/charts/ci/base-auth-ingress-values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
global:
K8S_PUBLIC_IP: localhost
seleniumGrid:
logLevel: INFO

Expand Down
17 changes: 17 additions & 0 deletions tests/charts/make/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ SSL_CERT_DIR=${SSL_CERT_DIR:-"/etc/ssl/certs"}
VIDEO_TAG=${VIDEO_TAG:-"latest"}
SE_ENABLE_TRACING=${SE_ENABLE_TRACING:-"false"}
SE_FULL_DISTRIBUTED_MODE=${SE_FULL_DISTRIBUTED_MODE:-"false"}
HOSTNAME_ADDRESS=${HOSTNAME_ADDRESS:-"selenium-grid.local"}
SE_ENABLE_INGRESS_HOSTNAME=${SE_ENABLE_INGRESS_HOSTNAME:-"false"}

cleanup() {
if [ "${SKIP_CLEANUP}" = "false" ]; then
Expand Down Expand Up @@ -74,6 +76,21 @@ HELM_COMMAND_SET_IMAGES=" \
--set isolateComponents=${SE_FULL_DISTRIBUTED_MODE} \
"

if [ "${SE_ENABLE_INGRESS_HOSTNAME}" = "true" ]; then
if [[ ! $(cat /etc/hosts) == *"${HOSTNAME_ADDRESS}"* ]]; then
sudo -- sh -c -e "echo \"$(hostname -i) ${HOSTNAME_ADDRESS}\" >> /etc/hosts"
fi
ping -c 2 ${HOSTNAME_ADDRESS}
HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \
--set ingress.hostname=${HOSTNAME_ADDRESS} \
"
SELENIUM_GRID_HOST=${HOSTNAME_ADDRESS}
else
HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \
--set global.K8S_PUBLIC_IP=${SELENIUM_GRID_HOST} \
"
fi

if [ "${SELENIUM_GRID_AUTOSCALING}" = "true" ]; then
HELM_COMMAND_SET_AUTOSCALING=" \
--set autoscaling.enableWithExistingKEDA=${SELENIUM_GRID_AUTOSCALING} \
Expand Down

0 comments on commit 438ec42

Please sign in to comment.