Skip to content

Commit 13f4105

Browse files
committed
K8s: Add test multiple browser versions scale
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent df70afe commit 13f4105

File tree

7 files changed

+89
-4
lines changed

7 files changed

+89
-4
lines changed

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ SBOM_OUTPUT := $(or $(SBOM_OUTPUT),$(SBOM_OUTPUT),package_versions.txt)
3131
KEDA_TAG_PREV_VERSION := $(or $(KEDA_TAG_PREV_VERSION),$(KEDA_TAG_PREV_VERSION),2.16.0-selenium-grid)
3232
KEDA_TAG_VERSION := $(or $(KEDA_TAG_VERSION),$(KEDA_TAG_VERSION),2.16.0-selenium-grid)
3333
KEDA_BASED_NAME := $(or $(KEDA_BASED_NAME),$(KEDA_BASED_NAME),ndviet)
34-
KEDA_BASED_TAG := $(or $(KEDA_BASED_TAG),$(KEDA_BASED_TAG),2.16.0-selenium-grid-20241212)
34+
KEDA_BASED_TAG := $(or $(KEDA_BASED_TAG),$(KEDA_BASED_TAG),2.16.0-selenium-grid-20241224)
3535

3636
all: hub \
3737
distributor \
@@ -930,7 +930,7 @@ chart_test_autoscaling_disabled:
930930
./tests/charts/make/chart_test.sh NoAutoscaling
931931

932932
chart_test_autoscaling_deployment_https:
933-
PLATFORMS=$(PLATFORMS) CHART_FULL_DISTRIBUTED_MODE=true CHART_ENABLE_BASIC_AUTH=true TEST_EXTERNAL_DATASTORE=postgresql \
933+
PLATFORMS=$(PLATFORMS) CHART_FULL_DISTRIBUTED_MODE=true CHART_ENABLE_BASIC_AUTH=true TEST_EXTERNAL_DATASTORE=postgresql TEST_MULTIPLE_VERSIONS=true \
934934
SECURE_INGRESS_ONLY_DEFAULT=true INGRESS_DISABLE_USE_HTTP2=true SELENIUM_GRID_PROTOCOL=https CHART_ENABLE_INGRESS_HOSTNAME=true SELENIUM_GRID_PORT=443 \
935935
SELENIUM_GRID_AUTOSCALING_MIN_REPLICA=0 MAX_SESSIONS_FIREFOX=1 MAX_SESSIONS_EDGE=1 MAX_SESSIONS_CHROME=1 TEST_NAME_OVERRIDE=true \
936936
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \
@@ -960,8 +960,15 @@ chart_test_autoscaling_job_hostname:
960960
TEMPLATE_OUTPUT_FILENAME="k8s_enableTracing_basicAuth_secureIngress_externalCerts_ingressPublicIP_autoScaling_originKEDA_scaledJob_subPath.yaml" \
961961
./tests/charts/make/chart_test.sh JobAutoscaling
962962

963+
chart_test_autoscaling_job_multiple_versions_without_explicit:
964+
TEST_MULTIPLE_VERSIONS=true TEST_MULTIPLE_VERSIONS_EXPLICIT=false make chart_test_autoscaling_job
965+
966+
chart_test_autoscaling_job_without_multiple_versions:
967+
TEST_MULTIPLE_VERSIONS=false make chart_test_autoscaling_job
968+
963969
chart_test_autoscaling_job:
964970
PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true TEST_CHROMIUM=true RELEASE_NAME=selenium CHART_ENABLE_TRACING=true CHART_FULL_DISTRIBUTED_MODE=true SELENIUM_GRID_MONITORING=false \
971+
CLEAR_POD_HISTORY=true TEST_MULTIPLE_VERSIONS=$(or $(TEST_MULTIPLE_VERSIONS), "true") TEST_MULTIPLE_VERSIONS_EXPLICIT=$(or $(TEST_MULTIPLE_VERSIONS_EXPLICIT), "true") \
965972
SECURE_INGRESS_ONLY_CONFIG_INLINE=true SECURE_USE_EXTERNAL_CERT=true CHART_ENABLE_INGRESS_HOSTNAME=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=selenium-grid.prod SUB_PATH=/ SELENIUM_GRID_PORT=443 \
966973
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \
967974
TEMPLATE_OUTPUT_FILENAME="k8s_fullDistributed_secureIngress_externalCerts_ingressHostName_ingressTLSInline_autoScaling_scaledJob_existingKEDA_prefixSelenium_nodeChromium_enableTracing.yaml" \

charts/selenium-grid/CONFIGURATION.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
9696
| ingress.nginx.proxyBuffer.number | int | `4` | Set buffer number to corresponding annotations for NGINX Ingress Controller |
9797
| ingress.nginx.sslPassthrough | bool | `true` | Enable corresponding annotations for NGINX Ingress Controller |
9898
| ingress.nginx.sslSecret | string | `""` | Specify a Secret with the certificate `tls.crt`, key `tls.key`, the name in the form "namespace/secretName" for NGINX Ingress Controller |
99-
| ingress.nginx.useHttp2 | bool | `true` | Enables or disables HTTP/2 support in secure connections via annotations for NGINX Ingress Controller |
99+
| ingress.nginx.useHttp2 | bool | `false` | Enables or disables HTTP/2 support in secure connections via annotations for NGINX Ingress Controller |
100100
| ingress.nginx.upstreamKeepalive | object | `{"connections":10000,"requests":10000,"time":"1h"}` | Apply upstream keepalive settings once HTTP/2 is enabled |
101101
| ingress.nginx.upstreamKeepalive.connections | int | `10000` | Set keepalive connections to corresponding annotations for NGINX Ingress Controller |
102102
| ingress.nginx.upstreamKeepalive.time | string | `"1h"` | Set keepalive timeout to corresponding annotations for NGINX Ingress Controller |
@@ -406,6 +406,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
406406
| chromeNode.scaledObjectOptions | string | `nil` | Override the scaledObjectOptions for chrome nodes |
407407
| chromeNode.hpa.browserName | string | `"chrome"` | browserName from the capability |
408408
| chromeNode.hpa.sessionBrowserName | string | `"chrome"` | sessionBrowserName if the browserName is different from the sessionBrowserName |
409+
| chromeNode.hpa.browserVersion | string | `""` | browserVersion from the capability |
409410
| chromeNode.hpa.platformName | string | `"linux"` | platformName from the capability |
410411
| chromeNode.hpa.unsafeSsl | string | `"{{ template \"seleniumGrid.graphqlURL.unsafeSsl\" . }}"` | Skip check SSL when connecting to the Graphql endpoint |
411412
| chromeNode.initContainers | list | `[]` | It is used to add initContainers in the same pod of the browser node. It should be set using the --set-json option |
@@ -457,6 +458,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
457458
| firefoxNode.scaledObjectOptions | string | `nil` | Override the scaledObjectOptions for firefox nodes |
458459
| firefoxNode.hpa.browserName | string | `"firefox"` | browserName from the capability |
459460
| firefoxNode.hpa.sessionBrowserName | string | `"firefox"` | sessionBrowserName if the browserName is different from the sessionBrowserName |
461+
| firefoxNode.hpa.browserVersion | string | `""` | browserVersion from the capability |
460462
| firefoxNode.hpa.platformName | string | `"linux"` | platformName from the capability |
461463
| firefoxNode.hpa.unsafeSsl | string | `"{{ template \"seleniumGrid.graphqlURL.unsafeSsl\" . }}"` | Skip check SSL when connecting to the Graphql endpoint |
462464
| firefoxNode.initContainers | list | `[]` | It is used to add initContainers in the same pod of the browser node. It should be set using the --set-json option |
@@ -508,6 +510,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
508510
| edgeNode.scaledObjectOptions | string | `nil` | Override the scaledObjectOptions for edge nodes |
509511
| edgeNode.hpa.browserName | string | `"MicrosoftEdge"` | browserName from the capability |
510512
| edgeNode.hpa.sessionBrowserName | string | `"msedge"` | sessionBrowserName if the browserName is different from the sessionBrowserName |
513+
| edgeNode.hpa.browserVersion | string | `""` | browserVersion from the capability |
511514
| edgeNode.hpa.platformName | string | `"linux"` | platformName from the capability |
512515
| edgeNode.hpa.unsafeSsl | string | `"{{ template \"seleniumGrid.graphqlURL.unsafeSsl\" . }}"` | Skip check SSL when connecting to the Graphql endpoint |
513516
| edgeNode.initContainers | list | `[]` | It is used to add initContainers in the same pod of the browser node. It should be set using the --set-json option |
@@ -560,6 +563,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
560563
| relayNode.hpa.browserName | string | `"chrome"` | browserName from the capability |
561564
| relayNode.hpa.sessionBrowserName | string | `""` | sessionBrowserName if the browserName is different from the sessionBrowserName |
562565
| relayNode.hpa.platformName | string | `"Android"` | platformName from the capability |
566+
| relayNode.hpa.browserVersion | string | `""` | browserVersion from the capability |
563567
| relayNode.hpa.unsafeSsl | string | `"{{ template \"seleniumGrid.graphqlURL.unsafeSsl\" . }}"` | Skip check SSL when connecting to the Graphql endpoint |
564568
| relayNode.initContainers | list | `[]` | It is used to add initContainers in the same pod of the browser node. It should be set using the --set-json option |
565569
| relayNode.sidecars | list | `[]` | It is used to add sidecars proxy in the same pod of the browser node. It means it will add a new container to the deployment itself. It should be set using the --set-json option |

charts/selenium-grid/cross-browsers-values.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ crossBrowsers:
22
chromeNode:
33
# Keep the first iteration with latest version of Chrome
44
- nameOverride:
5+
hpa:
6+
browserVersion: ''
7+
- nameOverride: '{{ $.Release.Name }}-node-chrome-131'
8+
imageTag: '131.0'
9+
hpa:
10+
browserVersion: '131.0'
511
- nameOverride: '{{ $.Release.Name }}-node-chrome-130'
612
imageTag: '130.0'
713
hpa:
@@ -17,6 +23,20 @@ crossBrowsers:
1723
firefoxNode:
1824
# Keep the first iteration with latest version of Firefox
1925
- nameOverride:
26+
hpa:
27+
browserVersion: ''
28+
- nameOverride: '{{ $.Release.Name }}-node-firefox-133'
29+
imageTag: '133.0'
30+
hpa:
31+
browserVersion: '133.0'
32+
- nameOverride: '{{ $.Release.Name }}-node-firefox-132'
33+
imageTag: '132.0'
34+
hpa:
35+
browserVersion: '132.0'
36+
- nameOverride: '{{ $.Release.Name }}-node-firefox-131'
37+
imageTag: '131.0'
38+
hpa:
39+
browserVersion: '131.0'
2040
- nameOverride: '{{ $.Release.Name }}-node-firefox-130'
2141
imageTag: '130.0'
2242
hpa:
@@ -32,6 +52,12 @@ crossBrowsers:
3252
edgeNode:
3353
# Keep the first iteration with latest version of Edge
3454
- nameOverride:
55+
hpa:
56+
browserVersion: ''
57+
- nameOverride: '{{ $.Release.Name }}-node-edge-131'
58+
imageTag: '131.0'
59+
hpa:
60+
browserVersion: '131.0'
3561
- nameOverride: '{{ $.Release.Name }}-node-edge-130'
3662
imageTag: '130.0'
3763
hpa:

charts/selenium-grid/templates/_helpers.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,14 @@ template:
343343
{{- end }}
344344
- name: SE_DRAIN_AFTER_SESSION_COUNT
345345
value: {{ and (eq (include "seleniumGrid.useKEDA" $) "true") (eq .Values.autoscaling.scalingType "job") | ternary $nodeMaxSessions 0 | quote }}
346+
{{- if and (eq (include "seleniumGrid.useKEDA" $) "true") }}
347+
- name: SE_NODE_BROWSER_VERSION
348+
value: {{ default "" .node.hpa.browserVersion | quote }}
349+
{{- end }}
350+
{{- if and (eq (include "seleniumGrid.useKEDA" $) "true") }}
351+
- name: SE_NODE_PLATFORM_NAME
352+
value: {{ default "Linux" .node.hpa.platformName | quote }}
353+
{{- end }}
346354
- name: SE_NODE_CONTAINER_NAME
347355
valueFrom:
348356
fieldRef:

charts/selenium-grid/values.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ ingress:
201201
# -- Specify a Secret with the certificate `tls.crt`, key `tls.key`, the name in the form "namespace/secretName" for NGINX Ingress Controller
202202
sslSecret: ""
203203
# -- Enables or disables HTTP/2 support in secure connections via annotations for NGINX Ingress Controller
204-
useHttp2: true
204+
useHttp2: false
205205
# -- Apply upstream keepalive settings once HTTP/2 is enabled
206206
upstreamKeepalive:
207207
# -- Set keepalive connections to corresponding annotations for NGINX Ingress Controller
@@ -1117,6 +1117,8 @@ chromeNode:
11171117
browserName: "chrome"
11181118
# -- sessionBrowserName if the browserName is different from the sessionBrowserName
11191119
sessionBrowserName: "chrome"
1120+
# -- browserVersion from the capability
1121+
browserVersion: ""
11201122
# -- platformName from the capability
11211123
platformName: "linux"
11221124
# browserVersion: '91.0' # Optional. Only required when supporting multiple versions of browser in your Selenium Grid.
@@ -1300,6 +1302,8 @@ firefoxNode:
13001302
browserName: "firefox"
13011303
# -- sessionBrowserName if the browserName is different from the sessionBrowserName
13021304
sessionBrowserName: "firefox"
1305+
# -- browserVersion from the capability
1306+
browserVersion: ""
13031307
# -- platformName from the capability
13041308
platformName: "linux"
13051309
# -- Skip check SSL when connecting to the Graphql endpoint
@@ -1482,6 +1486,8 @@ edgeNode:
14821486
browserName: "MicrosoftEdge"
14831487
# -- sessionBrowserName if the browserName is different from the sessionBrowserName
14841488
sessionBrowserName: "msedge"
1489+
# -- browserVersion from the capability
1490+
browserVersion: ""
14851491
# -- platformName from the capability
14861492
platformName: "linux"
14871493
# -- Skip check SSL when connecting to the Graphql endpoint
@@ -1666,6 +1672,8 @@ relayNode:
16661672
sessionBrowserName: ""
16671673
# -- platformName from the capability
16681674
platformName: "Android"
1675+
# -- browserVersion from the capability
1676+
browserVersion: ""
16691677
# browserVersion: '91.0' # Optional. Only required when supporting multiple versions of browser in your Selenium Grid.
16701678
# -- Skip check SSL when connecting to the Graphql endpoint
16711679
unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional

tests/SeleniumTests/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@
3131
TEST_FIREFOX_INSTALL_LANG_PACKAGE = os.environ.get('TEST_FIREFOX_INSTALL_LANG_PACKAGE', 'false').lower() == 'true'
3232
TEST_ADD_CAPS_RECORD_VIDEO = os.environ.get('TEST_ADD_CAPS_RECORD_VIDEO', 'true').lower() == 'true'
3333
TEST_CUSTOM_SPECIFIC_NAME = os.environ.get('TEST_CUSTOM_SPECIFIC_NAME', 'false').lower() == 'true'
34+
TEST_MULTIPLE_VERSIONS = os.environ.get('TEST_MULTIPLE_VERSIONS', 'false').lower() == 'true'
35+
TEST_MULTIPLE_VERSIONS_EXPLICIT = os.environ.get('TEST_MULTIPLE_VERSIONS_EXPLICIT', 'true').lower() == 'true'
36+
LIST_CHROMIUM_VERSIONS = ['130.0', '129.0', '128.0']
37+
LIST_FIREFOX_VERSIONS = ['132.0', '131.0', '130.0', '129.0', '128.0']
38+
39+
if not TEST_MULTIPLE_VERSIONS_EXPLICIT:
40+
LIST_CHROMIUM_VERSIONS.append(None)
41+
LIST_FIREFOX_VERSIONS.append(None)
3442

3543
SELENIUM_GRID_URL = f"{SELENIUM_GRID_PROTOCOL}://{SELENIUM_GRID_HOST}:{SELENIUM_GRID_PORT}"
3644
CLIENT_CONFIG = ClientConfig(
@@ -153,6 +161,10 @@ def setUp(self):
153161
options.set_capability('se:screenResolution', '1920x1080')
154162
if SELENIUM_GRID_TEST_HEADLESS:
155163
options.add_argument('--headless=new')
164+
if TEST_MULTIPLE_VERSIONS:
165+
browser_version = random.choice(LIST_CHROMIUM_VERSIONS)
166+
if browser_version:
167+
options.set_capability('browserVersion', browser_version)
156168
if TEST_NODE_RELAY == 'Android':
157169
options.set_capability('platformName', TEST_NODE_RELAY)
158170
options.set_capability('appium:platformVersion', TEST_ANDROID_PLATFORM_API)
@@ -195,6 +207,11 @@ def setUp(self):
195207
options.set_capability('se:screenResolution', '1920x1080')
196208
if SELENIUM_GRID_TEST_HEADLESS:
197209
options.add_argument('--headless=new')
210+
if TEST_MULTIPLE_VERSIONS:
211+
browser_version = random.choice(LIST_CHROMIUM_VERSIONS)
212+
if browser_version:
213+
options.set_capability('browserVersion', browser_version)
214+
options.set_capability('platformName', 'Linux')
198215
start_time = time.time()
199216
self.driver = webdriver.Remote(
200217
options=options,
@@ -229,6 +246,11 @@ def setUp(self):
229246
options.set_capability('se:screenResolution', '1920x1080')
230247
if SELENIUM_GRID_TEST_HEADLESS:
231248
options.add_argument('-headless')
249+
if TEST_MULTIPLE_VERSIONS:
250+
browser_version = random.choice(LIST_FIREFOX_VERSIONS)
251+
if browser_version:
252+
options.set_capability('browserVersion', browser_version)
253+
options.set_capability('platformName', 'Linux')
232254
start_time = time.time()
233255
self.driver = webdriver.Remote(
234256
options=options,

tests/charts/make/chart_test.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ TEST_PATCHED_KEDA=${TEST_PATCHED_KEDA:-"true"}
6363
BASIC_AUTH_EMBEDDED_URL=${BASIC_AUTH_EMBEDDED_URL:-"false"}
6464
SELENIUM_GRID_MONITORING=${SELENIUM_GRID_MONITORING:-"true"}
6565
TEST_EXISTING_PTS=${TEST_EXISTING_PTS:-"false"}
66+
TEST_MULTIPLE_VERSIONS=${TEST_MULTIPLE_VERSIONS:-"false"}
67+
TEST_MULTIPLE_VERSIONS_EXPLICIT=${TEST_MULTIPLE_VERSIONS_EXPLICIT:-"true"}
6668

6769
cleanup() {
6870
# Get the list of pods
@@ -386,6 +388,12 @@ if [ "${SELENIUM_GRID_PROTOCOL}" = "https" ]; then
386388
"
387389
fi
388390

391+
if [ "${TEST_MULTIPLE_VERSIONS}" = "true" ]; then
392+
HELM_COMMAND_SET_BASE_VALUES="${HELM_COMMAND_SET_BASE_VALUES} \
393+
--values ${CHART_PATH}/cross-browsers-values.yaml \
394+
"
395+
fi
396+
389397
HELM_COMMAND_SET_BASE_VALUES="${HELM_COMMAND_SET_BASE_VALUES} \
390398
--values ${MATRIX_BROWSER_VALUES_FILE} \
391399
"
@@ -460,6 +468,8 @@ export TEST_DELAY_AFTER_TEST=${TEST_DELAY_AFTER_TEST:-"0"}
460468
export TEST_PLATFORMS=${TEST_PLATFORMS}
461469
export TEST_NODE_MAX_SESSIONS=${TEST_NODE_MAX_SESSIONS}
462470
export TEST_AUTOSCALING_ITERATIONS=${TEST_AUTOSCALING_ITERATIONS:-"20"}
471+
export TEST_MULTIPLE_VERSIONS=${TEST_MULTIPLE_VERSIONS}
472+
export TEST_MULTIPLE_VERSIONS_EXPLICIT=${TEST_MULTIPLE_VERSIONS_EXPLICIT}
463473
if [ "${MATRIX_BROWSER}" = "NoAutoscaling" ]; then
464474
./tests/bootstrap.sh NodeFirefox
465475
if [ "${TEST_PLATFORMS}" = "linux/amd64" ]; then

0 commit comments

Comments
 (0)