Added the shutdown delay and shutdown timeout for the testcases to default options #46414
Added the shutdown delay and shutdown timeout for the testcases to default options #46414ruchikajha95 wants to merge 8 commits intokeycloak:mainfrom
Conversation
...sts/junit5/src/main/java/org/keycloak/it/junit5/extension/KeycloakDistributionDecorator.java
Outdated
Show resolved
Hide resolved
...sts/junit5/src/main/java/org/keycloak/it/junit5/extension/KeycloakDistributionDecorator.java
Outdated
Show resolved
Hide resolved
| * If any option must be set when starting the server. | ||
| */ | ||
| String[] defaultOptions() default {}; | ||
|
|
|
|
||
| args.addAll(List.of(config.defaultOptions())); | ||
|
|
||
| if (isStartCommand(args)) { |
There was a problem hiding this comment.
All changes in this file can be replaced with one line
setEnvVar("KC_SHUTDOWN_DELAY", "0s");| this.tlsEnabled = tlsEnabled; | ||
|
|
||
| List<String> args = keycloakServerConfigBuilder.toArgs(); | ||
| if (args.stream().noneMatch(arg -> arg.startsWith("--shutdown-delay"))) { |
There was a problem hiding this comment.
Same here, in the method startKeycloak(), you can add
pb.environment().put("KC_SHUTDOWN_DELAY", "0s");…fault options Closes keycloak#46337 Signed-off-by: Ruchika <[email protected]>
…citly Closes keycloak#46337 Signed-off-by: Ruchika <[email protected]>
Closes keycloak#46337 Signed-off-by: Ruchika <[email protected]>
Closes keycloak#46337 Signed-off-by: Ruchika <[email protected]>
Closes keycloak#46337 Signed-off-by: Ruchika <[email protected]>
Closes keycloak#46337 Signed-off-by: Ruchika <[email protected]>
5c748bc to
0b6d0ad
Compare
Closes keycloak#46337 Signed-off-by: Ruchika <[email protected]>
Closes keycloak#46337 Signed-off-by: Ruchika <[email protected]>
| commands.add("--health-enabled=true"); // expose something to management interface to turn it on | ||
|
|
||
| // reduce shutdown delay to speed up testsuite execution. | ||
| env.put("KC_SHUTDOWN_DELAY", "0s"); |
There was a problem hiding this comment.
Here, we could've used the CLI option to be consistent with other options being set here. In this testsuite we don't expect the tests would be overriding this option, so no need for the env var (if that was the motivation to use it over the CLI option in other places.
That said, it's not blocking, it's good as is.
There was a problem hiding this comment.
I suggested using the environment variable approach to keep consistent with the other places.
You're right, it doesn't seem possible to overwrite the command list in this class.
There was a problem hiding this comment.
If you mean consistent across testsuite, we're inconsistent already how each of them configures KC. The Arquillian testsuite uses CLI options, that was my argument here.
|
|
||
| OutputHandler outputHandler; | ||
| try { | ||
| pb.environment().put("KC_SHUTDOWN_DELAY", "0s"); |
There was a problem hiding this comment.
I think we might want to put this somewhere into default options in the testsuite? @shawkins Do you remember where?
There was a problem hiding this comment.
No, I don't recall a place for that.
shawkins
left a comment
There was a problem hiding this comment.
Is this only needed for distribution tests? What about embedded? And in general should start-dev shut down immediately?
|
@shawkins, we discussed the embedded mode, and we decided to ignore it and focus on making the GH actions faster. Embedded mode is not used by GH actions as far as we know, and it may go away with the new testsutite (?). We never thought about |
Embedded mode is supported with the new testsuite and does seem to be used, just not by GH - cc @stianst @lhanusov One other thought - is this adding any measurable delay to the operator tests? |
|
Embedded is used for local development where speed is also important. It's also important to be consistent across testsuite modes (remote/embedded). So +1 to @shawkins to add this to embedded too. |
|
Thank you everyone for the insightful discussion. Could the team decide to centralize this configuration (e.g., within AbstractKeycloakServerSupplier as referenced), or if there are further changes required to ensure alignment across all test scenarios, I am happy to implement these improvements. Please let me know if you would prefer that I make these updates within this PR, or if it would be better to address them in a subsequent PR. Thanks again for your thorough review and the collaborative discussion. cc: @ahus1 , @pruivo , @ryanemerson , @shawkins , @vmuzikar |
Closes #46337
Approach 1:
Added --shutdown-delay=0s", "--shutdown-timeout=1s"
Tested eg: $ time mvn clean test -Dtest=UpdateCommandDistTest
Before changes output:
real 1m57.160s
user 12m21.342s
sys 0m34.469s
After changes output:
real 0m43.130s
user 3m2.158s
sys 0m5.901s
Approach 2:
Added the Added --shutdown-delay=0s", "--shutdown-timeout=1s" implicitly instead of the default options.