Add IsIntegrationTest BuildStep Annotation

This commit is contained in:
Dominik Guhr 2021-12-14 11:02:44 +01:00 committed by Pedro Igor
parent dad5639b4e
commit c70dc0e72d
5 changed files with 24 additions and 14 deletions

View file

@ -0,0 +1,19 @@
package org.keycloak.quarkus.deployment;
import io.quarkus.deployment.IsTest;
import io.quarkus.runtime.LaunchMode;
import static org.keycloak.quarkus.runtime.Environment.LAUNCH_MODE;
public class IsIntegrationTest extends IsTest {
public IsIntegrationTest(LaunchMode launchMode) {
super(launchMode);
}
@Override
public boolean getAsBoolean() {
return super.getAsBoolean() && (System.getProperty(LAUNCH_MODE) != null && System.getProperty(LAUNCH_MODE).equals("test"));
}
}

View file

@ -20,7 +20,7 @@ package org.keycloak.quarkus.deployment;
import java.util.function.BooleanSupplier;
import org.keycloak.quarkus.runtime.Environment;
public class isReAugmentation implements BooleanSupplier {
public class IsReAugmentation implements BooleanSupplier {
@Override
public boolean getAsBoolean() {

View file

@ -267,12 +267,12 @@ class KeycloakProcessor {
*
* @param configSources
*/
@BuildStep(onlyIf = IsNormal.class)
@BuildStep(onlyIfNot = IsIntegrationTest.class )
void configureConfigSources(BuildProducer<StaticInitConfigSourceProviderBuildItem> configSources) {
configSources.produce(new StaticInitConfigSourceProviderBuildItem(KeycloakConfigSourceProvider.class.getName()));
}
@BuildStep(onlyIf = IsTest.class)
@BuildStep(onlyIf = IsIntegrationTest.class)
void prepareTestEnvironment(BuildProducer<StaticInitConfigSourceProviderBuildItem> configSources) {
configSources.produce(new StaticInitConfigSourceProviderBuildItem("org.keycloak.quarkus.runtime.configuration.test.TestKeycloakConfigSourceProvider"));
}
@ -281,7 +281,7 @@ class KeycloakProcessor {
* <p>Make the build time configuration available at runtime so that the server can run without having to specify some of
* the properties again.
*/
@BuildStep(onlyIf = isReAugmentation.class)
@BuildStep(onlyIf = IsReAugmentation.class)
void persistBuildTimeProperties(BuildProducer<GeneratedResourceBuildItem> resources) {
Properties properties = new Properties();

View file

@ -52,13 +52,4 @@ public class KeycloakReadyHealthCheckTest {
.statusCode(200)
.body(Matchers.containsString("UP"));
}
@Test
@Disabled // Temporarily disabled. See KEYCLOAK-16382 and https://github.com/quarkusio/quarkus/issues/14705
public void testMetricsUp() {
given()
.when().get("/metrics")
.then()
.statusCode(200);
}
}

View file

@ -46,4 +46,4 @@ public class TestKeycloakConfigSourceProvider extends KeycloakConfigSourceProvid
}
}).collect(Collectors.toList());
}
}
}