Address some tiny TODOs (#1566)

* Address some tiny TODOs

* Format fix
This commit is contained in:
sarahcaseybot
2022-03-23 12:23:29 -04:00
committed by GitHub
parent 0c6f399533
commit 2495167215
5 changed files with 18 additions and 77 deletions
@@ -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
@@ -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"));