|
|
|
@ -2091,6 +2091,58 @@ class TestRoute53Records(TestCase): |
|
|
|
e.__repr__() |
|
|
|
f.__repr__() |
|
|
|
|
|
|
|
def test_route53_record_ordering(self): |
|
|
|
# Matches |
|
|
|
a = _Route53Record(None, self.record_a, False) |
|
|
|
b = _Route53Record(None, self.record_a, False) |
|
|
|
self.assertTrue(a == b) |
|
|
|
self.assertFalse(a != b) |
|
|
|
self.assertFalse(a < b) |
|
|
|
self.assertTrue(a <= b) |
|
|
|
self.assertFalse(a > b) |
|
|
|
self.assertTrue(a >= b) |
|
|
|
|
|
|
|
# Change the fqdn is greater |
|
|
|
fqdn = _Route53Record(None, self.record_a, False, |
|
|
|
fqdn_override='other') |
|
|
|
self.assertFalse(a == fqdn) |
|
|
|
self.assertTrue(a != fqdn) |
|
|
|
self.assertFalse(a < fqdn) |
|
|
|
self.assertFalse(a <= fqdn) |
|
|
|
self.assertTrue(a > fqdn) |
|
|
|
self.assertTrue(a >= fqdn) |
|
|
|
|
|
|
|
provider = DummyProvider() |
|
|
|
geo_a = _Route53GeoRecord(provider, self.record_a, 'NA-US', |
|
|
|
self.record_a.geo['NA-US'], False) |
|
|
|
geo_b = _Route53GeoRecord(provider, self.record_a, 'NA-US', |
|
|
|
self.record_a.geo['NA-US'], False) |
|
|
|
self.assertTrue(geo_a == geo_b) |
|
|
|
self.assertFalse(geo_a != geo_b) |
|
|
|
self.assertFalse(geo_a < geo_b) |
|
|
|
self.assertTrue(geo_a <= geo_b) |
|
|
|
self.assertFalse(geo_a > geo_b) |
|
|
|
self.assertTrue(geo_a >= geo_b) |
|
|
|
|
|
|
|
# Other base |
|
|
|
geo_fqdn = _Route53GeoRecord(provider, self.record_a, 'NA-US', |
|
|
|
self.record_a.geo['NA-US'], False) |
|
|
|
geo_fqdn.fqdn = 'other' |
|
|
|
self.assertFalse(geo_a == geo_fqdn) |
|
|
|
self.assertTrue(geo_a != geo_fqdn) |
|
|
|
self.assertFalse(geo_a < geo_fqdn) |
|
|
|
self.assertFalse(geo_a <= geo_fqdn) |
|
|
|
self.assertTrue(geo_a > geo_fqdn) |
|
|
|
self.assertTrue(geo_a >= geo_fqdn) |
|
|
|
|
|
|
|
# Other class |
|
|
|
self.assertFalse(a == geo_a) |
|
|
|
self.assertTrue(a != geo_a) |
|
|
|
self.assertFalse(a < geo_a) |
|
|
|
self.assertFalse(a <= geo_a) |
|
|
|
self.assertTrue(a > geo_a) |
|
|
|
self.assertTrue(a >= geo_a) |
|
|
|
|
|
|
|
def test_dynamic_value_delete(self): |
|
|
|
provider = DummyProvider() |
|
|
|
geo = _Route53DynamicValue(provider, self.record_a, 'iad', '2.2.2.2', |
|
|
|
@ -2207,70 +2259,112 @@ class TestRoute53Records(TestCase): |
|
|
|
creating=True) |
|
|
|
self.assertEquals(18, len(route53_records)) |
|
|
|
|
|
|
|
expected_mods = [r.mod('CREATE', []) for r in route53_records] |
|
|
|
# Sort so that we get a consistent order and don't rely on set ordering |
|
|
|
expected_mods.sort(key=_mod_keyer) |
|
|
|
|
|
|
|
# Convert the route53_records into mods |
|
|
|
self.assertEquals([{ |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'HealthCheckId': 'hc42', |
|
|
|
'Name': '_octodns-ap-southeast-1-value.unit.tests.', |
|
|
|
'ResourceRecords': [{ |
|
|
|
'Value': '1.4.1.2'}], |
|
|
|
'SetIdentifier': 'ap-southeast-1-001', |
|
|
|
'ResourceRecords': [{'Value': '1.4.1.1'}], |
|
|
|
'SetIdentifier': 'ap-southeast-1-000', |
|
|
|
'TTL': 60, |
|
|
|
'Type': 'A', |
|
|
|
'Weight': 2 |
|
|
|
} |
|
|
|
'Weight': 2} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'HealthCheckId': 'hc42', |
|
|
|
'Name': '_octodns-ap-southeast-1-value.unit.tests.', |
|
|
|
'ResourceRecords': [{ |
|
|
|
'Value': '1.4.1.1'}], |
|
|
|
'SetIdentifier': 'ap-southeast-1-000', |
|
|
|
'ResourceRecords': [{'Value': '1.4.1.2'}], |
|
|
|
'SetIdentifier': 'ap-southeast-1-001', |
|
|
|
'TTL': 60, |
|
|
|
'Type': 'A', |
|
|
|
'Weight': 2 |
|
|
|
} |
|
|
|
'Weight': 2} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'Name': '_octodns-default-pool.unit.tests.', |
|
|
|
'ResourceRecords': [ |
|
|
|
{'Value': '1.1.2.1'}, |
|
|
|
{'Value': '1.1.2.2'}], |
|
|
|
'TTL': 60, |
|
|
|
'Type': 'A'} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'HealthCheckId': 'hc42', |
|
|
|
'Name': '_octodns-eu-central-1-value.unit.tests.', |
|
|
|
'ResourceRecords': [{'Value': '1.3.1.1'}], |
|
|
|
'SetIdentifier': 'eu-central-1-000', |
|
|
|
'TTL': 60, |
|
|
|
'Type': 'A', |
|
|
|
'Weight': 1} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'HealthCheckId': 'hc42', |
|
|
|
'Name': '_octodns-eu-central-1-value.unit.tests.', |
|
|
|
'ResourceRecords': [{'Value': '1.3.1.2'}], |
|
|
|
'SetIdentifier': 'eu-central-1-001', |
|
|
|
'TTL': 60, |
|
|
|
'Type': 'A', |
|
|
|
'Weight': 1} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'HealthCheckId': 'hc42', |
|
|
|
'Name': '_octodns-us-east-1-value.unit.tests.', |
|
|
|
'ResourceRecords': [{'Value': '1.5.1.1'}], |
|
|
|
'SetIdentifier': 'us-east-1-000', |
|
|
|
'TTL': 60, |
|
|
|
'Type': 'A', |
|
|
|
'Weight': 1} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'HealthCheckId': 'hc42', |
|
|
|
'Name': '_octodns-us-east-1-value.unit.tests.', |
|
|
|
'ResourceRecords': [{'Value': '1.5.1.2'}], |
|
|
|
'SetIdentifier': 'us-east-1-001', |
|
|
|
'TTL': 60, |
|
|
|
'Type': 'A', |
|
|
|
'Weight': 1} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'AliasTarget': { |
|
|
|
'DNSName': '_octodns-ap-southeast-1-pool.unit.tests.', |
|
|
|
'DNSName': '_octodns-ap-southeast-1-value.unit.tests.', |
|
|
|
'EvaluateTargetHealth': True, |
|
|
|
'HostedZoneId': 'z45' |
|
|
|
}, |
|
|
|
'GeoLocation': { |
|
|
|
'CountryCode': 'JP'}, |
|
|
|
'Name': 'unit.tests.', |
|
|
|
'SetIdentifier': '0-ap-southeast-1-AS-JP', |
|
|
|
'Type': 'A' |
|
|
|
} |
|
|
|
'HostedZoneId': 'z45'}, |
|
|
|
'Failover': 'PRIMARY', |
|
|
|
'Name': '_octodns-ap-southeast-1-pool.unit.tests.', |
|
|
|
'SetIdentifier': 'ap-southeast-1-Primary', |
|
|
|
'Type': 'A'} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'AliasTarget': { |
|
|
|
'DNSName': '_octodns-eu-central-1-pool.unit.tests.', |
|
|
|
'DNSName': '_octodns-eu-central-1-value.unit.tests.', |
|
|
|
'EvaluateTargetHealth': True, |
|
|
|
'HostedZoneId': 'z45'}, |
|
|
|
'GeoLocation': { |
|
|
|
'CountryCode': 'US', |
|
|
|
'SubdivisionCode': 'FL', |
|
|
|
}, |
|
|
|
'Name': 'unit.tests.', |
|
|
|
'SetIdentifier': '1-eu-central-1-NA-US-FL', |
|
|
|
'Failover': 'PRIMARY', |
|
|
|
'Name': '_octodns-eu-central-1-pool.unit.tests.', |
|
|
|
'SetIdentifier': 'eu-central-1-Primary', |
|
|
|
'Type': 'A'} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'AliasTarget': { |
|
|
|
'DNSName': '_octodns-us-east-1-pool.unit.tests.', |
|
|
|
'DNSName': '_octodns-us-east-1-value.unit.tests.', |
|
|
|
'EvaluateTargetHealth': True, |
|
|
|
'HostedZoneId': 'z45'}, |
|
|
|
'GeoLocation': { |
|
|
|
'CountryCode': '*'}, |
|
|
|
'Name': 'unit.tests.', |
|
|
|
'SetIdentifier': '2-us-east-1-None', |
|
|
|
'Failover': 'PRIMARY', |
|
|
|
'Name': '_octodns-us-east-1-pool.unit.tests.', |
|
|
|
'SetIdentifier': 'us-east-1-Primary', |
|
|
|
'Type': 'A'} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
@ -2287,123 +2381,72 @@ class TestRoute53Records(TestCase): |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'AliasTarget': { |
|
|
|
'DNSName': '_octodns-ap-southeast-1-pool.unit.tests.', |
|
|
|
'DNSName': '_octodns-us-east-1-pool.unit.tests.', |
|
|
|
'EvaluateTargetHealth': True, |
|
|
|
'HostedZoneId': 'z45'}, |
|
|
|
'GeoLocation': { |
|
|
|
'CountryCode': 'CN'}, |
|
|
|
'Name': 'unit.tests.', |
|
|
|
'SetIdentifier': '0-ap-southeast-1-AS-CN', |
|
|
|
'Failover': 'SECONDARY', |
|
|
|
'Name': '_octodns-eu-central-1-pool.unit.tests.', |
|
|
|
'SetIdentifier': 'eu-central-1-Secondary-us-east-1', |
|
|
|
'Type': 'A'} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'AliasTarget': { |
|
|
|
'DNSName': '_octodns-us-east-1-value.unit.tests.', |
|
|
|
'DNSName': '_octodns-default-pool.unit.tests.', |
|
|
|
'EvaluateTargetHealth': True, |
|
|
|
'HostedZoneId': 'z45'}, |
|
|
|
'Failover': 'PRIMARY', |
|
|
|
'Failover': 'SECONDARY', |
|
|
|
'Name': '_octodns-us-east-1-pool.unit.tests.', |
|
|
|
'SetIdentifier': 'us-east-1-Primary', |
|
|
|
'SetIdentifier': 'us-east-1-Secondary-default', |
|
|
|
'Type': 'A'} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'AliasTarget': { |
|
|
|
'DNSName': '_octodns-eu-central-1-pool.unit.tests.', |
|
|
|
'DNSName': '_octodns-ap-southeast-1-pool.unit.tests.', |
|
|
|
'EvaluateTargetHealth': True, |
|
|
|
'HostedZoneId': 'z45'}, |
|
|
|
'GeoLocation': { |
|
|
|
'ContinentCode': 'EU'}, |
|
|
|
'CountryCode': 'CN'}, |
|
|
|
'Name': 'unit.tests.', |
|
|
|
'SetIdentifier': '1-eu-central-1-EU', |
|
|
|
'SetIdentifier': '0-ap-southeast-1-AS-CN', |
|
|
|
'Type': 'A'} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'AliasTarget': { |
|
|
|
'DNSName': '_octodns-eu-central-1-value.unit.tests.', |
|
|
|
'DNSName': '_octodns-ap-southeast-1-pool.unit.tests.', |
|
|
|
'EvaluateTargetHealth': True, |
|
|
|
'HostedZoneId': 'z45'}, |
|
|
|
'Failover': 'PRIMARY', |
|
|
|
'Name': '_octodns-eu-central-1-pool.unit.tests.', |
|
|
|
'SetIdentifier': 'eu-central-1-Primary', |
|
|
|
'Type': 'A'} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'Name': '_octodns-default-pool.unit.tests.', |
|
|
|
'ResourceRecords': [{ |
|
|
|
'Value': '1.1.2.1'}, |
|
|
|
{ |
|
|
|
'Value': '1.1.2.2'}], |
|
|
|
'TTL': 60, |
|
|
|
'GeoLocation': { |
|
|
|
'CountryCode': 'JP'}, |
|
|
|
'Name': 'unit.tests.', |
|
|
|
'SetIdentifier': '0-ap-southeast-1-AS-JP', |
|
|
|
'Type': 'A'} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'HealthCheckId': 'hc42', |
|
|
|
'Name': '_octodns-eu-central-1-value.unit.tests.', |
|
|
|
'ResourceRecords': [{ |
|
|
|
'Value': '1.3.1.2'}], |
|
|
|
'SetIdentifier': 'eu-central-1-001', |
|
|
|
'TTL': 60, |
|
|
|
'Type': 'A', |
|
|
|
'Weight': 1} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'HealthCheckId': 'hc42', |
|
|
|
'Name': '_octodns-eu-central-1-value.unit.tests.', |
|
|
|
'ResourceRecords': [{ |
|
|
|
'Value': '1.3.1.1'}], |
|
|
|
'SetIdentifier': 'eu-central-1-000', |
|
|
|
'TTL': 60, |
|
|
|
'Type': 'A', |
|
|
|
'Weight': 1} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'AliasTarget': { |
|
|
|
'DNSName': '_octodns-default-pool.unit.tests.', |
|
|
|
'DNSName': '_octodns-eu-central-1-pool.unit.tests.', |
|
|
|
'EvaluateTargetHealth': True, |
|
|
|
'HostedZoneId': 'z45'}, |
|
|
|
'Failover': 'SECONDARY', |
|
|
|
'Name': '_octodns-us-east-1-pool.unit.tests.', |
|
|
|
'SetIdentifier': 'us-east-1-Secondary-default', |
|
|
|
'GeoLocation': { |
|
|
|
'ContinentCode': 'EU'}, |
|
|
|
'Name': 'unit.tests.', |
|
|
|
'SetIdentifier': '1-eu-central-1-EU', |
|
|
|
'Type': 'A'} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'HealthCheckId': 'hc42', |
|
|
|
'Name': '_octodns-us-east-1-value.unit.tests.', |
|
|
|
'ResourceRecords': [{ |
|
|
|
'Value': '1.5.1.2'}], |
|
|
|
'SetIdentifier': 'us-east-1-001', |
|
|
|
'TTL': 60, |
|
|
|
'Type': 'A', |
|
|
|
'Weight': 1} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'HealthCheckId': 'hc42', |
|
|
|
'Name': '_octodns-us-east-1-value.unit.tests.', |
|
|
|
'ResourceRecords': [{ |
|
|
|
'Value': '1.5.1.1'}], |
|
|
|
'SetIdentifier': 'us-east-1-000', |
|
|
|
'TTL': 60, |
|
|
|
'Type': 'A', |
|
|
|
'Weight': 1} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
'ResourceRecordSet': { |
|
|
|
'AliasTarget': { |
|
|
|
'DNSName': '_octodns-ap-southeast-1-value.unit.tests.', |
|
|
|
'DNSName': '_octodns-eu-central-1-pool.unit.tests.', |
|
|
|
'EvaluateTargetHealth': True, |
|
|
|
'HostedZoneId': 'z45'}, |
|
|
|
'Failover': 'PRIMARY', |
|
|
|
'Name': '_octodns-ap-southeast-1-pool.unit.tests.', |
|
|
|
'SetIdentifier': 'ap-southeast-1-Primary', |
|
|
|
'GeoLocation': { |
|
|
|
'CountryCode': 'US', |
|
|
|
'SubdivisionCode': 'FL'}, |
|
|
|
'Name': 'unit.tests.', |
|
|
|
'SetIdentifier': '1-eu-central-1-NA-US-FL', |
|
|
|
'Type': 'A'} |
|
|
|
}, { |
|
|
|
'Action': 'CREATE', |
|
|
|
@ -2412,11 +2455,12 @@ class TestRoute53Records(TestCase): |
|
|
|
'DNSName': '_octodns-us-east-1-pool.unit.tests.', |
|
|
|
'EvaluateTargetHealth': True, |
|
|
|
'HostedZoneId': 'z45'}, |
|
|
|
'Failover': 'SECONDARY', |
|
|
|
'Name': '_octodns-eu-central-1-pool.unit.tests.', |
|
|
|
'SetIdentifier': 'eu-central-1-Secondary-us-east-1', |
|
|
|
'GeoLocation': { |
|
|
|
'CountryCode': '*'}, |
|
|
|
'Name': 'unit.tests.', |
|
|
|
'SetIdentifier': '2-us-east-1-None', |
|
|
|
'Type': 'A'} |
|
|
|
}], [r.mod('CREATE', []) for r in route53_records]) |
|
|
|
}], expected_mods) |
|
|
|
|
|
|
|
for route53_record in route53_records: |
|
|
|
# Smoke test stringification |
|
|
|
|