Skip to content

Commit

Permalink
merge: #10621
Browse files Browse the repository at this point in the history
10621: test(qa): add logs to help debug flaky test r=oleschoenburg a=deepthidevaki

## Description

To help debug #8669, I added a few extra logging to the test. 

Co-authored-by: Deepthi Devaki Akkoorath <deepthidevaki@gmail.com>
  • Loading branch information
zeebe-bors-camunda[bot] and deepthidevaki committed Oct 7, 2022
2 parents 622417f + f685bc2 commit c891576
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.unit.DataSize;

@RunWith(Parameterized.class)
public class ClusteredSnapshotTest {

public static final Logger LOG = LoggerFactory.getLogger("ClusteredSnapshotTest");
private static final Duration SNAPSHOT_INTERVAL = Duration.ofMinutes(5);

@Rule
Expand All @@ -59,11 +62,19 @@ public class ClusteredSnapshotTest {
public static Object[][] snapshotTriggers() {
return new Object[][] {
new Object[] {
(Consumer<ClusteringRule>) ClusteringRule::triggerAndWaitForSnapshots,
(Consumer<ClusteringRule>)
(rule) -> {
LOG.info("Triggerring snapshots using admin api");
rule.triggerAndWaitForSnapshots();
},
"explicit trigger snapshot"
},
new Object[] {
(Consumer<ClusteringRule>) (rule) -> rule.getClock().addTime(SNAPSHOT_INTERVAL),
(Consumer<ClusteringRule>)
(rule) -> {
LOG.info("Increasing clock by snapshot interval {}", SNAPSHOT_INTERVAL);
rule.getClock().addTime(SNAPSHOT_INTERVAL);
},
"implicit snapshot by advancing the clock"
}
};
Expand Down Expand Up @@ -177,6 +188,8 @@ public void shouldKeepIndexAndTerm() {
clusteringRule.getTopologyFromClient().getBrokers().stream()
.collect(Collectors.toMap(BrokerInfo::getNodeId, this::getSnapshot));

LOG.info("Snapshots before configuring exporters {}", snapshotsByBroker);

// when
configureExporters();
restartCluster();
Expand All @@ -191,7 +204,8 @@ public void shouldKeepIndexAndTerm() {
assertThat(broker)
.havingSnapshot()
.withIndex(expectedSnapshot.getIndex())
.withTerm(expectedSnapshot.getTerm());
.withTerm(expectedSnapshot.getTerm())
.withExportedPosition(0);
});
}

Expand Down Expand Up @@ -367,10 +381,10 @@ protected BrokerAssert(final Broker actual, final ClusteringRule rule) {

public SnapshotAssert havingSnapshot() {
final var snapshot = rule.getSnapshot(actual);
Assertions.assertThat(snapshot.isPresent())
Assertions.assertThat(snapshot)
.withFailMessage("No snapshot exists for broker <%s>", actual)
.isTrue();
return new SnapshotAssert(snapshot.get());
.isPresent();
return new SnapshotAssert(snapshot.orElseThrow());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ public Statement apply(final Statement base, final Description description) {

@Override
protected void before() throws IOException {
LOG.debug("Starting ClusteringRule...");
partitionLatch = new CountDownLatch(partitionCount);
// create brokers
for (int nodeId = 0; nodeId < clusterSize; nodeId++) {
Expand Down

0 comments on commit c891576

Please sign in to comment.