Enhance StartDevCommandDistTest to detect problems with URI scheme on Windows (#29593)

* added a test - a Windows drive letter within URI can cause issues

Related-to: #29329

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
This commit is contained in:
Peter Zaoral 2024-05-22 19:19:57 +02:00 committed by GitHub
parent f103d595f6
commit bb1284704d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,9 +22,16 @@ import io.quarkus.test.junit.main.LaunchResult;
import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.keycloak.it.junit5.extension.CLIResult; import org.keycloak.it.junit5.extension.CLIResult;
import org.keycloak.it.junit5.extension.DistributionTest; import org.keycloak.it.junit5.extension.DistributionTest;
import org.keycloak.it.junit5.extension.RawDistOnly; import org.keycloak.it.junit5.extension.RawDistOnly;
import org.keycloak.it.utils.KeycloakDistribution;
import java.nio.file.Paths;
import static org.junit.jupiter.api.Assertions.assertTrue;
@DistributionTest @DistributionTest
@RawDistOnly(reason = "Containers are immutable") @RawDistOnly(reason = "Containers are immutable")
@ -68,4 +75,15 @@ public class StartDevCommandDistTest {
cliResult.assertStartedDevMode(); cliResult.assertStartedDevMode();
} }
@Test
@DisabledOnOs(value = { OS.LINUX, OS.MAC }, disabledReason = "A drive letter in URI can cause a problem.")
void testConfigKeystoreAbsolutePath(KeycloakDistribution dist) {
CLIResult cliResult = dist.run("start-dev", "--config-keystore=" + Paths.get("src/test/resources/keystore").toAbsolutePath().normalize(),
"--config-keystore-password=secret");
assertTrue(cliResult.getOutput().contains("DEBUG [org.hibernate"));
assertTrue(cliResult.getOutput().contains("DEBUG [org.keycloak"));
assertTrue(cliResult.getOutput().contains("Listening on:"));
cliResult.assertStartedDevMode();
}
} }