[Windows] Stabilizing QuarkusPropertiesDistTest (#35636)

Closes: #35496

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
This commit is contained in:
Peter Zaoral 2024-12-06 13:46:03 +01:00 committed by GitHub
parent 5c901016e7
commit e05bd40d92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,9 +22,11 @@ import io.restassured.RestAssured;
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;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.keycloak.it.junit5.extension.BeforeStartDistribution;
import org.keycloak.it.junit5.extension.CLIResult;
@ -44,6 +46,7 @@ import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTI
@DistributionTest(reInstall = DistributionTest.ReInstall.NEVER)
@RawDistOnly(reason = "Containers are immutable")
@Tag(DistributionTest.WIN)
@TestMethodOrder(OrderAnnotation.class)
public class QuarkusPropertiesDistTest {
@ -68,19 +71,38 @@ public class QuarkusPropertiesDistTest {
@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"})
@EnabledOnOs(value = { OS.WINDOWS }, 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"})
@EnabledOnOs(value = { OS.WINDOWS }, 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)
@ -145,11 +167,21 @@ public class QuarkusPropertiesDistTest {
@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=C:\\invalid\\path",
"--config-keystore-password=secret" })
@EnabledOnOs(value = { OS.WINDOWS }, 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" })
@ -173,7 +205,7 @@ public class QuarkusPropertiesDistTest {
@Test
@BeforeStartDistribution(ForceRebuild.class)
@DisabledOnOs(value = { OS.LINUX, OS.MAC }, disabledReason = "Windows uses a different path separator.")
@EnabledOnOs(value = { OS.WINDOWS }, disabledReason = "Windows uses a different path separator.")
@Launch({ "start", "--http-enabled=true", "--hostname-strict=false",
"--https-certificate-file=C:\\tmp\\kc\\bin\\..\\conf/server.crt.pem",
"--https-certificate-key-file=C:\\tmp\\kc\\bin\\..\\conf/server.key.pem" })