mirror of
https://github.com/google/nomulus
synced 2026-09-08 17:17:02 +00:00
@@ -58,22 +58,28 @@ public class SetNumInstancesCommandTest extends CommandTestCase<SetNumInstancesC
|
||||
|
||||
@Test
|
||||
void test_emptyService_throwsException() {
|
||||
IllegalArgumentException thrown =
|
||||
ParameterException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
ParameterException.class,
|
||||
() -> runCommand("--services=", "--versions=version", "--num_instances=5"));
|
||||
assertThat(thrown).hasMessageThat().contains("Invalid service ''");
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains(
|
||||
"Invalid value for -s parameter. Allowed values:[DEFAULT, TOOLS, BACKEND, PUBAPI]");
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_invalidService_throwsException() {
|
||||
IllegalArgumentException thrown =
|
||||
ParameterException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
"--services=INVALID,DEFAULT", "--versions=version", "--num_instances=5"));
|
||||
assertThat(thrown).hasMessageThat().contains("Invalid service 'INVALID'");
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains(
|
||||
"Invalid value for -s parameter. Allowed values:[DEFAULT, TOOLS, BACKEND, PUBAPI]");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
-33
@@ -456,39 +456,6 @@ class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase {
|
||||
(builder, s) -> builder.setFailoverClientCertificate(s, clock.nowUtc()));
|
||||
}
|
||||
|
||||
@TestOfyAndSql
|
||||
void testUpdate_failoverClientCertificateWithViolationsAlreadyExistedSucceeds() {
|
||||
// TODO(sarahbot): remove this test after November 1, 2020.
|
||||
|
||||
// The frontend will always send the entire registrar entity back for an update, so the checks
|
||||
// on the certificate should only run if it is a new certificate
|
||||
|
||||
// Set a bad certificate before checks on uploads are enforced
|
||||
clock.setTo(DateTime.parse("2018-07-02T00:00:00Z"));
|
||||
Registrar existingRegistrar = loadRegistrar(CLIENT_ID);
|
||||
existingRegistrar =
|
||||
existingRegistrar
|
||||
.asBuilder()
|
||||
.setFailoverClientCertificate(CertificateSamples.SAMPLE_CERT, clock.nowUtc())
|
||||
.build();
|
||||
persistResource(existingRegistrar);
|
||||
|
||||
// Update with the same certificate after enforcement starts
|
||||
clock.setTo(DateTime.parse("2020-11-02T00:00:00Z"));
|
||||
Map<String, Object> args = Maps.newHashMap(loadRegistrar(CLIENT_ID).toJsonMap());
|
||||
args.put("failoverClientCertificate", CertificateSamples.SAMPLE_CERT);
|
||||
Map<String, Object> response =
|
||||
action.handleJsonRequest(
|
||||
ImmutableMap.of(
|
||||
"op", "update",
|
||||
"id", CLIENT_ID,
|
||||
"args", args));
|
||||
|
||||
assertThat(response).containsEntry("status", "SUCCESS");
|
||||
assertMetric(CLIENT_ID, "update", "[OWNER]", "SUCCESS");
|
||||
cloudTasksHelper.assertNoTasksEnqueued("sheet");
|
||||
}
|
||||
|
||||
@TestOfyAndSql
|
||||
void testUpdate_failoverClientCertificateWithViolationsFails() {
|
||||
clock.setTo(DateTime.parse("2020-11-02T00:00:00Z"));
|
||||
|
||||
Reference in New Issue
Block a user