De-randomize message tests to minimize flakiness.

This commit is contained in:
Jon Chambers 2020-07-14 18:09:16 -04:00 committed by Jon Chambers
parent b9b6e1818f
commit 247d869a5c
1 changed files with 4 additions and 2 deletions

View File

@ -34,6 +34,8 @@ public class MessagesTest {
private Messages messages; private Messages messages;
private long serialTimestamp = 0;
@Before @Before
public void setupAccountsDao() { public void setupAccountsDao() {
this.messages = new Messages(new FaultTolerantDatabase("messages-test", Jdbi.create(db.getTestDatabase()), new CircuitBreakerConfiguration())); this.messages = new Messages(new FaultTolerantDatabase("messages-test", Jdbi.create(db.getTestDatabase()), new CircuitBreakerConfiguration()));
@ -233,8 +235,8 @@ public class MessagesTest {
return Envelope.newBuilder() return Envelope.newBuilder()
.setSourceDevice(random.nextInt(10000)) .setSourceDevice(random.nextInt(10000))
.setSource("testSource" + random.nextInt()) .setSource("testSource" + random.nextInt())
.setTimestamp(random.nextInt(100000)) .setTimestamp(serialTimestamp++)
.setServerTimestamp(random.nextInt(100000)) .setServerTimestamp(serialTimestamp++)
.setLegacyMessage(ByteString.copyFrom(legacy)) .setLegacyMessage(ByteString.copyFrom(legacy))
.setContent(ByteString.copyFrom(content)) .setContent(ByteString.copyFrom(content))
.setType(Envelope.Type.CIPHERTEXT) .setType(Envelope.Type.CIPHERTEXT)