1
0
mirror of https://github.com/google/nomulus synced 2026-04-24 02:00:50 +00:00

Update CreateCdnsTld command for RST Tests (#2891)

Add a flag indicating that a Sandbox TLD should use the production
servers.

No additional TLD name pattern checks. Cloud DNS has an allowlist for
names that may use production servers.

Also updated default descriptive name generation: dropping the trailing
'.', and replacing remaining dots with '_'.
This commit is contained in:
Weimin Yu
2025-11-25 14:41:44 -05:00
committed by GitHub
parent 76d4dfbb04
commit 0dc7ab99d7
2 changed files with 60 additions and 6 deletions

View File

@@ -71,7 +71,7 @@ class CreateCdnsTldTest extends CommandTestCase<CreateCdnsTld> {
void testNameDefault() throws Exception {
runCommand("--dns_name=tld.", "--description=test run", "--force");
ManagedZone zone = requestBody.getValue();
assertThat(zone).isEqualTo(createZone("cloud-dns-registry-test", "test run", "tld.", "tld."));
assertThat(zone).isEqualTo(createZone("cloud-dns-registry-test", "test run", "tld.", "tld"));
}
@Test
@@ -109,4 +109,39 @@ class CreateCdnsTldTest extends CommandTestCase<CreateCdnsTld> {
"--description=test run",
"--force");
}
@Test
void testSandbox_defaultNameServer() throws Exception {
runCommandInEnvironment(
RegistryToolEnvironment.SANDBOX,
"--dns_name=abc.test.",
"--description=test run",
"--force");
ManagedZone zone = requestBody.getValue();
assertThat(zone.getNameServerSet()).isEqualTo("cloud-dns-registry-test");
}
@Test
void testSandbox_useProdNameServer() throws Exception {
runCommandInEnvironment(
RegistryToolEnvironment.SANDBOX,
"--use_prod_name_servers_in_sandbox",
"--dns_name=abc.test.",
"--description=test run",
"--force");
ManagedZone zone = requestBody.getValue();
assertThat(zone.getNameServerSet()).isEqualTo("cloud-dns-registry");
}
@Test
void testProdNameServerFlag_ignoredIfNotSandbox() throws Exception {
runCommandInEnvironment(
RegistryToolEnvironment.QA,
"--use_prod_name_servers_in_sandbox",
"--dns_name=abc.test.",
"--description=test run",
"--force");
ManagedZone zone = requestBody.getValue();
assertThat(zone.getNameServerSet()).isEqualTo("cloud-dns-registry-test");
}
}