mirror of
https://github.com/google/nomulus.git
synced 2025-05-16 09:27:16 +02:00
Delete applications even when index is missing
This makes the deletion mapreduce more resilient in the face of data integrity violations (which exist on sandbox but hopefully not in production). Even when the domain application index doesn't exist, we still want to delete the domain application itself, as its continuing presence will cause problems after the code for domain applications is deleted. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=228521794
This commit is contained in:
parent
ce29e73879
commit
02174a2cff
2 changed files with 42 additions and 5 deletions
|
@ -16,6 +16,7 @@ package google.registry.tools.server;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
|
@ -91,4 +92,26 @@ public class KillAllDomainApplicationsActionTest
|
|||
.entities(application, applicationEri, applicationDai, applicationHistoryEntry))
|
||||
.isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_deletesApplication_evenWhenIndexIsMissing() throws Exception {
|
||||
createTld("tld1");
|
||||
DomainApplication application = persistActiveDomainApplication("applied.tld1");
|
||||
EppResourceIndex applicationEri =
|
||||
ofy().load().entity(EppResourceIndex.create(Key.create(application))).now();
|
||||
HistoryEntry applicationHistoryEntry =
|
||||
persistResource(new HistoryEntry.Builder().setParent(application).build());
|
||||
|
||||
// Delete the domain application index.
|
||||
ofy().transact(() -> ofy().delete().key(DomainApplicationIndex.createKey(application)).now());
|
||||
ofy().clearSessionCache();
|
||||
|
||||
runMapreduce();
|
||||
ofy().clearSessionCache();
|
||||
|
||||
// Check that the domain application and history entry were deleted even though the indexes
|
||||
// couldn't be found.
|
||||
assertThat(ofy().load().entities(application, applicationEri, applicationHistoryEntry))
|
||||
.isEmpty();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue