Set short redemption/add/delete periods for all OT&E TLDs

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=228791942
This commit is contained in:
guyben 2019-01-10 15:46:30 -08:00 committed by Ben McIlwain
parent 765e63e7e9
commit a4fca18657
7 changed files with 64 additions and 164 deletions

View file

@ -113,27 +113,9 @@ public final class OteAccountBuilder {
RegistryEnvironment.get() != RegistryEnvironment.PRODUCTION,
"Can't setup OT&E in production");
clientIdToTld = createClientIdToTldMap(baseClientId);
sunriseTld =
createTld(
baseClientId + "-sunrise", TldState.START_DATE_SUNRISE, null, null, null, false, 0);
gaTld =
createTld(
baseClientId + "-ga",
TldState.GENERAL_AVAILABILITY,
SHORT_ADD_GRACE_PERIOD,
SHORT_REDEMPTION_GRACE_PERIOD,
SHORT_PENDING_DELETE_LENGTH,
false,
2);
eapTld =
createTld(
baseClientId + "-eap",
TldState.GENERAL_AVAILABILITY,
SHORT_ADD_GRACE_PERIOD,
SHORT_REDEMPTION_GRACE_PERIOD,
SHORT_PENDING_DELETE_LENGTH,
true,
3);
sunriseTld = createTld(baseClientId + "-sunrise", TldState.START_DATE_SUNRISE, false, 0);
gaTld = createTld(baseClientId + "-ga", TldState.GENERAL_AVAILABILITY, false, 2);
eapTld = createTld(baseClientId + "-eap", TldState.GENERAL_AVAILABILITY, true, 3);
registrars =
clientIdToTld.keySet().stream()
.map(OteAccountBuilder::createRegistrar)
@ -294,9 +276,6 @@ public final class OteAccountBuilder {
private static Registry createTld(
String tldName,
TldState initialTldState,
Duration addGracePeriod,
Duration redemptionGracePeriod,
Duration pendingDeleteLength,
boolean isEarlyAccess,
int roidSuffix) {
String tldNameAlphaNumerical = tldName.replaceAll("[^a-z0-9]", "");
@ -313,16 +292,10 @@ public final class OteAccountBuilder {
String.format(
"%S%X",
tldNameAlphaNumerical.substring(0, Math.min(tldNameAlphaNumerical.length(), 7)),
roidSuffix));
if (addGracePeriod != null) {
builder.setAddGracePeriodLength(addGracePeriod);
}
if (pendingDeleteLength != null) {
builder.setPendingDeleteLength(pendingDeleteLength);
}
if (redemptionGracePeriod != null) {
builder.setRedemptionGracePeriodLength(redemptionGracePeriod);
}
roidSuffix))
.setAddGracePeriodLength(SHORT_ADD_GRACE_PERIOD)
.setPendingDeleteLength(SHORT_PENDING_DELETE_LENGTH)
.setRedemptionGracePeriodLength(SHORT_REDEMPTION_GRACE_PERIOD);
if (isEarlyAccess) {
builder.setEapFeeSchedule(EAP_FEE_SCHEDULE);
}

View file

@ -114,7 +114,7 @@ public class OteStats {
eppInput -> eppInput.getSingleExtension(FeeCreateCommandExtension.class).isPresent()),
DOMAIN_CREATES_WITH_SEC_DNS(1, equalTo(Type.DOMAIN_CREATE), HAS_SEC_DNS),
DOMAIN_CREATES_WITHOUT_SEC_DNS(0, equalTo(Type.DOMAIN_CREATE), HAS_SEC_DNS.negate()),
DOMAIN_DELETES(2, equalTo(Type.DOMAIN_DELETE)),
DOMAIN_DELETES(1, equalTo(Type.DOMAIN_DELETE)),
DOMAIN_RENEWS(0, equalTo(Type.DOMAIN_RENEW)),
DOMAIN_RESTORES(1, equalTo(Type.DOMAIN_RESTORE)),
DOMAIN_TRANSFER_APPROVES(1, equalTo(Type.DOMAIN_TRANSFER_APPROVE)),

View file

@ -17,6 +17,7 @@ package google.registry.model;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.registry.Registry.TldState.GENERAL_AVAILABILITY;
import static google.registry.model.registry.Registry.TldState.START_DATE_SUNRISE;
import static google.registry.testing.AppEngineRule.makeRegistrar1;
import static google.registry.testing.CertificateSamples.SAMPLE_CERT;
import static google.registry.testing.CertificateSamples.SAMPLE_CERT_HASH;
@ -65,25 +66,12 @@ public final class OteAccountBuilderTest {
persistPremiumList("default_sandbox_list", "sandbox,USD 1000");
}
private void assertTldExists(String tld, Registry.TldState tldState) {
private void assertTldExists(String tld, TldState tldState, Money eapFee) {
Registry registry = Registry.get(tld);
assertThat(registry).isNotNull();
assertThat(registry.getPremiumList().getName()).isEqualTo("default_sandbox_list");
assertThat(registry.getTldStateTransitions()).containsExactly(START_OF_TIME, tldState);
assertThat(registry.getDnsWriters()).containsExactly("VoidDnsWriter");
assertThat(registry.getAddGracePeriodLength()).isEqualTo(Duration.standardDays(5));
assertThat(registry.getPendingDeleteLength()).isEqualTo(Duration.standardDays(5));
assertThat(registry.getRedemptionGracePeriodLength()).isEqualTo(Duration.standardDays(30));
assertThat(registry.getEapFeeScheduleAsMap()).containsExactly(START_OF_TIME, Money.zero(USD));
}
private void assertTldExistsGa(String tld, Money eapFee) {
Registry registry = Registry.get(tld);
assertThat(registry).isNotNull();
assertThat(registry.getPremiumList().getName()).isEqualTo("default_sandbox_list");
assertThat(registry.getTldStateTransitions())
.containsExactly(START_OF_TIME, GENERAL_AVAILABILITY);
assertThat(registry.getDnsWriters()).containsExactly("VoidDnsWriter");
assertThat(registry.getAddGracePeriodLength()).isEqualTo(Duration.standardHours(1));
assertThat(registry.getPendingDeleteLength()).isEqualTo(Duration.standardMinutes(5));
assertThat(registry.getRedemptionGracePeriodLength()).isEqualTo(Duration.standardMinutes(10));
@ -119,9 +107,9 @@ public final class OteAccountBuilderTest {
public void testCreateOteEntities_success() {
OteAccountBuilder.forClientId("myclientid").addContact("email@example.com").buildAndPersist();
assertTldExists("myclientid-sunrise", TldState.START_DATE_SUNRISE);
assertTldExistsGa("myclientid-ga", Money.zero(USD));
assertTldExistsGa("myclientid-eap", Money.of(USD, 100));
assertTldExists("myclientid-sunrise", START_DATE_SUNRISE, Money.zero(USD));
assertTldExists("myclientid-ga", GENERAL_AVAILABILITY, Money.zero(USD));
assertTldExists("myclientid-eap", GENERAL_AVAILABILITY, Money.of(USD, 100));
assertRegistrarExists("myclientid-1", "myclientid-sunrise");
assertRegistrarExists("myclientid-3", "myclientid-ga");
assertRegistrarExists("myclientid-4", "myclientid-ga");
@ -140,9 +128,9 @@ public final class OteAccountBuilderTest {
.addContact("someone@example.com")
.buildAndPersist();
assertTldExists("myclientid-sunrise", TldState.START_DATE_SUNRISE);
assertTldExistsGa("myclientid-ga", Money.zero(USD));
assertTldExistsGa("myclientid-eap", Money.of(USD, 100));
assertTldExists("myclientid-sunrise", START_DATE_SUNRISE, Money.zero(USD));
assertTldExists("myclientid-ga", GENERAL_AVAILABILITY, Money.zero(USD));
assertTldExists("myclientid-eap", GENERAL_AVAILABILITY, Money.of(USD, 100));
assertRegistrarExists("myclientid-1", "myclientid-sunrise");
assertRegistrarExists("myclientid-3", "myclientid-ga");
assertRegistrarExists("myclientid-4", "myclientid-ga");
@ -237,8 +225,9 @@ public final class OteAccountBuilderTest {
}
@Test
public void testCreateOteEntities_entityExists_failsWhenNotReplaceExisting() {
public void testCreateOteEntities_registrarExists_failsWhenNotReplaceExisting() {
persistSimpleResource(makeRegistrar1().asBuilder().setClientId("myclientid-1").build());
OteAccountBuilder oteSetupHelper = OteAccountBuilder.forClientId("myclientid");
assertThat(assertThrows(IllegalStateException.class, () -> oteSetupHelper.buildAndPersist()))
@ -247,15 +236,29 @@ public final class OteAccountBuilderTest {
}
@Test
public void testCreateOteEntities_entityExists_succeedsWhenReplaceExisting() {
persistSimpleResource(makeRegistrar1().asBuilder().setClientId("myclientid-4").build());
createTld("myclientid-ga", GENERAL_AVAILABILITY);
public void testCreateOteEntities_tldExists_failsWhenNotReplaceExisting() {
createTld("myclientid-ga", START_DATE_SUNRISE);
OteAccountBuilder oteSetupHelper = OteAccountBuilder.forClientId("myclientid");
assertThat(assertThrows(IllegalStateException.class, () -> oteSetupHelper.buildAndPersist()))
.hasMessageThat()
.contains("Found existing object(s) conflicting with OT&E objects");
}
@Test
public void testCreateOteEntities_entitiesExist_succeedsWhenReplaceExisting() {
persistSimpleResource(makeRegistrar1().asBuilder().setClientId("myclientid-1").build());
// we intentionally create the -ga TLD with the wrong state, to make sure it's overwritten.
createTld("myclientid-ga", START_DATE_SUNRISE);
OteAccountBuilder.forClientId("myclientid").setReplaceExisting(true).buildAndPersist();
assertTldExistsGa("myclientid-ga", Money.zero(USD));
// Just checking a sample of the resulting entities to make sure it indeed succeeded. The full
// entities are checked in other tests
assertTldExists("myclientid-ga", GENERAL_AVAILABILITY, Money.zero(USD));
assertRegistrarExists("myclientid-1", "myclientid-sunrise");
assertRegistrarExists("myclientid-3", "myclientid-ga");
assertRegistrarExists("myclientid-4", "myclientid-ga");
}
@Test

View file

@ -38,7 +38,7 @@ public final class OteStatsTest {
public void testSuccess_allPass() {
OteStats stats = OteStats.getFromRegistrar("blobio");
assertThat(stats.getFailures()).isEmpty();
assertThat(stats.getSize()).isEqualTo(31);
assertThat(stats.getSize()).isEqualTo(30);
}
@Test
@ -51,7 +51,7 @@ public final class OteStatsTest {
.containsExactly(
StatType.DOMAIN_CREATES_IDN, StatType.DOMAIN_RESTORES, StatType.HOST_DELETES)
.inOrder();
assertThat(stats.getSize()).isEqualTo(35);
assertThat(stats.getSize()).isEqualTo(34);
}
@Test
@ -74,7 +74,7 @@ public final class OteStatsTest {
+ "domain creates with fee: 1\n"
+ "domain creates with sec dns: 1\n"
+ "domain creates without sec dns: 4\n"
+ "domain deletes: 2\n"
+ "domain deletes: 1\n"
+ "domain renews: 0\n"
+ "domain restores: 1\n"
+ "domain transfer approves: 1\n"
@ -90,7 +90,7 @@ public final class OteStatsTest {
+ "host deletes: 1\n"
+ "host updates: 1\n"
+ "unclassified flows: 0\n"
+ "TOTAL: 31";
+ "TOTAL: 30";
assertThat(stats.toString()).isEqualTo(expected);
}
@ -115,7 +115,7 @@ public final class OteStatsTest {
+ "domain creates with fee: 1\n"
+ "domain creates with sec dns: 1\n"
+ "domain creates without sec dns: 4\n"
+ "domain deletes: 2\n"
+ "domain deletes: 1\n"
+ "domain renews: 0\n"
+ "domain restores: 1\n"
+ "domain transfer approves: 1\n"
@ -131,7 +131,7 @@ public final class OteStatsTest {
+ "host deletes: 0\n"
+ "host updates: 10\n"
+ "unclassified flows: 0\n"
+ "TOTAL: 39";
+ "TOTAL: 38";
assertThat(stats.toString()).isEqualTo(expected);
}
}

View file

@ -70,12 +70,6 @@ public final class OteStatsTestHelper {
.setType(Type.DOMAIN_DELETE)
.setXmlBytes(getBytes("domain_delete.xml"))
.build());
persistResource(
new HistoryEntry.Builder()
.setClientId("blobio-3")
.setType(Type.DOMAIN_DELETE)
.setXmlBytes(getBytes("domain_delete.xml"))
.build());
domainRestoreHistoryEntry =
persistResource(
new HistoryEntry.Builder()
@ -109,13 +103,13 @@ public final class OteStatsTestHelper {
.build());
persistResource(
new HistoryEntry.Builder()
.setClientId("blobio-4")
.setClientId("blobio-1")
.setType(Type.DOMAIN_UPDATE)
.setXmlBytes(getBytes("domain_update_with_secdns.xml"))
.build());
persistResource(
new HistoryEntry.Builder()
.setClientId("blobio-5")
.setClientId("blobio-1")
.setType(Type.HOST_CREATE)
.setXmlBytes(getBytes("host_create_complete.xml"))
.build());

View file

@ -66,9 +66,6 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
String tldName,
String roidSuffix,
TldState tldState,
Duration addGracePeriodLength,
Duration redemptionGracePeriodLength,
Duration pendingDeleteLength,
boolean isEarlyAccess) {
Registry registry = Registry.get(tldName);
assertThat(registry).isNotNull();
@ -77,9 +74,9 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
assertThat(registry.getDnsWriters()).containsExactly("VoidDnsWriter");
assertThat(registry.getPremiumList()).isNotNull();
assertThat(registry.getPremiumList().getName()).isEqualTo("default_sandbox_list");
assertThat(registry.getAddGracePeriodLength()).isEqualTo(addGracePeriodLength);
assertThat(registry.getRedemptionGracePeriodLength()).isEqualTo(redemptionGracePeriodLength);
assertThat(registry.getPendingDeleteLength()).isEqualTo(pendingDeleteLength);
assertThat(registry.getAddGracePeriodLength()).isEqualTo(Duration.standardMinutes(60));
assertThat(registry.getRedemptionGracePeriodLength()).isEqualTo(Duration.standardMinutes(10));
assertThat(registry.getPendingDeleteLength()).isEqualTo(Duration.standardMinutes(5));
ImmutableSortedMap<DateTime, Money> eapFeeSchedule = registry.getEapFeeScheduleAsMap();
if (!isEarlyAccess) {
assertThat(eapFeeSchedule)
@ -97,19 +94,6 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
}
/** Verify TLD creation with registry default durations. */
private void verifyTldCreation(
String tldName, String roidSuffix, TldState tldState) {
verifyTldCreation(
tldName,
roidSuffix,
tldState,
Registry.DEFAULT_ADD_GRACE_PERIOD,
Registry.DEFAULT_REDEMPTION_GRACE_PERIOD,
Registry.DEFAULT_PENDING_DELETE_LENGTH,
false);
}
private void verifyRegistrarCreation(
String registrarName,
String allowedTld,
@ -156,22 +140,9 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
"--email=contact@email.com",
"--certfile=" + getCertFilename());
verifyTldCreation("blobio-sunrise", "BLOBIOS0", START_DATE_SUNRISE);
verifyTldCreation("blobio-ga",
"BLOBIOG2",
GENERAL_AVAILABILITY,
Duration.standardMinutes(60),
Duration.standardMinutes(10),
Duration.standardMinutes(5),
false);
verifyTldCreation(
"blobio-eap",
"BLOBIOE3",
GENERAL_AVAILABILITY,
Duration.standardMinutes(60),
Duration.standardMinutes(10),
Duration.standardMinutes(5),
true);
verifyTldCreation("blobio-sunrise", "BLOBIOS0", START_DATE_SUNRISE, false);
verifyTldCreation("blobio-ga", "BLOBIOG2", GENERAL_AVAILABILITY, false);
verifyTldCreation("blobio-eap", "BLOBIOE3", GENERAL_AVAILABILITY, true);
ImmutableList<CidrAddressBlock> ipAddress = ImmutableList.of(
CidrAddressBlock.create("1.1.1.1"));
@ -195,22 +166,9 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
"--email=abc@email.com",
"--certfile=" + getCertFilename());
verifyTldCreation("abc-sunrise", "ABCSUNR0", START_DATE_SUNRISE);
verifyTldCreation("abc-ga",
"ABCGA2",
GENERAL_AVAILABILITY,
Duration.standardMinutes(60),
Duration.standardMinutes(10),
Duration.standardMinutes(5),
false);
verifyTldCreation(
"abc-eap",
"ABCEAP3",
GENERAL_AVAILABILITY,
Duration.standardMinutes(60),
Duration.standardMinutes(10),
Duration.standardMinutes(5),
true);
verifyTldCreation("abc-sunrise", "ABCSUNR0", START_DATE_SUNRISE, false);
verifyTldCreation("abc-ga", "ABCGA2", GENERAL_AVAILABILITY, false);
verifyTldCreation("abc-eap", "ABCEAP3", GENERAL_AVAILABILITY, true);
ImmutableList<CidrAddressBlock> ipAddress =
ImmutableList.of(CidrAddressBlock.create("1.1.1.1"));
@ -234,14 +192,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
"--email=contact@email.com",
"--certhash=" + SAMPLE_CERT_HASH);
verifyTldCreation(
"blobio-eap",
"BLOBIOE3",
GENERAL_AVAILABILITY,
Duration.standardMinutes(60),
Duration.standardMinutes(10),
Duration.standardMinutes(5),
true);
verifyTldCreation("blobio-eap", "BLOBIOE3", GENERAL_AVAILABILITY, true);
ImmutableList<CidrAddressBlock> ipAddress =
ImmutableList.of(CidrAddressBlock.create("1.1.1.1"));
@ -259,23 +210,9 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
"--email=contact@email.com",
"--certfile=" + getCertFilename());
verifyTldCreation("blobio-sunrise", "BLOBIOS0", START_DATE_SUNRISE);
verifyTldCreation(
"blobio-ga",
"BLOBIOG2",
GENERAL_AVAILABILITY,
Duration.standardMinutes(60),
Duration.standardMinutes(10),
Duration.standardMinutes(5),
false);
verifyTldCreation(
"blobio-eap",
"BLOBIOE3",
GENERAL_AVAILABILITY,
Duration.standardMinutes(60),
Duration.standardMinutes(10),
Duration.standardMinutes(5),
true);
verifyTldCreation("blobio-sunrise", "BLOBIOS0", START_DATE_SUNRISE, false);
verifyTldCreation("blobio-ga", "BLOBIOG2", GENERAL_AVAILABILITY, false);
verifyTldCreation("blobio-eap", "BLOBIOE3", GENERAL_AVAILABILITY, true);
ImmutableList<CidrAddressBlock> ipAddresses = ImmutableList.of(
CidrAddressBlock.create("1.1.1.1"),
@ -461,15 +398,8 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
"--email=contact@email.com",
"--certfile=" + getCertFilename());
verifyTldCreation("blobio-sunrise", "BLOBIOS0", START_DATE_SUNRISE);
verifyTldCreation(
"blobio-ga",
"BLOBIOG2",
GENERAL_AVAILABILITY,
Duration.standardMinutes(60),
Duration.standardMinutes(10),
Duration.standardMinutes(5),
false);
verifyTldCreation("blobio-sunrise", "BLOBIOS0", START_DATE_SUNRISE, false);
verifyTldCreation("blobio-ga", "BLOBIOG2", GENERAL_AVAILABILITY, false);
}
@Test

View file

@ -44,7 +44,7 @@ public class VerifyOteActionTest {
@Test
public void testSuccess_summarize_allPass() {
assertThat(getResponse(true))
.isEqualTo("# actions: 31 - Reqs: [----------------] 16/16 - Overall: PASS");
.isEqualTo("# actions: 30 - Reqs: [----------------] 16/16 - Overall: PASS");
}
@Test
@ -53,7 +53,7 @@ public class VerifyOteActionTest {
OteStatsTestHelper.deleteDomainRestoreHistoryEntry();
OteStatsTestHelper.deleteHostDeleteHistoryEntry();
assertThat(getResponse(true))
.isEqualTo("# actions: 35 - Reqs: [-.-----.------.-] 13/16 - Overall: FAIL");
.isEqualTo("# actions: 34 - Reqs: [-.-----.------.-] 13/16 - Overall: FAIL");
}
@Test
@ -65,7 +65,7 @@ public class VerifyOteActionTest {
+ "domain creates with fee: 1\n"
+ "domain creates with sec dns: 1\n"
+ ".*"
+ "domain deletes: 2\n"
+ "domain deletes: 1\n"
+ ".*"
+ "domain restores: 1\n"
+ "domain transfer approves: 1\n"
@ -95,7 +95,7 @@ public class VerifyOteActionTest {
+ "domain creates with fee: 1\n"
+ "domain creates with sec dns: 1\n"
+ ".*"
+ "domain deletes: 2\n"
+ "domain deletes: 1\n"
+ ".*"
+ "domain restores: 1\n"
+ "domain transfer approves: 1\n"