Ignore test TLDs when logging transaction creates/deletes

The probers make a constant stream of create and delete calls, which we don't
want to account for when constructing transaction reports. This change will
cause only real TLDs to log create and delete transaction records.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166737801
This commit is contained in:
larryruili 2017-08-28 12:08:28 -07:00 committed by Ben McIlwain
parent 16e8286dca
commit c86fd96654
4 changed files with 76 additions and 30 deletions

View file

@ -76,6 +76,7 @@ import google.registry.model.poll.PendingActionNotificationResponse;
import google.registry.model.poll.PollMessage;
import google.registry.model.registry.Registry;
import google.registry.model.registry.Registry.TldState;
import google.registry.model.registry.Registry.TldType;
import google.registry.model.reporting.DomainTransactionRecord;
import google.registry.model.reporting.HistoryEntry;
import google.registry.model.transfer.TransferData;
@ -787,6 +788,29 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
assertTldsFieldLogged("tld");
}
@Test
public void testIcannTransactionRecord_testTld_notStored() throws Exception {
setUpSuccessfulTest();
setUpGracePeriodDurations();
persistResource(Registry.get("tld").asBuilder().setTldType(TldType.TEST).build());
clock.advanceOneMilli();
earlierHistoryEntry =
persistResource(
earlierHistoryEntry
.asBuilder()
.setType(DOMAIN_CREATE)
.setModificationTime(TIME_BEFORE_FLOW.minusDays(2))
.setDomainTransactionRecords(
ImmutableSet.of(
DomainTransactionRecord.create(
"tld", TIME_BEFORE_FLOW.plusDays(1), NET_ADDS_1_YR, 1)))
.build());
runFlow();
HistoryEntry persistedEntry = getOnlyHistoryEntryOfType(domain, DOMAIN_DELETE);
// No transaction records should be recorded for test TLDs
assertThat(persistedEntry.getDomainTransactionRecords()).isEmpty();
}
@Test
public void testIcannTransactionRecord_noGrace_entryOutsideMaxGracePeriod() throws Exception {
setUpSuccessfulTest();