diff --git a/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/PrometheusQueryRunner.java b/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/PrometheusQueryRunner.java index 7477e3f81830..f5a22df13d03 100644 --- a/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/PrometheusQueryRunner.java +++ b/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/PrometheusQueryRunner.java @@ -33,12 +33,12 @@ public final class PrometheusQueryRunner { private PrometheusQueryRunner() {} - public static DistributedQueryRunner createPrometheusQueryRunner(PrometheusServer server) + public static DistributedQueryRunner createPrometheusQueryRunner(PrometheusServer server, Map extraProperties) throws Exception { DistributedQueryRunner queryRunner = null; try { - queryRunner = DistributedQueryRunner.builder(createSession()).build(); + queryRunner = DistributedQueryRunner.builder(createSession()).setExtraProperties(extraProperties).build(); queryRunner.installPlugin(new PrometheusPlugin()); Map properties = ImmutableMap.of( @@ -75,7 +75,7 @@ public static void main(String[] args) throws Exception { Logging.initialize(); - DistributedQueryRunner queryRunner = createPrometheusQueryRunner(new PrometheusServer()); + DistributedQueryRunner queryRunner = createPrometheusQueryRunner(new PrometheusServer(), ImmutableMap.of("http-server.http.port", "8080")); Thread.sleep(10); Logger log = Logger.get(PrometheusQueryRunner.class); log.info("======== SERVER STARTED ========"); diff --git a/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/TestPrometheusIntegrationStatus.java b/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/TestPrometheusIntegrationStatus.java index f6625457f5ef..3d5c886f8447 100644 --- a/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/TestPrometheusIntegrationStatus.java +++ b/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/TestPrometheusIntegrationStatus.java @@ -13,6 +13,7 @@ */ package io.trino.plugin.prometheus; +import com.google.common.collect.ImmutableMap; import io.airlift.log.Logger; import io.trino.testing.AbstractTestQueryFramework; import io.trino.testing.MaterializedResult; @@ -26,6 +27,7 @@ import java.util.concurrent.TimeUnit; import static io.trino.plugin.prometheus.PrometheusQueryRunner.createPrometheusQueryRunner; +import static org.assertj.core.api.Assertions.assertThat; import static org.testng.Assert.assertEquals; import static org.testng.Assert.fail; @@ -43,7 +45,7 @@ protected QueryRunner createQueryRunner() throws Exception { this.server = new PrometheusServer(); - return createPrometheusQueryRunner(server); + return createPrometheusQueryRunner(server, ImmutableMap.of()); } @Test @@ -100,8 +102,8 @@ public void testConfirmMetricAvailableAndCheckUp() @Test public void testPushDown() { - // default interval on the `up` metric that Prometheus records on itself is 15 seconds, so this should only yield one row + // default interval on the `up` metric that Prometheus records on itself is about 15 seconds, so this should only yield one or two row MaterializedResult results = computeActual("SELECT * FROM prometheus.default.up WHERE timestamp > (NOW() - INTERVAL '15' SECOND)"); - assertEquals(results.getRowCount(), 1); + assertThat(results).hasSizeBetween(1, 2); } }