mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 08:27:14 +02:00
Use config settings for DNS TTL values across all code
Attending to this old bug will improve our ability to perform zone comparisons between Datastore and the DNS provider. Right now, zone comparison finds some bogus differences, because the TTL we send to the DNS subsystem doesn't match the TTL we use when generating our local dump files. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=164635557
This commit is contained in:
parent
1ca6c95dc2
commit
2547313ef9
9 changed files with 105 additions and 63 deletions
|
@ -286,13 +286,35 @@ public final class RegistryConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default time to live for DNS records.
|
* Returns the default time to live for DNS A and AAAA records.
|
||||||
*
|
*
|
||||||
* @see google.registry.dns.writer.clouddns.CloudDnsWriter
|
* @see google.registry.dns.writer.clouddns.CloudDnsWriter
|
||||||
*/
|
*/
|
||||||
@Provides
|
@Provides
|
||||||
@Config("dnsDefaultTtl")
|
@Config("dnsDefaultATtl")
|
||||||
public static Duration provideDnsDefaultTtl() {
|
public static Duration provideDnsDefaultATtl() {
|
||||||
|
return Duration.standardSeconds(180);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the default time to live for DNS NS records.
|
||||||
|
*
|
||||||
|
* @see google.registry.dns.writer.clouddns.CloudDnsWriter
|
||||||
|
*/
|
||||||
|
@Provides
|
||||||
|
@Config("dnsDefaultNsTtl")
|
||||||
|
public static Duration provideDnsDefaultNsTtl() {
|
||||||
|
return Duration.standardSeconds(180);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the default time to live for DNS DS records.
|
||||||
|
*
|
||||||
|
* @see google.registry.dns.writer.clouddns.CloudDnsWriter
|
||||||
|
*/
|
||||||
|
@Provides
|
||||||
|
@Config("dnsDefaultDsTtl")
|
||||||
|
public static Duration provideDnsDefaultDsTtl() {
|
||||||
return Duration.standardSeconds(180);
|
return Duration.standardSeconds(180);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,9 @@ public class CloudDnsWriter implements DnsWriter {
|
||||||
// TODO(shikhman): This uses @Named("transientFailureRetries") which may not be tuned for this
|
// TODO(shikhman): This uses @Named("transientFailureRetries") which may not be tuned for this
|
||||||
// application.
|
// application.
|
||||||
private final Retrier retrier;
|
private final Retrier retrier;
|
||||||
private final Duration defaultTtl;
|
private final Duration defaultATtl;
|
||||||
|
private final Duration defaultNsTtl;
|
||||||
|
private final Duration defaultDsTtl;
|
||||||
private final String projectId;
|
private final String projectId;
|
||||||
private final String zoneName;
|
private final String zoneName;
|
||||||
private final Dns dnsConnection;
|
private final Dns dnsConnection;
|
||||||
|
@ -87,14 +89,18 @@ public class CloudDnsWriter implements DnsWriter {
|
||||||
Dns dnsConnection,
|
Dns dnsConnection,
|
||||||
@Config("projectId") String projectId,
|
@Config("projectId") String projectId,
|
||||||
@DnsWriterZone String zoneName,
|
@DnsWriterZone String zoneName,
|
||||||
@Config("dnsDefaultTtl") Duration defaultTtl,
|
@Config("dnsDefaultATtl") Duration defaultATtl,
|
||||||
|
@Config("dnsDefaultNsTtl") Duration defaultNsTtl,
|
||||||
|
@Config("dnsDefaultDsTtl") Duration defaultDsTtl,
|
||||||
@Named("cloudDns") RateLimiter rateLimiter,
|
@Named("cloudDns") RateLimiter rateLimiter,
|
||||||
Clock clock,
|
Clock clock,
|
||||||
Retrier retrier) {
|
Retrier retrier) {
|
||||||
this.dnsConnection = dnsConnection;
|
this.dnsConnection = dnsConnection;
|
||||||
this.projectId = projectId;
|
this.projectId = projectId;
|
||||||
this.zoneName = zoneName;
|
this.zoneName = zoneName;
|
||||||
this.defaultTtl = defaultTtl;
|
this.defaultATtl = defaultATtl;
|
||||||
|
this.defaultNsTtl = defaultNsTtl;
|
||||||
|
this.defaultDsTtl = defaultDsTtl;
|
||||||
this.rateLimiter = rateLimiter;
|
this.rateLimiter = rateLimiter;
|
||||||
this.clock = clock;
|
this.clock = clock;
|
||||||
this.retrier = retrier;
|
this.retrier = retrier;
|
||||||
|
@ -132,7 +138,7 @@ public class CloudDnsWriter implements DnsWriter {
|
||||||
domainRecords.add(
|
domainRecords.add(
|
||||||
new ResourceRecordSet()
|
new ResourceRecordSet()
|
||||||
.setName(absoluteDomainName)
|
.setName(absoluteDomainName)
|
||||||
.setTtl((int) defaultTtl.getStandardSeconds())
|
.setTtl((int) defaultDsTtl.getStandardSeconds())
|
||||||
.setType("DS")
|
.setType("DS")
|
||||||
.setKind("dns#resourceRecordSet")
|
.setKind("dns#resourceRecordSet")
|
||||||
.setRrdatas(ImmutableList.copyOf(dsRrData)));
|
.setRrdatas(ImmutableList.copyOf(dsRrData)));
|
||||||
|
@ -157,7 +163,7 @@ public class CloudDnsWriter implements DnsWriter {
|
||||||
domainRecords.add(
|
domainRecords.add(
|
||||||
new ResourceRecordSet()
|
new ResourceRecordSet()
|
||||||
.setName(absoluteDomainName)
|
.setName(absoluteDomainName)
|
||||||
.setTtl((int) defaultTtl.getStandardSeconds())
|
.setTtl((int) defaultNsTtl.getStandardSeconds())
|
||||||
.setType("NS")
|
.setType("NS")
|
||||||
.setKind("dns#resourceRecordSet")
|
.setKind("dns#resourceRecordSet")
|
||||||
.setRrdatas(ImmutableList.copyOf(nsRrData)));
|
.setRrdatas(ImmutableList.copyOf(nsRrData)));
|
||||||
|
@ -204,7 +210,7 @@ public class CloudDnsWriter implements DnsWriter {
|
||||||
domainRecords.add(
|
domainRecords.add(
|
||||||
new ResourceRecordSet()
|
new ResourceRecordSet()
|
||||||
.setName(absoluteHostName)
|
.setName(absoluteHostName)
|
||||||
.setTtl((int) defaultTtl.getStandardSeconds())
|
.setTtl((int) defaultATtl.getStandardSeconds())
|
||||||
.setType("A")
|
.setType("A")
|
||||||
.setKind("dns#resourceRecordSet")
|
.setKind("dns#resourceRecordSet")
|
||||||
.setRrdatas(ImmutableList.copyOf(aRrData)));
|
.setRrdatas(ImmutableList.copyOf(aRrData)));
|
||||||
|
@ -214,7 +220,7 @@ public class CloudDnsWriter implements DnsWriter {
|
||||||
domainRecords.add(
|
domainRecords.add(
|
||||||
new ResourceRecordSet()
|
new ResourceRecordSet()
|
||||||
.setName(absoluteHostName)
|
.setName(absoluteHostName)
|
||||||
.setTtl((int) defaultTtl.getStandardSeconds())
|
.setTtl((int) defaultATtl.getStandardSeconds())
|
||||||
.setType("AAAA")
|
.setType("AAAA")
|
||||||
.setKind("dns#resourceRecordSet")
|
.setKind("dns#resourceRecordSet")
|
||||||
.setRrdatas(ImmutableList.copyOf(aaaaRrData)));
|
.setRrdatas(ImmutableList.copyOf(aaaaRrData)));
|
||||||
|
|
|
@ -41,13 +41,4 @@ public class DnsUpdateConfigModule {
|
||||||
public static Duration provideDnsUpdateTimeout() {
|
public static Duration provideDnsUpdateTimeout() {
|
||||||
return Duration.standardSeconds(30);
|
return Duration.standardSeconds(30);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The DNS time-to-live (TTL) for resource records created by the registry.
|
|
||||||
*/
|
|
||||||
@Provides
|
|
||||||
@Config("dnsUpdateTimeToLive")
|
|
||||||
public static Duration provideDnsUpdateTimeToLive() {
|
|
||||||
return Duration.standardHours(2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,9 @@ public class DnsUpdateWriter implements DnsWriter {
|
||||||
*/
|
*/
|
||||||
public static final String NAME = "DnsUpdateWriter";
|
public static final String NAME = "DnsUpdateWriter";
|
||||||
|
|
||||||
private final Duration dnsTimeToLive;
|
private final Duration dnsDefaultATtl;
|
||||||
|
private final Duration dnsDefaultNsTtl;
|
||||||
|
private final Duration dnsDefaultDsTtl;
|
||||||
private final DnsMessageTransport transport;
|
private final DnsMessageTransport transport;
|
||||||
private final Clock clock;
|
private final Clock clock;
|
||||||
|
|
||||||
|
@ -94,10 +96,14 @@ public class DnsUpdateWriter implements DnsWriter {
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
public DnsUpdateWriter(
|
public DnsUpdateWriter(
|
||||||
@Config("dnsUpdateTimeToLive") Duration dnsTimeToLive,
|
@Config("dnsDefaultATtl") Duration dnsDefaultATtl,
|
||||||
|
@Config("dnsDefaultNsTtl") Duration dnsDefaultNsTtl,
|
||||||
|
@Config("dnsDefaultDsTtl") Duration dnsDefaultDsTtl,
|
||||||
DnsMessageTransport transport,
|
DnsMessageTransport transport,
|
||||||
Clock clock) {
|
Clock clock) {
|
||||||
this.dnsTimeToLive = dnsTimeToLive;
|
this.dnsDefaultATtl = dnsDefaultATtl;
|
||||||
|
this.dnsDefaultNsTtl = dnsDefaultNsTtl;
|
||||||
|
this.dnsDefaultDsTtl = dnsDefaultDsTtl;
|
||||||
this.transport = transport;
|
this.transport = transport;
|
||||||
this.clock = clock;
|
this.clock = clock;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +181,7 @@ public class DnsUpdateWriter implements DnsWriter {
|
||||||
new DSRecord(
|
new DSRecord(
|
||||||
toAbsoluteName(domain.getFullyQualifiedDomainName()),
|
toAbsoluteName(domain.getFullyQualifiedDomainName()),
|
||||||
DClass.IN,
|
DClass.IN,
|
||||||
dnsTimeToLive.getStandardSeconds(),
|
dnsDefaultDsTtl.getStandardSeconds(),
|
||||||
signerData.getKeyTag(),
|
signerData.getKeyTag(),
|
||||||
signerData.getAlgorithm(),
|
signerData.getAlgorithm(),
|
||||||
signerData.getDigestType(),
|
signerData.getDigestType(),
|
||||||
|
@ -215,7 +221,7 @@ public class DnsUpdateWriter implements DnsWriter {
|
||||||
new NSRecord(
|
new NSRecord(
|
||||||
toAbsoluteName(domain.getFullyQualifiedDomainName()),
|
toAbsoluteName(domain.getFullyQualifiedDomainName()),
|
||||||
DClass.IN,
|
DClass.IN,
|
||||||
dnsTimeToLive.getStandardSeconds(),
|
dnsDefaultNsTtl.getStandardSeconds(),
|
||||||
toAbsoluteName(hostName));
|
toAbsoluteName(hostName));
|
||||||
nameServerSet.addRR(record);
|
nameServerSet.addRR(record);
|
||||||
}
|
}
|
||||||
|
@ -230,7 +236,7 @@ public class DnsUpdateWriter implements DnsWriter {
|
||||||
new ARecord(
|
new ARecord(
|
||||||
toAbsoluteName(host.getFullyQualifiedHostName()),
|
toAbsoluteName(host.getFullyQualifiedHostName()),
|
||||||
DClass.IN,
|
DClass.IN,
|
||||||
dnsTimeToLive.getStandardSeconds(),
|
dnsDefaultATtl.getStandardSeconds(),
|
||||||
address);
|
address);
|
||||||
addressSet.addRR(record);
|
addressSet.addRR(record);
|
||||||
}
|
}
|
||||||
|
@ -246,7 +252,7 @@ public class DnsUpdateWriter implements DnsWriter {
|
||||||
new AAAARecord(
|
new AAAARecord(
|
||||||
toAbsoluteName(host.getFullyQualifiedHostName()),
|
toAbsoluteName(host.getFullyQualifiedHostName()),
|
||||||
DClass.IN,
|
DClass.IN,
|
||||||
dnsTimeToLive.getStandardSeconds(),
|
dnsDefaultATtl.getStandardSeconds(),
|
||||||
address);
|
address);
|
||||||
addressSet.addRR(record);
|
addressSet.addRR(record);
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,21 +97,14 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
/** Format for A and AAAA records. */
|
/** Format for A and AAAA records. */
|
||||||
private static final String A_FORMAT = "%s\t%d\tIN\t%s\t%s\n";
|
private static final String A_FORMAT = "%s\t%d\tIN\t%s\t%s\n";
|
||||||
|
|
||||||
// TODO(b/20454352): Overhaul TTL configuration mechanism.
|
|
||||||
/** The time to live for exported NS record, in seconds. */
|
|
||||||
private static final int TTL_NS = 180;
|
|
||||||
|
|
||||||
/** The time to live for exported DS record, in seconds. */
|
|
||||||
private static final int TTL_DS = 86400;
|
|
||||||
|
|
||||||
/** The time to live for exported A/AAAA record, in seconds. */
|
|
||||||
private static final int TTL_A = 3600;
|
|
||||||
|
|
||||||
@Inject MapreduceRunner mrRunner;
|
@Inject MapreduceRunner mrRunner;
|
||||||
@Inject JsonActionRunner jsonActionRunner;
|
@Inject JsonActionRunner jsonActionRunner;
|
||||||
@Inject @Config("zoneFilesBucket") String bucket;
|
@Inject @Config("zoneFilesBucket") String bucket;
|
||||||
@Inject @Config("gcsBufferSize") int gcsBufferSize;
|
@Inject @Config("gcsBufferSize") int gcsBufferSize;
|
||||||
@Inject @Config("commitLogDatastoreRetention") Duration datastoreRetention;
|
@Inject @Config("commitLogDatastoreRetention") Duration datastoreRetention;
|
||||||
|
@Inject @Config("dnsDefaultATtl") Duration dnsDefaultATtl;
|
||||||
|
@Inject @Config("dnsDefaultNsTtl") Duration dnsDefaultNsTtl;
|
||||||
|
@Inject @Config("dnsDefaultDsTtl") Duration dnsDefaultDsTtl;
|
||||||
@Inject Clock clock;
|
@Inject Clock clock;
|
||||||
@Inject GenerateZoneFilesAction() {}
|
@Inject GenerateZoneFilesAction() {}
|
||||||
|
|
||||||
|
@ -145,7 +138,8 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
.setModuleName("tools")
|
.setModuleName("tools")
|
||||||
.setDefaultReduceShards(tlds.size())
|
.setDefaultReduceShards(tlds.size())
|
||||||
.runMapreduce(
|
.runMapreduce(
|
||||||
new GenerateBindFileMapper(tlds, exportTime),
|
new GenerateBindFileMapper(
|
||||||
|
tlds, exportTime, dnsDefaultATtl, dnsDefaultNsTtl, dnsDefaultDsTtl),
|
||||||
new GenerateBindFileReducer(bucket, exportTime, gcsBufferSize),
|
new GenerateBindFileReducer(bucket, exportTime, gcsBufferSize),
|
||||||
ImmutableList.of(
|
ImmutableList.of(
|
||||||
new NullInput<EppResource>(),
|
new NullInput<EppResource>(),
|
||||||
|
@ -173,10 +167,21 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
|
|
||||||
private final ImmutableSet<String> tlds;
|
private final ImmutableSet<String> tlds;
|
||||||
private final DateTime exportTime;
|
private final DateTime exportTime;
|
||||||
|
private final Duration dnsDefaultATtl;
|
||||||
|
private final Duration dnsDefaultNsTtl;
|
||||||
|
private final Duration dnsDefaultDsTtl;
|
||||||
|
|
||||||
GenerateBindFileMapper(ImmutableSet<String> tlds, DateTime exportTime) {
|
GenerateBindFileMapper(
|
||||||
|
ImmutableSet<String> tlds,
|
||||||
|
DateTime exportTime,
|
||||||
|
Duration dnsDefaultATtl,
|
||||||
|
Duration dnsDefaultNsTtl,
|
||||||
|
Duration dnsDefaultDsTtl) {
|
||||||
this.tlds = tlds;
|
this.tlds = tlds;
|
||||||
this.exportTime = exportTime;
|
this.exportTime = exportTime;
|
||||||
|
this.dnsDefaultATtl = dnsDefaultATtl;
|
||||||
|
this.dnsDefaultNsTtl = dnsDefaultNsTtl;
|
||||||
|
this.dnsDefaultDsTtl = dnsDefaultDsTtl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -198,7 +203,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
domain = loadAtPointInTime(domain, exportTime).now();
|
domain = loadAtPointInTime(domain, exportTime).now();
|
||||||
// A null means the domain was deleted (or not created) at this time.
|
// A null means the domain was deleted (or not created) at this time.
|
||||||
if (domain != null && domain.shouldPublishToDns()) {
|
if (domain != null && domain.shouldPublishToDns()) {
|
||||||
String stanza = domainStanza(domain, exportTime);
|
String stanza = domainStanza(domain, exportTime, dnsDefaultNsTtl, dnsDefaultDsTtl);
|
||||||
if (!stanza.isEmpty()) {
|
if (!stanza.isEmpty()) {
|
||||||
emit(domain.getTld(), stanza);
|
emit(domain.getTld(), stanza);
|
||||||
getContext().incrementCounter(domain.getTld() + " domains");
|
getContext().incrementCounter(domain.getTld() + " domains");
|
||||||
|
@ -214,7 +219,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
String fullyQualifiedHostName = host.getFullyQualifiedHostName();
|
String fullyQualifiedHostName = host.getFullyQualifiedHostName();
|
||||||
for (String tld : tlds) {
|
for (String tld : tlds) {
|
||||||
if (fullyQualifiedHostName.endsWith("." + tld)) {
|
if (fullyQualifiedHostName.endsWith("." + tld)) {
|
||||||
String stanza = hostStanza(host);
|
String stanza = hostStanza(host, dnsDefaultATtl);
|
||||||
if (!stanza.isEmpty()) {
|
if (!stanza.isEmpty()) {
|
||||||
emit(tld, stanza);
|
emit(tld, stanza);
|
||||||
getContext().incrementCounter(tld + " hosts");
|
getContext().incrementCounter(tld + " hosts");
|
||||||
|
@ -272,13 +277,17 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
* foo.tld 86400 IN DS 1 2 3 000102
|
* foo.tld 86400 IN DS 1 2 3 000102
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
private static String domainStanza(DomainResource domain, DateTime exportTime) {
|
private static String domainStanza(
|
||||||
|
DomainResource domain,
|
||||||
|
DateTime exportTime,
|
||||||
|
Duration dnsDefaultNsTtl,
|
||||||
|
Duration dnsDefaultDsTtl) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
for (HostResource nameserver : ofy().load().keys(domain.getNameservers()).values()) {
|
for (HostResource nameserver : ofy().load().keys(domain.getNameservers()).values()) {
|
||||||
result.append(String.format(
|
result.append(String.format(
|
||||||
NS_FORMAT,
|
NS_FORMAT,
|
||||||
domain.getFullyQualifiedDomainName(),
|
domain.getFullyQualifiedDomainName(),
|
||||||
TTL_NS,
|
dnsDefaultNsTtl.getStandardSeconds(),
|
||||||
// Load the nameservers at the export time in case they've been renamed or deleted.
|
// Load the nameservers at the export time in case they've been renamed or deleted.
|
||||||
loadAtPointInTime(nameserver, exportTime).now().getFullyQualifiedHostName()));
|
loadAtPointInTime(nameserver, exportTime).now().getFullyQualifiedHostName()));
|
||||||
}
|
}
|
||||||
|
@ -286,7 +295,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
result.append(String.format(
|
result.append(String.format(
|
||||||
DS_FORMAT,
|
DS_FORMAT,
|
||||||
domain.getFullyQualifiedDomainName(),
|
domain.getFullyQualifiedDomainName(),
|
||||||
TTL_DS,
|
dnsDefaultDsTtl.getStandardSeconds(),
|
||||||
dsData.getKeyTag(),
|
dsData.getKeyTag(),
|
||||||
dsData.getAlgorithm(),
|
dsData.getAlgorithm(),
|
||||||
dsData.getDigestType(),
|
dsData.getDigestType(),
|
||||||
|
@ -304,7 +313,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
* ns.foo.tld 3600 IN AAAA 0:0:0:0:0:0:0:1
|
* ns.foo.tld 3600 IN AAAA 0:0:0:0:0:0:0:1
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
private static String hostStanza(HostResource host) {
|
private static String hostStanza(HostResource host, Duration dnsDefaultATtl) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
for (InetAddress addr : host.getInetAddresses()) {
|
for (InetAddress addr : host.getInetAddresses()) {
|
||||||
// must be either IPv4 or IPv6
|
// must be either IPv4 or IPv6
|
||||||
|
@ -312,7 +321,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
result.append(String.format(
|
result.append(String.format(
|
||||||
A_FORMAT,
|
A_FORMAT,
|
||||||
host.getFullyQualifiedHostName(),
|
host.getFullyQualifiedHostName(),
|
||||||
TTL_A,
|
dnsDefaultATtl.getStandardSeconds(),
|
||||||
rrSetClass,
|
rrSetClass,
|
||||||
addr.getHostAddress()));
|
addr.getHostAddress()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,9 @@ public class CloudDnsWriterTest {
|
||||||
private static final Inet6Address IPv6 = (Inet6Address) InetAddresses.forString("::1");
|
private static final Inet6Address IPv6 = (Inet6Address) InetAddresses.forString("::1");
|
||||||
private static final DelegationSignerData DS_DATA =
|
private static final DelegationSignerData DS_DATA =
|
||||||
DelegationSignerData.create(12345, 3, 1, base16().decode("1234567890ABCDEF"));
|
DelegationSignerData.create(12345, 3, 1, base16().decode("1234567890ABCDEF"));
|
||||||
private static final Duration DEFAULT_TTL = Duration.standardSeconds(180);
|
private static final Duration DEFAULT_A_TTL = Duration.standardSeconds(11);
|
||||||
|
private static final Duration DEFAULT_NS_TTL = Duration.standardSeconds(222);
|
||||||
|
private static final Duration DEFAULT_DS_TTL = Duration.standardSeconds(3333);
|
||||||
|
|
||||||
@Mock private Dns dnsConnection;
|
@Mock private Dns dnsConnection;
|
||||||
@Mock private Dns.ResourceRecordSets resourceRecordSets;
|
@Mock private Dns.ResourceRecordSets resourceRecordSets;
|
||||||
|
@ -101,7 +103,9 @@ public class CloudDnsWriterTest {
|
||||||
dnsConnection,
|
dnsConnection,
|
||||||
"projectId",
|
"projectId",
|
||||||
"zoneName",
|
"zoneName",
|
||||||
DEFAULT_TTL,
|
DEFAULT_A_TTL,
|
||||||
|
DEFAULT_NS_TTL,
|
||||||
|
DEFAULT_DS_TTL,
|
||||||
RateLimiter.create(20),
|
RateLimiter.create(20),
|
||||||
new SystemClock(),
|
new SystemClock(),
|
||||||
new Retrier(new SystemSleeper(), 5));
|
new Retrier(new SystemSleeper(), 5));
|
||||||
|
@ -196,7 +200,7 @@ public class CloudDnsWriterTest {
|
||||||
.setKind("dns#resourceRecordSet")
|
.setKind("dns#resourceRecordSet")
|
||||||
.setType("NS")
|
.setType("NS")
|
||||||
.setName(domainName + ".")
|
.setName(domainName + ".")
|
||||||
.setTtl((int) DEFAULT_TTL.getStandardSeconds())
|
.setTtl((int) DEFAULT_NS_TTL.getStandardSeconds())
|
||||||
.setRrdatas(nameserverHostnames.build()));
|
.setRrdatas(nameserverHostnames.build()));
|
||||||
|
|
||||||
// Add glue for IPv4 in-bailiwick nameservers
|
// Add glue for IPv4 in-bailiwick nameservers
|
||||||
|
@ -206,7 +210,7 @@ public class CloudDnsWriterTest {
|
||||||
.setKind("dns#resourceRecordSet")
|
.setKind("dns#resourceRecordSet")
|
||||||
.setType("A")
|
.setType("A")
|
||||||
.setName(i + ".ip4." + domainName + ".")
|
.setName(i + ".ip4." + domainName + ".")
|
||||||
.setTtl((int) DEFAULT_TTL.getStandardSeconds())
|
.setTtl((int) DEFAULT_A_TTL.getStandardSeconds())
|
||||||
.setRrdatas(ImmutableList.of(IPv4.toString())));
|
.setRrdatas(ImmutableList.of(IPv4.toString())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,7 +227,7 @@ public class CloudDnsWriterTest {
|
||||||
.setKind("dns#resourceRecordSet")
|
.setKind("dns#resourceRecordSet")
|
||||||
.setType("NS")
|
.setType("NS")
|
||||||
.setName(domainName + ".")
|
.setName(domainName + ".")
|
||||||
.setTtl((int) DEFAULT_TTL.getStandardSeconds())
|
.setTtl((int) DEFAULT_NS_TTL.getStandardSeconds())
|
||||||
.setRrdatas(nameserverHostnames.build()));
|
.setRrdatas(nameserverHostnames.build()));
|
||||||
|
|
||||||
// Add glue for IPv6 in-bailiwick nameservers
|
// Add glue for IPv6 in-bailiwick nameservers
|
||||||
|
@ -233,7 +237,7 @@ public class CloudDnsWriterTest {
|
||||||
.setKind("dns#resourceRecordSet")
|
.setKind("dns#resourceRecordSet")
|
||||||
.setType("AAAA")
|
.setType("AAAA")
|
||||||
.setName(i + ".ip6." + domainName + ".")
|
.setName(i + ".ip6." + domainName + ".")
|
||||||
.setTtl((int) DEFAULT_TTL.getStandardSeconds())
|
.setTtl((int) DEFAULT_A_TTL.getStandardSeconds())
|
||||||
.setRrdatas(ImmutableList.of(IPv6.toString())));
|
.setRrdatas(ImmutableList.of(IPv6.toString())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,7 +254,7 @@ public class CloudDnsWriterTest {
|
||||||
.setKind("dns#resourceRecordSet")
|
.setKind("dns#resourceRecordSet")
|
||||||
.setType("NS")
|
.setType("NS")
|
||||||
.setName(domainName + ".")
|
.setName(domainName + ".")
|
||||||
.setTtl((int) DEFAULT_TTL.getStandardSeconds())
|
.setTtl((int) DEFAULT_NS_TTL.getStandardSeconds())
|
||||||
.setRrdatas(nameserverHostnames.build()));
|
.setRrdatas(nameserverHostnames.build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +273,7 @@ public class CloudDnsWriterTest {
|
||||||
.setKind("dns#resourceRecordSet")
|
.setKind("dns#resourceRecordSet")
|
||||||
.setType("DS")
|
.setType("DS")
|
||||||
.setName(domainName + ".")
|
.setName(domainName + ".")
|
||||||
.setTtl((int) DEFAULT_TTL.getStandardSeconds())
|
.setTtl((int) DEFAULT_DS_TTL.getStandardSeconds())
|
||||||
.setRrdatas(dsRecordData.build()));
|
.setRrdatas(dsRecordData.build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class DnsUpdateWriterTest {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
when(mockResolver.send(any(Update.class))).thenReturn(messageWithResponseCode(Rcode.NOERROR));
|
when(mockResolver.send(any(Update.class))).thenReturn(messageWithResponseCode(Rcode.NOERROR));
|
||||||
|
|
||||||
writer = new DnsUpdateWriter(Duration.ZERO, mockResolver, clock);
|
writer = new DnsUpdateWriter(Duration.ZERO, Duration.ZERO, Duration.ZERO, mockResolver, clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -45,6 +45,7 @@ import java.net.InetAddress;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.DateTimeZone;
|
import org.joda.time.DateTimeZone;
|
||||||
|
import org.joda.time.Duration;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.JUnit4;
|
import org.junit.runners.JUnit4;
|
||||||
|
@ -112,6 +113,9 @@ public class GenerateZoneFilesActionTest extends MapreduceTestCase<GenerateZoneF
|
||||||
action.bucket = "zonefiles-bucket";
|
action.bucket = "zonefiles-bucket";
|
||||||
action.gcsBufferSize = 123;
|
action.gcsBufferSize = 123;
|
||||||
action.datastoreRetention = standardDays(29);
|
action.datastoreRetention = standardDays(29);
|
||||||
|
action.dnsDefaultATtl = Duration.standardSeconds(11);
|
||||||
|
action.dnsDefaultNsTtl = Duration.standardSeconds(222);
|
||||||
|
action.dnsDefaultDsTtl = Duration.standardSeconds(3333);
|
||||||
action.clock = new FakeClock(now.plusMinutes(2)); // Move past the actions' 2 minute check.
|
action.clock = new FakeClock(now.plusMinutes(2)); // Move past the actions' 2 minute check.
|
||||||
|
|
||||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.<String, Object>of(
|
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.<String, Object>of(
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
$ORIGIN tld.
|
$ORIGIN tld.
|
||||||
|
|
||||||
ns.bar.tld 3600 IN A 127.0.0.1
|
ns.bar.tld 11 IN A 127.0.0.1
|
||||||
ns.bar.tld 3600 IN AAAA 0:0:0:0:0:0:0:1
|
ns.bar.tld 11 IN AAAA 0:0:0:0:0:0:0:1
|
||||||
|
|
||||||
ns-only.tld 180 IN NS ns.foo.tld.
|
ns-only.tld 222 IN NS ns.foo.tld.
|
||||||
ns-only.tld 180 IN NS ns.bar.tld.
|
ns-only.tld 222 IN NS ns.bar.tld.
|
||||||
|
|
||||||
ns-and-ds.tld 180 IN NS ns.foo.tld.
|
ns-and-ds.tld 222 IN NS ns.foo.tld.
|
||||||
ns-and-ds.tld 180 IN NS ns.bar.tld.
|
ns-and-ds.tld 222 IN NS ns.bar.tld.
|
||||||
ns-and-ds.tld 86400 IN DS 1 2 3 000102
|
ns-and-ds.tld 3333 IN DS 1 2 3 000102
|
||||||
|
|
||||||
ns.foo.tld 3600 IN A 127.0.0.1
|
ns.foo.tld 11 IN A 127.0.0.1
|
||||||
ns.foo.tld 3600 IN AAAA 0:0:0:0:0:0:0:1
|
ns.foo.tld 11 IN AAAA 0:0:0:0:0:0:0:1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue