Skip to content

Commit

Permalink
Update tag 4.25.0-20241010 in docs and files
Browse files Browse the repository at this point in the history
  • Loading branch information
selenium-ci committed Oct 10, 2024
1 parent b5eb523 commit 7238747
Show file tree
Hide file tree
Showing 26 changed files with 328 additions and 190 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ body:
attributes:
label: Docker Selenium version (image tag)
description: What version of Docker Selenium are you using?
placeholder: 4.25.0-20240922? Please use the full tag, avoid "latest"
placeholder: 4.25.0-20241010? Please use the full tag, avoid "latest"
validations:
required: true
- type: input
Expand Down
12 changes: 6 additions & 6 deletions .keda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ The stable implementation will be merged to the upstream KEDA repository frequen
Replace the image registry and tag of these KEDA components with the patched image tag:

```bash
docker pull selenium/keda:2.15.1-selenium-grid-20240922
docker pull selenium/keda-metrics-apiserver:2.15.1-selenium-grid-20240922
docker pull selenium/keda-admission-webhooks:2.15.1-selenium-grid-20240922
docker pull selenium/keda:2.15.1-selenium-grid-20241010
docker pull selenium/keda-metrics-apiserver:2.15.1-selenium-grid-20241010
docker pull selenium/keda-admission-webhooks:2.15.1-selenium-grid-20241010
```

Besides that, you also can use image tag `latest` or `nightly`.
Expand All @@ -27,15 +27,15 @@ If you are deploying KEDA core using their official Helm [chart](https://github.
keda:
registry: selenium
repository: keda
tag: "2.15.1-selenium-grid-20240922"
tag: "2.15.1-selenium-grid-20241010"
metricsApiServer:
registry: selenium
repository: keda-metrics-apiserver
tag: "2.15.1-selenium-grid-20240922"
tag: "2.15.1-selenium-grid-20241010"
webhooks:
registry: selenium
repository: keda-admission-webhooks
tag: "2.15.1-selenium-grid-20240922"
tag: "2.15.1-selenium-grid-20241010"
```
If you are deployment Selenium Grid chart with `autoscaling.enabled` is `true` (implies installing KEDA sub-chart), KEDA images registry and tag already set in the `values.yaml`. Refer to list [configuration](../charts/selenium-grid/CONFIGURATION.md).
Expand Down
12 changes: 8 additions & 4 deletions .keda/scalers/selenium_grid_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ type seleniumGridScaler struct {
type seleniumGridScalerMetadata struct {
triggerIndex int

URL string `keda:"name=url, order=triggerMetadata;authParams"`
Username string `keda:"name=username, order=triggerMetadata;authParams, optional"`
Password string `keda:"name=password, order=triggerMetadata;authParams, optional"`
URL string `keda:"name=url, order=authParams;triggerMetadata"`
AuthType string `keda:"name=authType, order=authParams;resolvedEnv, optional"`
Username string `keda:"name=username, order=authParams;resolvedEnv, optional"`
Password string `keda:"name=password, order=authParams;resolvedEnv, optional"`
AccessToken string `keda:"name=accessToken, order=authParams;resolvedEnv, optional"`
BrowserName string `keda:"name=browserName, order=triggerMetadata"`
SessionBrowserName string `keda:"name=sessionBrowserName, order=triggerMetadata, optional"`
ActivationThreshold int64 `keda:"name=activationThreshold, order=triggerMetadata, optional"`
Expand Down Expand Up @@ -196,8 +198,10 @@ func (s *seleniumGridScaler) getSessionsCount(ctx context.Context, logger logr.L
return -1, err
}

if s.metadata.Username != "" && s.metadata.Password != "" {
if (s.metadata.AuthType == "" || strings.EqualFold(s.metadata.AuthType, "Basic")) && s.metadata.Username != "" && s.metadata.Password != "" {
req.SetBasicAuth(s.metadata.Username, s.metadata.Password)
} else if !strings.EqualFold(s.metadata.AuthType, "Basic") && s.metadata.AccessToken != "" {
req.Header.Set("Authorization", fmt.Sprintf("%s %s", s.metadata.AuthType, s.metadata.AccessToken))
}

res, err := s.httpClient.Do(req)
Expand Down
140 changes: 137 additions & 3 deletions .keda/scalers/selenium_grid_scaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,34 @@ func Test_parseSeleniumGridScalerMetadata(t *testing.T) {
NodeMaxSessions: 1,
},
},
{
name: "valid username and password in AuthParams, url, browsername, and sessionbrowsername should return metadata",
args: args{
config: &scalersconfig.ScalerConfig{
AuthParams: map[string]string{
"username": "username",
"password": "password",
},
TriggerMetadata: map[string]string{
"url": "http://selenium-hub:4444/graphql",
"browserName": "MicrosoftEdge",
"sessionBrowserName": "msedge",
},
},
},
wantErr: false,
want: &seleniumGridScalerMetadata{
URL: "http://selenium-hub:4444/graphql",
BrowserName: "MicrosoftEdge",
SessionBrowserName: "msedge",
TargetValue: 1,
BrowserVersion: "latest",
PlatformName: "linux",
Username: "username",
Password: "password",
NodeMaxSessions: 1,
},
},
{
name: "valid url and browsername should return metadata",
args: args{
Expand Down Expand Up @@ -1761,20 +1789,22 @@ func Test_parseSeleniumGridScalerMetadata(t *testing.T) {
},
},
{
name: "valid url, browsername, unsafeSsl, activationThreshold, nodeMaxSessions and platformName should return metadata",
name: "valid url, browsername, unsafeSsl, activationThreshold, nodeMaxSessions and platformName with trigger auth params should return metadata",
args: args{
config: &scalersconfig.ScalerConfig{
TriggerMetadata: map[string]string{
"url": "http://selenium-hub:4444/graphql",
"username": "user",
"password": "password",
"browserName": "chrome",
"browserVersion": "91.0",
"unsafeSsl": "true",
"activationThreshold": "10",
"platformName": "Windows 11",
"nodeMaxSessions": "3",
},
AuthParams: map[string]string{
"username": "user",
"password": "password",
},
},
},
wantErr: false,
Expand All @@ -1792,6 +1822,110 @@ func Test_parseSeleniumGridScalerMetadata(t *testing.T) {
NodeMaxSessions: 3,
},
},
{
name: "url in trigger auth param takes precedence over url in trigger metadata",
args: args{
config: &scalersconfig.ScalerConfig{
TriggerMetadata: map[string]string{
"url": "http://invalid.dns:4444/graphql",
"browserName": "chrome",
"browserVersion": "91.0",
"unsafeSsl": "true",
"activationThreshold": "10",
"platformName": "Windows 11",
"nodeMaxSessions": "3",
},
AuthParams: map[string]string{
"url": "http://selenium-hub:4444/graphql",
"username": "user",
"password": "password",
},
},
},
wantErr: false,
want: &seleniumGridScalerMetadata{
URL: "http://selenium-hub:4444/graphql",
Username: "user",
Password: "password",
BrowserName: "chrome",
SessionBrowserName: "chrome",
TargetValue: 1,
ActivationThreshold: 10,
BrowserVersion: "91.0",
UnsafeSsl: true,
PlatformName: "Windows 11",
NodeMaxSessions: 3,
},
},
{
name: "auth type is not Basic and access token is provided",
args: args{
config: &scalersconfig.ScalerConfig{
TriggerMetadata: map[string]string{
"url": "http://selenium-hub:4444/graphql",
"browserName": "chrome",
"browserVersion": "91.0",
"unsafeSsl": "true",
"activationThreshold": "10",
"platformName": "Windows 11",
"nodeMaxSessions": "3",
},
AuthParams: map[string]string{
"url": "http://selenium-hub:4444/graphql",
"authType": "OAuth2",
"accessToken": "my-access-token",
},
},
},
wantErr: false,
want: &seleniumGridScalerMetadata{
URL: "http://selenium-hub:4444/graphql",
AuthType: "OAuth2",
AccessToken: "my-access-token",
BrowserName: "chrome",
SessionBrowserName: "chrome",
TargetValue: 1,
ActivationThreshold: 10,
BrowserVersion: "91.0",
UnsafeSsl: true,
PlatformName: "Windows 11",
NodeMaxSessions: 3,
},
},
{
name: "authenticating with bearer access token",
args: args{
config: &scalersconfig.ScalerConfig{
TriggerMetadata: map[string]string{
"browserName": "chrome",
"browserVersion": "91.0",
"unsafeSsl": "true",
"activationThreshold": "10",
"platformName": "Windows 11",
"nodeMaxSessions": "3",
},
AuthParams: map[string]string{
"url": "http://selenium-hub:4444/graphql",
"authType": "Bearer",
"accessToken": "my-access-token",
},
},
},
wantErr: false,
want: &seleniumGridScalerMetadata{
URL: "http://selenium-hub:4444/graphql",
AuthType: "Bearer",
AccessToken: "my-access-token",
BrowserName: "chrome",
SessionBrowserName: "chrome",
TargetValue: 1,
ActivationThreshold: 10,
BrowserVersion: "91.0",
UnsafeSsl: true,
PlatformName: "Windows 11",
NodeMaxSessions: 3,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions NodeDocker/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Configs have a mapping between the Docker image to use and the capabilities that need to be matched to
# start a container with the given image.
configs = [
"selenium/standalone-firefox:4.25.0-20240922", '{"browserName": "firefox", "platformName": "linux"}',
"selenium/standalone-chrome:4.25.0-20240922", '{"browserName": "chrome", "platformName": "linux"}',
"selenium/standalone-edge:4.25.0-20240922", '{"browserName": "MicrosoftEdge", "platformName": "linux"}'
"selenium/standalone-firefox:4.25.0-20241010", '{"browserName": "firefox", "platformName": "linux"}',
"selenium/standalone-chrome:4.25.0-20241010", '{"browserName": "chrome", "platformName": "linux"}',
"selenium/standalone-edge:4.25.0-20241010", '{"browserName": "MicrosoftEdge", "platformName": "linux"}'
]

# URL for connecting to the docker daemon
Expand All @@ -14,7 +14,7 @@ configs = [
# socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock
url = "http://127.0.0.1:2375"
# Docker image used for video recording
video-image = "selenium/video:ffmpeg-7.0.2-20240922"
video-image = "selenium/video:ffmpeg-7.0.2-20241010"

# Uncomment the following section if you are running the node on a separate VM
# Fill out the placeholders with appropriate values
Expand Down
Loading

0 comments on commit 7238747

Please sign in to comment.