-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
[grid] Fix classpath packaging Redis-backed for SessionQueue #17706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
java/test/org/openqa/selenium/grid/sessionqueue/config/BUILD.bazel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| load("@rules_jvm_external//:defs.bzl", "artifact") | ||
| load("//java:defs.bzl", "JUNIT5_DEPS", "java_test_suite") | ||
|
|
||
| java_test_suite( | ||
| name = "SmallTests", | ||
| size = "small", | ||
| srcs = glob(["*Test.java"]), | ||
| deps = [ | ||
| "//java/src/org/openqa/selenium/grid/config", | ||
| "//java/src/org/openqa/selenium/grid/sessionqueue/config", | ||
| artifact("com.beust:jcommander"), | ||
| artifact("org.junit.jupiter:junit-jupiter-api"), | ||
| artifact("org.assertj:assertj-core"), | ||
| ] + JUNIT5_DEPS, | ||
| ) |
67 changes: 67 additions & 0 deletions
67
java/test/org/openqa/selenium/grid/sessionqueue/config/NewSessionQueueFlagsTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| // Licensed to the Software Freedom Conservancy (SFC) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The SFC licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| package org.openqa.selenium.grid.sessionqueue.config; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
| import static org.assertj.core.api.Assertions.assertThatCode; | ||
|
|
||
| import com.beust.jcommander.JCommander; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.openqa.selenium.grid.config.AnnotatedConfig; | ||
| import org.openqa.selenium.grid.config.Config; | ||
|
|
||
| class NewSessionQueueFlagsTest { | ||
|
|
||
| private NewSessionQueueFlags flags; | ||
|
|
||
| @BeforeEach | ||
| void setUp() { | ||
| flags = new NewSessionQueueFlags(); | ||
| } | ||
|
|
||
| @Test | ||
| void sessionQueueImplementationFlagIsAccepted() { | ||
| String impl = "org.openqa.selenium.grid.sessionqueue.redis.RedisBackedNewSessionQueue"; | ||
|
|
||
| assertThatCode( | ||
| () -> | ||
| JCommander.newBuilder() | ||
| .addObject(flags) | ||
| .build() | ||
| .parse("--sessionqueue-implementation", impl)) | ||
| .doesNotThrowAnyException(); | ||
| } | ||
|
|
||
| @Test | ||
| void sessionQueueImplementationFlagPopulatesConfig() { | ||
| String impl = "org.openqa.selenium.grid.sessionqueue.redis.RedisBackedNewSessionQueue"; | ||
| JCommander.newBuilder().addObject(flags).build().parse("--sessionqueue-implementation", impl); | ||
|
|
||
| Config config = new AnnotatedConfig(flags); | ||
|
|
||
| assertThat(config.get("sessionqueue", "implementation")).contains(impl); | ||
| } | ||
|
|
||
| @Test | ||
| void sessionQueueImplementationIsAbsentWhenFlagNotSet() { | ||
| Config config = new AnnotatedConfig(flags); | ||
|
|
||
| assertThat(config.get("sessionqueue", "implementation")).isEmpty(); | ||
| } | ||
| } |
20 changes: 20 additions & 0 deletions
20
java/test/org/openqa/selenium/grid/sessionqueue/httpd/BUILD.bazel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| load("@rules_jvm_external//:defs.bzl", "artifact") | ||
| load("//java:defs.bzl", "JUNIT5_DEPS", "java_test_suite") | ||
| load("//java:version.bzl", "TOOLS_JAVA_VERSION") | ||
|
|
||
| java_test_suite( | ||
| name = "small-tests", | ||
| size = "small", | ||
| srcs = glob(["*.java"]), | ||
| javacopts = [ | ||
| "--release", | ||
| TOOLS_JAVA_VERSION, | ||
| ], | ||
| deps = [ | ||
| # Depend on the httpd target (not redis directly) so that the test validates the | ||
| # production classpath: if redis is ever dropped from httpd's deps, these tests fail. | ||
| "//java/src/org/openqa/selenium/grid/sessionqueue/httpd", | ||
| artifact("org.assertj:assertj-core"), | ||
| artifact("org.junit.jupiter:junit-jupiter-api"), | ||
| ] + JUNIT5_DEPS, | ||
| ) |
43 changes: 43 additions & 0 deletions
43
java/test/org/openqa/selenium/grid/sessionqueue/httpd/NewSessionQueueServerTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Licensed to the Software Freedom Conservancy (SFC) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The SFC licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| package org.openqa.selenium.grid.sessionqueue.httpd; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThatCode; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class NewSessionQueueServerTest { | ||
|
|
||
| // These classes are loaded via Class.forName() at runtime. This test verifies they are bundled | ||
| // into the httpd target so that --sessionqueue-implementation works without --ext. | ||
| @Test | ||
| void localImplementationIsOnClasspath() { | ||
| assertThatCode( | ||
| () -> Class.forName("org.openqa.selenium.grid.sessionqueue.local.LocalNewSessionQueue")) | ||
| .doesNotThrowAnyException(); | ||
| } | ||
|
|
||
| @Test | ||
| void redisImplementationIsOnClasspath() { | ||
| assertThatCode( | ||
| () -> | ||
| Class.forName( | ||
| "org.openqa.selenium.grid.sessionqueue.redis.RedisBackedNewSessionQueue")) | ||
| .doesNotThrowAnyException(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.