mirror of
https://github.com/google/nomulus.git
synced 2025-05-16 09:27:16 +02:00
Rethrow exceptions in ExpandRecurringBillingEventsAction
Also fixes bug in handling of future-dated Recurring billing events. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=140048357
This commit is contained in:
parent
9a616ccd7f
commit
35d88a9f8c
2 changed files with 18 additions and 1 deletions
|
@ -17,6 +17,7 @@ package google.registry.batch;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.common.Cursor.CursorType.RECURRING_BILLING;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.assertBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.assertBillingEventsForResource;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
|
@ -53,6 +54,7 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
|
||||
/** Unit tests for {@link ExpandRecurringBillingEventsAction}. */
|
||||
@RunWith(JUnit4.class)
|
||||
public class ExpandRecurringBillingEventsActionTest
|
||||
|
@ -259,7 +261,6 @@ public class ExpandRecurringBillingEventsActionTest
|
|||
action.cursorTimeParam = Optional.of(START_OF_TIME);
|
||||
runMapreduce();
|
||||
assertBillingEventsForResource(domain, recurring);
|
||||
assertCursorAt(clock.nowUtc());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -664,4 +665,14 @@ public class ExpandRecurringBillingEventsActionTest
|
|||
IllegalArgumentException.class, "Cursor time must be earlier than execution time.");
|
||||
runMapreduce();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_mapperException_doesNotMoveCursor() throws Exception {
|
||||
saveCursor(START_OF_TIME); // Need a saved cursor to verify that it didn't move.
|
||||
// Set target to a TLD that doesn't exist.
|
||||
recurring = persistResource(recurring.asBuilder().setTargetId("domain.junk").build());
|
||||
runMapreduce();
|
||||
assertBillingEvents(recurring); // only the bogus one in datastore
|
||||
assertCursorAt(START_OF_TIME); // Cursor doesn't move on a failure.
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue