Temporarily add null handling for autorenew billing events

These shouldn't ever be null, but we have some bad data in production
for prober TLDs left over from the Registry 2.0 transition. Ignoring
null values here is required to finish cleanup for this old data, which
currently cannot even be deleted because it's throwing an NPE when
trying to update these values.

This commit will be reverted after the bad data is cleaned up, likely
sometime next week.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158546840
This commit is contained in:
mcilwain 2017-06-09 12:15:16 -07:00 committed by Ben McIlwain
parent 7002026da5
commit f5f383dc38
2 changed files with 30 additions and 3 deletions

View file

@ -492,6 +492,20 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
assertThat(domain.getTransferData()).isEqualTo(TransferData.EMPTY);
}
//TODO(b/27472322): Delete test handling recurring being null once bad data is cleaned from prod.
@Test
public void testSuccess_nullAutorenewBillingEvent_isIgnore() throws Exception {
setClientIdForFlow("TheRegistrar");
setupSuccessfulTest();
ofy().deleteWithoutBackup().key(domain.getAutorenewBillingEvent()).now();
ofy().clearSessionCache();
clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_delete_response_pending.xml"));
// If the previous statement doesn't throw an error, then the test is successful.
assertThat(ofy().load().key(reloadResourceByForeignKey().getAutorenewBillingEvent()).now())
.isNull();
}
@Test
public void testSuccess_pendingTransfer() throws Exception {
setClientIdForFlow("TheRegistrar");