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

Commit 438ec42

Browse files
committed
test(chart): add tests for the case ingress is enabled with hostname set
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent f231d40 commit 438ec42

File tree

6 files changed

+29
-6
lines changed

6 files changed

+29
-6
lines changed

.github/workflows/helm-chart-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
test-strategy: job_https
4040
cluster: 'kind'
4141
- k8s-version: 'v1.28.7'
42-
test-strategy: job
42+
test-strategy: job_hostname
4343
cluster: 'minikube'
4444
- k8s-version: 'v1.29.2'
4545
test-strategy: deployment_https

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,12 @@ chart_test_edge:
447447
./tests/charts/make/chart_test.sh NodeEdge
448448

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

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

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

464+
chart_test_autoscaling_job_hostname:
465+
SE_ENABLE_TRACING=true SE_ENABLE_INGRESS_HOSTNAME=true \
466+
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
467+
./tests/charts/make/chart_test.sh JobAutoscaling
468+
464469
chart_test_autoscaling_job:
465-
SE_ENABLE_TRACING=true SE_FULL_DISTRIBUTED_MODE=true \
470+
SE_ENABLE_TRACING=true SE_FULL_DISTRIBUTED_MODE=true SE_ENABLE_INGRESS_HOSTNAME=true \
466471
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
467472
./tests/charts/make/chart_test.sh JobAutoscaling
468473

charts/selenium-grid/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ helm install selenium-grid docker-selenium/selenium-grid --version <version>
7171
# In both cases grid exposed by default using ingress. You may want to set hostname for the grid. Default hostname is selenium-grid.local.
7272
helm install selenium-grid --set ingress.hostname=selenium-grid.k8s.local docker-selenium/chart/selenium-grid/.
7373
# Verify ingress configuration via kubectl get ingress
74+
7475
# 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`
76+
sudo -- sh -c -e "echo \"$(hostname -i) selenium-grid.local\" >> /etc/hosts"
7577
```
7678

7779
### Installing the Nightly chart

charts/selenium-grid/TESTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ All related testing to this helm chart will be documented in this file.
1414
| | Auto scaling with `autoscaling.scaledOptions.minReplicaCount` is `0` | &check; | Cluster |
1515
| | Parallel tests execution against node autoscaling | &check; | Cluster |
1616
| Ingress | Ingress is enabled without `hostname` | &check; | Cluster |
17-
| | Ingress is enabled with `hostname` is set | &cross; | |
17+
| | Ingress is enabled with `hostname` is set | &check; | Cluster |
1818
| | Hub `sub-path` is set with Ingress `ImplementationSpecific` paths | &check; | Cluster |
1919
| | `ingress.nginx` configs for NGINX ingress controller annotations | &check; | Template |
2020
| Distributed components | `isolateComponents` is enabled | &check; | Cluster |

tests/charts/ci/base-auth-ingress-values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
global:
2-
K8S_PUBLIC_IP: localhost
32
seleniumGrid:
43
logLevel: INFO
54

tests/charts/make/chart_test.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ SSL_CERT_DIR=${SSL_CERT_DIR:-"/etc/ssl/certs"}
2828
VIDEO_TAG=${VIDEO_TAG:-"latest"}
2929
SE_ENABLE_TRACING=${SE_ENABLE_TRACING:-"false"}
3030
SE_FULL_DISTRIBUTED_MODE=${SE_FULL_DISTRIBUTED_MODE:-"false"}
31+
HOSTNAME_ADDRESS=${HOSTNAME_ADDRESS:-"selenium-grid.local"}
32+
SE_ENABLE_INGRESS_HOSTNAME=${SE_ENABLE_INGRESS_HOSTNAME:-"false"}
3133

3234
cleanup() {
3335
if [ "${SKIP_CLEANUP}" = "false" ]; then
@@ -74,6 +76,21 @@ HELM_COMMAND_SET_IMAGES=" \
7476
--set isolateComponents=${SE_FULL_DISTRIBUTED_MODE} \
7577
"
7678

79+
if [ "${SE_ENABLE_INGRESS_HOSTNAME}" = "true" ]; then
80+
if [[ ! $(cat /etc/hosts) == *"${HOSTNAME_ADDRESS}"* ]]; then
81+
sudo -- sh -c -e "echo \"$(hostname -i) ${HOSTNAME_ADDRESS}\" >> /etc/hosts"
82+
fi
83+
ping -c 2 ${HOSTNAME_ADDRESS}
84+
HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \
85+
--set ingress.hostname=${HOSTNAME_ADDRESS} \
86+
"
87+
SELENIUM_GRID_HOST=${HOSTNAME_ADDRESS}
88+
else
89+
HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \
90+
--set global.K8S_PUBLIC_IP=${SELENIUM_GRID_HOST} \
91+
"
92+
fi
93+
7794
if [ "${SELENIUM_GRID_AUTOSCALING}" = "true" ]; then
7895
HELM_COMMAND_SET_AUTOSCALING=" \
7996
--set autoscaling.enableWithExistingKEDA=${SELENIUM_GRID_AUTOSCALING} \

0 commit comments

Comments
 (0)