Make some quality of life improvements to set_num_instances command

Allows correct service names (i.e. lowercased, as they appear in App Engine
configuration files and the GCP console), and adds single letter parameters for
common flags.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=229194479
This commit is contained in:
mcilwain 2019-01-14 09:16:11 -08:00 committed by Ben McIlwain
parent 8ac8ecf8f6
commit 6082addb86
2 changed files with 20 additions and 5 deletions

View file

@ -99,7 +99,7 @@ public class SetNumInstancesCommandTest extends CommandTestCase<SetNumInstancesC
ParameterException.class, () -> runCommand("--services=DEFAULT", "--versions=version"));
assertThat(thrown)
.hasMessageThat()
.contains("The following option is required: --num_instances");
.contains("The following option is required: -n, --num_instances");
}
@Test
@ -156,6 +156,19 @@ public class SetNumInstancesCommandTest extends CommandTestCase<SetNumInstancesC
verify(appEngineServiceUtils, times(1)).setNumInstances("default", "version", 10L);
}
@Test
public void test_validShortParametersAndLowercaseService_succeeds() throws Exception {
command.appengine =
new AppEngineAdminApiHelper.Builder()
.setAppId(projectId)
.setManualScalingVersionsMap(ImmutableMultimap.of("default", "version"))
.build()
.getAppengine();
runCommand("-s default", "-v version", "-n 10");
verify(appEngineServiceUtils, times(1)).setNumInstances("default", "version", 10L);
}
@Test
public void test_settingMultipleServicesAndVersions_succeeds() throws Exception {
command.appengine =