From 89fe53e3394196ed37529b07c73c811980138b51 Mon Sep 17 00:00:00 2001 From: Weimin Yu Date: Fri, 19 Mar 2021 12:38:54 -0400 Subject: [PATCH] Attempt to fix flakey deleteExpiredDomain test (#1022) * Attempt to fix flakey deleteExpiredDomain test Though hard to reproduce locally, the test_deletesThreeDomainsInOneRun test has failed multiple times on Kokoro. The root cause may be the non-transactional query executed by the Action object, which was by design. Observing that the other test never fails, this PR follows its behavior and adds a transactional query before invoking the action. --- .../google/registry/batch/DeleteExpiredDomainsActionTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/test/java/google/registry/batch/DeleteExpiredDomainsActionTest.java b/core/src/test/java/google/registry/batch/DeleteExpiredDomainsActionTest.java index d260821ec..625eaba28 100644 --- a/core/src/test/java/google/registry/batch/DeleteExpiredDomainsActionTest.java +++ b/core/src/test/java/google/registry/batch/DeleteExpiredDomainsActionTest.java @@ -126,6 +126,9 @@ class DeleteExpiredDomainsActionTest { DomainBase domain2 = persistNonAutorenewingDomain("veee2.tld"); DomainBase domain3 = persistNonAutorenewingDomain("tarm3.tld"); + // action.run() executes a non-transactional query by design but makes this test flaky. + // Executing a transaction here seems to force the test Datastore to become up to date. + assertThat(tm().loadByEntity(domain3).getStatusValues()).doesNotContain(PENDING_DELETE); action.run(); assertThat(tm().loadByEntity(domain1).getStatusValues()).contains(PENDING_DELETE);