Repository navigation
Closed
Labels
area/testsuiteTest suites — flaky/failing tests, CI test config, test migrationTest suites — flaky/failing tests, CI test config, test migrationhelp wantedkind/bugCategorizes a PR related to a bugCategorizes a PR related to a bugpriority/normalrelease/26.3.0status/auto-bumpstatus/auto-expireteam/cloud-native
Description
Before reporting an issue
- I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.
Area
testsuite
Describe the bug
When making a distribution run with non-zero exit in the testsuite the RawKeycloakDistribution does not provide correct exit code.
Version
main
Regression
- The issue is a regression
Expected behavior
When running this distribution run:
keycloak/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/UpdateCommandDistTest.java
Line 96 in 3c0fc83
| var result = distribution.run(UpdateCompatibility.NAME, UpdateCompatibilityCheck.NAME, UpdateCompatibilityCheck.INPUT_OPTION_NAME, jsonFile.getAbsolutePath(), ENABLE_FEATURE); |
the expected call to result.exitCode() should return non-zero exit code.
Actual behavior
The run return 0.
How to Reproduce?
Run the following test in debug mode:
keycloak/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/UpdateCommandDistTest.java
Lines 87 to 107 in 3c0fc83
| public void testWrongVersions(KeycloakDistribution distribution) throws IOException { | |
| var jsonFile = createTempFile("wrong-versions"); | |
| // incompatible keycloak version | |
| var info = new ServerInfo(); | |
| info.setVersions(Map.of(CompatibilityManagerImpl.KEYCLOAK_VERSION_KEY, "0.0.0.Final", | |
| CompatibilityManagerImpl.INFINISPAN_VERSION_KEY, org.infinispan.commons.util.Version.getVersion())); | |
| JsonSerialization.mapper.writeValue(jsonFile, info); | |
| var result = distribution.run(UpdateCompatibility.NAME, UpdateCompatibilityCheck.NAME, UpdateCompatibilityCheck.INPUT_OPTION_NAME, jsonFile.getAbsolutePath(), ENABLE_FEATURE); | |
| result.assertError("[Versions] Rolling Upgrade is not available. 'keycloak' is incompatible: Old=0.0.0.Final, New=%s".formatted(Version.VERSION)); | |
| // incompatible infinispan version | |
| info.setVersions(Map.of( | |
| CompatibilityManagerImpl.KEYCLOAK_VERSION_KEY, Version.VERSION, | |
| CompatibilityManagerImpl.INFINISPAN_VERSION_KEY, "0.0.0.Final")); | |
| JsonSerialization.mapper.writeValue(jsonFile, info); | |
| result = distribution.run(UpdateCompatibility.NAME, UpdateCompatibilityCheck.NAME, UpdateCompatibilityCheck.INPUT_OPTION_NAME, jsonFile.getAbsolutePath(), ENABLE_FEATURE); | |
| result.assertError("[Versions] Rolling Upgrade is not available. 'infinispan' is incompatible: Old=0.0.0.Final, New=%s".formatted(org.infinispan.commons.util.Version.getVersion())); | |
| } |
The result on line 96 should have non-zero exit code, however, the exit code is 0.
Anything else?
No response
Reacted by keycloak-github-bot
Metadata
Metadata
Assignees
Labels
area/testsuiteTest suites — flaky/failing tests, CI test config, test migrationTest suites — flaky/failing tests, CI test config, test migrationhelp wantedkind/bugCategorizes a PR related to a bugCategorizes a PR related to a bugpriority/normalrelease/26.3.0status/auto-bumpstatus/auto-expireteam/cloud-native
Type
Fields
No fields configured for issues without a type.
Activity
shawkins commentedon Apr 3, 2025
There are actually 3 issues highlighted here:
Finally, and worst of all, is that the use of eval in the bash script is squashing the exit code. Even if we address the above, the test will see an exit code of -1 / 255. Any upgrade logic in the operator currently relying upon non-zero exit codes won't work correctly.- nevermind, this seems to only be happening in the RawKeycloakDistribution. It works as expected from a shell. The problem was that I had initially updated the test to use manual stopping to workaround the launch mode issue, but that causes the exit code to always be -1cc @vmuzikar @pruivo
keycloak-github-bot commentedon Apr 3, 2025
Due to the amount of issues reported by the community we are not able to prioritise resolving this issue at the moment.
If you are affected by this issue, upvote it by adding a 👍 to the description. We would also welcome a contribution to fix the issue.
fix: ensuring exit codes are handled consistently (#38661)