Skip to content

Commit

Permalink
Fix IT / native test(s), add it to native-tests run
Browse files Browse the repository at this point in the history
  • Loading branch information
alesj committed Oct 29, 2024
1 parent 123ea8e commit 9db4081
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/native-tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
{
"category": "Misc4",
"timeout": 130,
"test-modules": "picocli-native, gradle, micrometer-mp-metrics, micrometer-prometheus, logging-json, jaxp, jaxb, opentelemetry, opentelemetry-jdbc-instrumentation, opentelemetry-mongodb-client-instrumentation, opentelemetry-redis-instrumentation, web-dependency-locator",
"test-modules": "picocli-native, gradle, micrometer-mp-metrics, micrometer-prometheus, logging-json, jaxp, jaxb, observability-lgtm, opentelemetry, opentelemetry-jdbc-instrumentation, opentelemetry-mongodb-client-instrumentation, opentelemetry-redis-instrumentation, web-dependency-locator",
"os-name": "ubuntu-latest"
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.quarkus.observability.test;

import org.eclipse.microprofile.config.inject.ConfigProperty;

public abstract class LgtmConfigTestBase extends LgtmTestBase {

@ConfigProperty(name = "grafana.endpoint")
String endpoint;

@Override
protected String grafanaEndpoint() {
return endpoint;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@QuarkusTest
@TestProfile(LgtmGrpcTest.GrpcTestProfileOnly.class)
@DisabledOnOs(OS.WINDOWS)
public class LgtmGrpcTest extends LgtmTestBase {
public class LgtmGrpcTest extends LgtmConfigTestBase {

public static class GrpcTestProfileOnly implements QuarkusTestProfile {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@QuarkusTestResource(value = LgtmResource.class, restrictToAnnotatedClass = true)
@TestProfile(LgtmLifecycleTest.TestResourceTestProfileOff.class)
@DisabledOnOs(OS.WINDOWS)
public class LgtmLifecycleTest extends LgtmTestBase {
public class LgtmLifecycleTest extends LgtmConfigTestBase {

public static class TestResourceTestProfileOff implements QuarkusTestProfile {
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
package io.quarkus.observability.test;

import org.eclipse.microprofile.config.ConfigProvider;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import io.quarkus.test.junit.TestProfile;

@QuarkusIntegrationTest
@TestProfile(LgtmResourcesTest.DevResourcesTestProfileOnly.class)
@DisabledOnOs(OS.WINDOWS)
public class LgtmResourcesIT extends LgtmResourcesTest {
public class LgtmResourcesIT extends LgtmTestBase {
@Override
protected String grafanaEndpoint() {
return ConfigProvider.getConfig().getValue("grafana.endpoint", String.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@QuarkusTest
@TestProfile(LgtmResourcesTest.DevResourcesTestProfileOnly.class)
@DisabledOnOs(OS.WINDOWS)
public class LgtmResourcesTest extends LgtmTestBase {
public class LgtmResourcesTest extends LgtmConfigTestBase {

public static class DevResourcesTestProfileOnly implements QuarkusTestProfile {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

@QuarkusTest
@DisabledOnOs(OS.WINDOWS)
public class LgtmServicesTest extends LgtmTestBase {
public class LgtmServicesTest extends LgtmConfigTestBase {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.concurrent.TimeUnit;

import org.awaitility.Awaitility;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.jboss.logging.Logger;
import org.junit.jupiter.api.Test;

Expand All @@ -13,15 +12,14 @@
public abstract class LgtmTestBase {
private final Logger log = Logger.getLogger(getClass());

@ConfigProperty(name = "grafana.endpoint")
String endpoint;
protected abstract String grafanaEndpoint();

@Test
public void testTracing() {
log.info("Testing Grafana ...");
String response = RestAssured.get("/api/poke?f=100").body().asString();
log.info("Response: " + response);
GrafanaClient client = new GrafanaClient(endpoint, "admin", "admin");
GrafanaClient client = new GrafanaClient(grafanaEndpoint(), "admin", "admin");
Awaitility.await().atMost(61, TimeUnit.SECONDS).until(
client::user,
u -> "admin".equals(u.login));
Expand Down

0 comments on commit 9db4081

Please sign in to comment.