Committed transactions involve also a purge payload, which is persisted
asynchronously, hence it may or may not be visible in the journal just
after the transaction is reported as committed. Wait for two heartbeat
intervals before looking at the stats.
Change-Id: Ibe699edced12d006bf5ea8cd99aa821ab56d115d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
private static final AtomicInteger NEXT_SHARD_NUM = new AtomicInteger();
+ protected static final int HEARTBEAT_MILLIS = 100;
+
protected final ShardIdentifier shardID = ShardIdentifier.create("inventory", MemberName.forName("member-1"),
"config" + NEXT_SHARD_NUM.getAndIncrement());
protected final Builder dataStoreContextBuilder = DatastoreContext.newBuilder()
- .shardJournalRecoveryLogBatchSize(3).shardSnapshotBatchCount(5000).shardHeartbeatIntervalInMillis(100);
+ .shardJournalRecoveryLogBatchSize(3).shardSnapshotBatchCount(5000)
+ .shardHeartbeatIntervalInMillis(HEARTBEAT_MILLIS);
protected final TestActorFactory actorFactory = new TestActorFactory(getSystem());
inOrder.verify(dataTree).prepare(any(DataTreeModification.class));
inOrder.verify(dataTree).commit(any(DataTreeCandidate.class));
+ // Purge request is scheduled as asynchronous, wait for two heartbeats to let it propagate into
+ // the journal
+ Thread.sleep(HEARTBEAT_MILLIS * 2);
+
shard.tell(Shard.GET_SHARD_MBEAN_MESSAGE, getRef());
final ShardStats shardStats = expectMsgClass(duration, ShardStats.class);