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.
This commit is contained in:
Weimin Yu 2021-03-19 12:38:54 -04:00 committed by GitHub
parent ccfa145ab7
commit 89fe53e339
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);