Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
[PAN-2871] Intermittent Test Failures in TransactionsMessageSenderTest (
Browse files Browse the repository at this point in the history
#1653)

Add tolerance delta in test. Generated transaction data sizes are sometimes differents, the number of transactions in each batch may vary a bit, the tolerance delta helps dealing with such cases.
The most important thing in this test is the assertion verifying that the union of all batches equals to the original list of messages to send.
  • Loading branch information
AbdelStark authored Jul 8, 2019
1 parent 5001528 commit edf36df
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,13 @@ public void shouldSendTransactionsInBatchesWithLimit() throws Exception {
final Set<Transaction> firstBatch = getTransactionsFromMessage(sentMessages.get(0));
final Set<Transaction> secondBatch = getTransactionsFromMessage(sentMessages.get(1));

assertThat(firstBatch).hasSize(5219);
assertThat(secondBatch).hasSize(781);
final int expectedFirstBatchSize = 5219, expectedSecondBatchSize = 781, toleranceDelta = 50;
assertThat(firstBatch)
.hasSizeBetween(
expectedFirstBatchSize - toleranceDelta, expectedFirstBatchSize + toleranceDelta);
assertThat(secondBatch)
.hasSizeBetween(
expectedSecondBatchSize - toleranceDelta, expectedSecondBatchSize + toleranceDelta);

assertThat(Sets.union(firstBatch, secondBatch)).isEqualTo(transactions);
}
Expand Down

0 comments on commit edf36df

Please sign in to comment.