mirror of
https://github.com/google/nomulus.git
synced 2025-05-28 07:02:00 +02:00
Cut over to batched async deletion for contacts/hosts
Also consolidates the DNS refresh functionality in AsyncFlowUtils that was being used by HostUpdateFlow into AsyncFlowEnqueuer. TESTED=I threw together some batch scripts to create dozens of contacts on alpha and then request their deletion, and the [] ran fine and successfully deleted them in batches. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133714691
This commit is contained in:
parent
65ff6b45d1
commit
2dcac3ca68
11 changed files with 74 additions and 190 deletions
|
@ -14,8 +14,6 @@
|
|||
|
||||
package google.registry.flows.contact;
|
||||
|
||||
import static google.registry.flows.async.AsyncFlowUtils.ASYNC_FLOW_QUEUE_NAME;
|
||||
import static google.registry.request.Actions.getPathForAction;
|
||||
import static google.registry.testing.ContactResourceSubject.assertAboutContacts;
|
||||
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
|
@ -24,22 +22,16 @@ import static google.registry.testing.DatastoreHelper.newDomainResource;
|
|||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
import google.registry.flows.async.DeleteContactResourceAction;
|
||||
import google.registry.flows.async.DeleteEppResourceAction;
|
||||
import google.registry.flows.exceptions.ResourceStatusProhibitsOperationException;
|
||||
import google.registry.flows.exceptions.ResourceToDeleteIsReferencedException;
|
||||
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.testing.TaskQueueHelper.TaskMatcher;
|
||||
import org.joda.time.Duration;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -76,18 +68,7 @@ public class ContactDeleteFlowTest
|
|||
runFlowAssertResponse(readFile("contact_delete_response.xml"));
|
||||
ContactResource deletedContact = reloadResourceByUniqueId();
|
||||
assertAboutContacts().that(deletedContact).hasStatusValue(StatusValue.PENDING_DELETE);
|
||||
assertTasksEnqueued(ASYNC_FLOW_QUEUE_NAME, new TaskMatcher()
|
||||
.url(getPathForAction(DeleteContactResourceAction.class))
|
||||
.etaDelta(Duration.standardSeconds(75), Duration.standardSeconds(105)) // expected: 90
|
||||
.param(
|
||||
DeleteEppResourceAction.PARAM_REQUESTING_CLIENT_ID,
|
||||
"TheRegistrar")
|
||||
.param(
|
||||
DeleteEppResourceAction.PARAM_IS_SUPERUSER,
|
||||
Boolean.toString(false))
|
||||
.param(
|
||||
DeleteEppResourceAction.PARAM_RESOURCE_KEY,
|
||||
Key.create(deletedContact).getString()));
|
||||
assertAsyncDeletionTaskEnqueued(deletedContact, "TheRegistrar", false);
|
||||
assertAboutContacts().that(deletedContact)
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasType(HistoryEntry.Type.CONTACT_PENDING_DELETE);
|
||||
|
@ -146,18 +127,7 @@ public class ContactDeleteFlowTest
|
|||
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("contact_delete_response.xml"));
|
||||
ContactResource deletedContact = reloadResourceByUniqueId();
|
||||
assertAboutContacts().that(deletedContact).hasStatusValue(StatusValue.PENDING_DELETE);
|
||||
assertTasksEnqueued(ASYNC_FLOW_QUEUE_NAME, new TaskMatcher()
|
||||
.url(getPathForAction(DeleteContactResourceAction.class))
|
||||
.etaDelta(Duration.standardSeconds(75), Duration.standardSeconds(105)) // expected: 90
|
||||
.param(
|
||||
DeleteEppResourceAction.PARAM_REQUESTING_CLIENT_ID,
|
||||
"NewRegistrar")
|
||||
.param(
|
||||
DeleteEppResourceAction.PARAM_IS_SUPERUSER,
|
||||
Boolean.toString(true))
|
||||
.param(
|
||||
DeleteEppResourceAction.PARAM_RESOURCE_KEY,
|
||||
Key.create(deletedContact).getString()));
|
||||
assertAsyncDeletionTaskEnqueued(deletedContact, "NewRegistrar", true);
|
||||
assertAboutContacts().that(deletedContact)
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasType(HistoryEntry.Type.CONTACT_PENDING_DELETE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue