Skip to content

Commit

Permalink
[Windows] Stabilizing QuarkusPropertiesDistTest
Browse files Browse the repository at this point in the history
Closes: keycloak#35496

Signed-off-by: Peter Zaoral <[email protected]>
  • Loading branch information
Pepo48 committed Dec 4, 2024
1 parent a1f5234 commit c978e59
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.condition.DisabledOnOs;
Expand All @@ -44,6 +45,7 @@

@DistributionTest(reInstall = DistributionTest.ReInstall.NEVER)
@RawDistOnly(reason = "Containers are immutable")
@Tag(DistributionTest.WIN)
@TestMethodOrder(OrderAnnotation.class)
public class QuarkusPropertiesDistTest {

Expand All @@ -68,19 +70,38 @@ void testPropertyEnabledAtRuntime(CLIResult cliResult) {

@Test
@Launch({"-Dquarkus.log.handler.console.\"console-2\".enable=false", "start", "--http-enabled=true", "--hostname-strict=false"})
@DisabledOnOs(value = { OS.WINDOWS })
@Order(3)
void testIgnoreQuarkusSystemPropertiesAtStart(CLIResult cliResult) {
cliResult.assertMessage("Keycloak is the best");
}

@Test
@Launch({"-Dquarkus.log.handler.console.\\\"console-2\\\".enable=false", "start", "--http-enabled=true", "--hostname-strict=false"})
@DisabledOnOs(value = { OS.LINUX, OS.MAC }, disabledReason = "Different handling of quotes within arguments on Windows")
@Order(3)
void testIgnoreQuarkusSystemPropertiesAtStartWin(CLIResult cliResult) {
cliResult.assertMessage("Keycloak is the best");
}

@Test
@Launch({"-Dquarkus.log.handler.console.\"console-2\".enable=false", "build"})
@DisabledOnOs(value = { OS.WINDOWS })
@Order(4)
void testIgnoreQuarkusSystemPropertyAtBuild(CLIResult cliResult) {
cliResult.assertMessage("Keycloak is the best");
cliResult.assertBuild();
}

@Test
@Launch({"-Dquarkus.log.handler.console.\\\"console-2\\\".enable=false", "build"})
@DisabledOnOs(value = { OS.LINUX, OS.MAC }, disabledReason = "Different handling of quotes within arguments on Windows")
@Order(4)
void testIgnoreQuarkusSystemPropertyAtBuildWin(CLIResult cliResult) {
cliResult.assertMessage("Keycloak is the best");
cliResult.assertBuild();
}

@DryRun
@Test
@BeforeStartDistribution(UpdateConsoleHandlerFromKeycloakConf.class)
Expand Down Expand Up @@ -145,11 +166,21 @@ void testMissingSmallRyeKeyStorePathProperty(CLIResult cliResult) {
@Test
@Launch({ "start", "--http-enabled=true", "--hostname-strict=false", "--config-keystore=/invalid/path",
"--config-keystore-password=secret" })
@DisabledOnOs(value = { OS.WINDOWS })
@Order(11)
void testInvalidSmallRyeKeyStorePathProperty(CLIResult cliResult) {
cliResult.assertError("java.lang.IllegalArgumentException: config-keystore path does not exist: /invalid/path");
}

@Test
@Launch({ "start", "--http-enabled=true", "--hostname-strict=false", "--config-keystore=/invalid/path",
"--config-keystore-password=secret" })
@DisabledOnOs(value = { OS.LINUX, OS.MAC }, disabledReason = "Windows uses a different path separator.")
@Order(11)
void testInvalidSmallRyeKeyStorePathPropertyWin(CLIResult cliResult) {
cliResult.assertError("java.lang.IllegalArgumentException: config-keystore path does not exist: C:\\invalid\\path");
}

@Test
@Launch({ "start", "--http-enabled=true", "--hostname-strict=false",
"--config-keystore=../../../../src/test/resources/keystore", "--config-keystore-password=secret" })
Expand Down

0 comments on commit c978e59

Please sign in to comment.