From 7adcbee5adb9848de19887b70b6e5478c76b64e3 Mon Sep 17 00:00:00 2001 From: Weimin Yu Date: Tue, 29 Jun 2021 17:12:02 -0400 Subject: [PATCH] Retry flaky tests for ReplicateToDatastoreAction (#1226) * Retry flaky tests for ReplicateToDatastoreAction The occassional failures seem to be caused by the test Datastore. --- .../schema/replay/ReplicateToDatastoreActionTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/test/java/google/registry/schema/replay/ReplicateToDatastoreActionTest.java b/core/src/test/java/google/registry/schema/replay/ReplicateToDatastoreActionTest.java index e83e4c7ff..e24e5cee8 100644 --- a/core/src/test/java/google/registry/schema/replay/ReplicateToDatastoreActionTest.java +++ b/core/src/test/java/google/registry/schema/replay/ReplicateToDatastoreActionTest.java @@ -46,6 +46,7 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import org.junitpioneer.jupiter.RetryingTest; public class ReplicateToDatastoreActionTest { @@ -97,7 +98,7 @@ public class ReplicateToDatastoreActionTest { RegistryConfig.overrideCloudSqlReplicateTransactions(false); } - @Test + @RetryingTest(4) public void testReplication() { TestEntity foo = new TestEntity("foo"); TestEntity bar = new TestEntity("bar"); @@ -127,7 +128,7 @@ public class ReplicateToDatastoreActionTest { assertThat(ofyTm().transact(() -> ofyTm().loadByKey(baz.key()))).isEqualTo(baz); } - @Test + @RetryingTest(4) public void testReplayFromLastTxn() { TestEntity foo = new TestEntity("foo"); TestEntity bar = new TestEntity("bar"); @@ -149,7 +150,7 @@ public class ReplicateToDatastoreActionTest { assertThat(ofyTm().transact(() -> ofyTm().loadByKeyIfPresent(foo.key()).isPresent())).isFalse(); } - @Test + @RetryingTest(4) public void testUnintentionalConcurrency() { TestEntity foo = new TestEntity("foo"); TestEntity bar = new TestEntity("bar"); @@ -184,7 +185,7 @@ public class ReplicateToDatastoreActionTest { Level.WARNING, "Ignoring transaction 1, which appears to have already been applied."); } - @Test + @RetryingTest(4) public void testMissingTransactions() { // Write a transaction (should have a transaction id of 1). TestEntity foo = new TestEntity("foo");