From a16597bb6d9cea8a45a471ce60cb61867d613694 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Fri, 15 Dec 2023 17:33:02 +0100 Subject: [PATCH] Migrate trino-prometheus off TestNG assertions --- plugin/trino-prometheus/pom.xml | 6 ------ .../trino/plugin/prometheus/TestPrometheusIntegration.java | 4 +--- .../io/trino/plugin/prometheus/TestPrometheusSplit.java | 4 ++-- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/plugin/trino-prometheus/pom.xml b/plugin/trino-prometheus/pom.xml index 4e5a7ccd6a31..2b33f26c168d 100644 --- a/plugin/trino-prometheus/pom.xml +++ b/plugin/trino-prometheus/pom.xml @@ -257,11 +257,5 @@ testcontainers test - - - org.testng - testng - test - diff --git a/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/TestPrometheusIntegration.java b/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/TestPrometheusIntegration.java index 9e771bb78791..0fae916c36e5 100644 --- a/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/TestPrometheusIntegration.java +++ b/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/TestPrometheusIntegration.java @@ -30,7 +30,6 @@ import static java.util.concurrent.TimeUnit.DAYS; import static java.util.concurrent.TimeUnit.SECONDS; import static org.assertj.core.api.Assertions.assertThat; -import static org.testng.Assert.assertEquals; public class TestPrometheusIntegration extends AbstractTestQueryFramework @@ -129,7 +128,6 @@ public void testCorrectNumberOfSplitsCreated() (DynamicFilter) null, Constraint.alwaysTrue()); int numSplits = splits.getNextBatch(NUMBER_MORE_THAN_EXPECTED_NUMBER_SPLITS).getNow(null).getSplits().size(); - assertEquals(numSplits, config.getMaxQueryRangeDuration().getValue(TimeUnit.SECONDS) / config.getQueryChunkSizeDuration().getValue(TimeUnit.SECONDS), - 0.001); + assertThat((double) numSplits).isEqualTo(config.getMaxQueryRangeDuration().getValue(TimeUnit.SECONDS) / config.getQueryChunkSizeDuration().getValue(TimeUnit.SECONDS)); } } diff --git a/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/TestPrometheusSplit.java b/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/TestPrometheusSplit.java index dc156c3fe056..4ac86b8a344e 100644 --- a/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/TestPrometheusSplit.java +++ b/plugin/trino-prometheus/src/test/java/io/trino/plugin/prometheus/TestPrometheusSplit.java @@ -62,9 +62,9 @@ import static java.util.concurrent.TimeUnit.SECONDS; import static org.apache.http.client.utils.URLEncodedUtils.parse; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.data.Offset.offset; import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; -import static org.testng.Assert.assertEquals; @TestInstance(PER_CLASS) @Execution(CONCURRENT) @@ -210,7 +210,7 @@ public void testQueryDividedIntoSplitsShouldHaveCorrectSpacingBetweenTimes() assertThat(paramsMap1).containsEntry("query", "up[1d]"); assertThat(paramsMap2).containsEntry("query", "up[1d]"); long diff = Double.valueOf(paramsMap2.get("time")).longValue() - Double.valueOf(paramsMap1.get("time")).longValue(); - assertEquals(config.getQueryChunkSizeDuration().getValue(TimeUnit.SECONDS), diff, 0.0001); + assertThat(config.getQueryChunkSizeDuration().getValue(TimeUnit.SECONDS)).isCloseTo(diff, offset(0.0001)); } @Test