mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
Fix soft delete for possible double-map of domain
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=167040455
This commit is contained in:
parent
ccc51daa9f
commit
fa447ce37e
2 changed files with 51 additions and 2 deletions
|
@ -79,6 +79,10 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
|
|||
createTld("oa-canary.test", "OACANT");
|
||||
persistResource(Registry.get("oa-canary.test").asBuilder().setTldType(TldType.TEST).build());
|
||||
|
||||
resetAction();
|
||||
}
|
||||
|
||||
private void resetAction() {
|
||||
action = new DeleteProberDataAction();
|
||||
action.mrRunner = makeDefaultRunner();
|
||||
action.response = new FakeResponse();
|
||||
|
@ -140,6 +144,23 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
|
|||
assertDnsTasksEnqueued("blah.ib-any.test");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_activeDomain_doubleMapSoftDeletes() throws Exception {
|
||||
DomainResource domain = persistResource(
|
||||
newDomainResource("blah.ib-any.test")
|
||||
.asBuilder()
|
||||
.setCreationTimeForTest(DateTime.now(UTC).minusYears(1))
|
||||
.build());
|
||||
runMapreduce();
|
||||
DateTime timeAfterDeletion = DateTime.now(UTC);
|
||||
resetAction();
|
||||
runMapreduce();
|
||||
assertThat(loadByForeignKey(DomainResource.class, "blah.ib-any.test", timeAfterDeletion))
|
||||
.isNull();
|
||||
assertThat(ofy().load().entity(domain).now().getDeletionTime()).isLessThan(timeAfterDeletion);
|
||||
assertDnsTasksEnqueued("blah.ib-any.test");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_recentlyCreatedDomain_isntDeletedYet() throws Exception {
|
||||
persistResource(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue