Skip to content

Commit

Permalink
Migrate trino-prometheus off TestNG assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Dec 18, 2023
1 parent 3142333 commit a16597b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
6 changes: 0 additions & 6 deletions plugin/trino-prometheus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,5 @@
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a16597b

Please sign in to comment.