Skip to content

Commit

Permalink
#2882: fix flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattia Brescia committed Jun 5, 2024
1 parent 4536837 commit 64987f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.mockito.*;
import org.springframework.jdbc.core.JdbcTemplate;

public class PgFactStreamTelemetryTest {
class PgFactStreamTelemetryTest {
@Mock JdbcTemplate jdbcTemplate;
@Mock EventBus eventBus;
@Mock PgFactIdToSerialMapper idToSerMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.waitAtMost;
import static org.mockito.Mockito.spy;

import com.google.common.collect.Lists;
import com.google.common.eventbus.Subscribe;
Expand Down Expand Up @@ -46,7 +45,7 @@
@Sql(scripts = "/wipe.sql", config = @SqlConfig(separator = "#"))
@ExtendWith(SpringExtension.class)
@IntegrationTest
public class PgStoreTelemetryIntegrationTest {
class PgStoreTelemetryIntegrationTest {

@Autowired FactStore store;

Expand All @@ -56,7 +55,7 @@ public class PgStoreTelemetryIntegrationTest {

@BeforeEach
void setUp() {
uut = spy(FactCast.from(store));
uut = FactCast.from(store);
}

@Test
Expand All @@ -66,7 +65,7 @@ void publishesTelemetryOnCatchup() {
SubscriptionRequest.catchup(FactSpec.ns("foo").aggId(UUID.randomUUID())).fromScratch();
var telemetryListener = new TelemetryListener(request);

try (Subscription ignored = uut.subscribe(request, f -> {}).awaitComplete(1000)) {
try (Subscription ignored = uut.subscribe(request, f -> {}).awaitComplete(5000)) {
// wait until complete is consumed
waitAtMost(Duration.ofSeconds(5)).until(() -> telemetryListener.completed);
}
Expand Down Expand Up @@ -94,7 +93,7 @@ void publishesTelemetryOnFollow() {
SubscriptionRequest.follow(FactSpec.ns("foo").aggId(UUID.randomUUID())).fromScratch();
var telemetryListener = new TelemetryListener(request);

try (Subscription ignored = uut.subscribe(request, f -> {}).awaitCatchup(1000)) {
try (Subscription ignored = uut.subscribe(request, f -> {}).awaitCatchup(5000)) {
// wait until follow is consumed
waitAtMost(Duration.ofSeconds(5)).until(() -> telemetryListener.following);
}
Expand Down

0 comments on commit 64987f4

Please sign in to comment.