Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kagkarlsson committed Nov 14, 2020
1 parent e04584b commit 72fa354
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTimeout;
import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;


@SuppressWarnings("ConstantConditions")
Expand Down Expand Up @@ -82,6 +83,7 @@ public void setUp() {
.heartbeatInterval(Duration.ofMillis(100))
.schedulerName(new SchedulerName.Fixed("test"))
.statsRegistry(testableRegistry)
.commitWhenAutocommitDisabled(commitWhenAutocommitDisabled())
.build();
stopScheduler.register(scheduler);
}
Expand All @@ -95,7 +97,7 @@ public void clearTables() {

@Test
public void test_compatibility() {
assertTimeout(Duration.ofSeconds(10), () -> {
assertTimeoutPreemptively(Duration.ofSeconds(10), () -> {
scheduler.schedule(oneTime.instance("id1"), Instant.now());
scheduler.schedule(oneTime.instance("id1"), Instant.now()); //duplicate
scheduler.schedule(recurring.instance("id1"), Instant.now());
Expand All @@ -116,14 +118,14 @@ public void test_compatibility() {

@Test
public void test_jdbc_repository_compatibility() {
assertTimeout(Duration.ofSeconds(20), () -> {
assertTimeoutPreemptively(Duration.ofSeconds(20), () -> {
doJDBCRepositoryCompatibilityTestUsingData(null);
});
}

@Test
public void test_jdbc_repository_compatibility_with_data() {
assertTimeout(Duration.ofSeconds(20), () -> {
assertTimeoutPreemptively(Duration.ofSeconds(20), () -> {
doJDBCRepositoryCompatibilityTestUsingData("my data");
});
}
Expand Down Expand Up @@ -192,15 +194,4 @@ public void test_jdbc_repository_compatibility_set_data() {
Execution round3 = jdbcTaskRepository.getExecution(taskInstance).get();
assertNull(round3.taskInstance.getData());
}


private void sleep(Duration duration) {
try {
Thread.sleep(duration.toMillis());
} catch (InterruptedException e) {
LoggerFactory.getLogger(CompatibilityTest.class).info("Interrupted");
}
}


}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>1.14.2</version>
<version>1.15.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down

0 comments on commit 72fa354

Please sign in to comment.