Skip to content

Commit 99cb5aa

Browse files
committed
add more tests to get better coverage
1 parent a4d1329 commit 99cb5aa

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

provider/aws/aws_test.go

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,27 @@ func TestAWSApplyChanges(t *testing.T) {
886886
TTL: aws.Int64(defaultTTL),
887887
ResourceRecords: []route53types.ResourceRecord{{Value: aws.String("2606:4700:4700::1111")}, {Value: aws.String("2606:4700:4700::1001")}},
888888
},
889+
{
890+
Name: aws.String("delete-test-geoproximity.zone-2.ext-dns-test-2.teapot.zalan.do."),
891+
Type: route53types.RRTypeA,
892+
TTL: aws.Int64(defaultTTL),
893+
ResourceRecords: []route53types.ResourceRecord{{Value: aws.String("1.2.3.4")}},
894+
SetIdentifier: aws.String("geoproximity-delete"),
895+
GeoProximityLocation: &route53types.GeoProximityLocation{
896+
AWSRegion: aws.String("us-west-2"),
897+
Bias: aws.Int32(10),
898+
},
899+
},
900+
{
901+
Name: aws.String("update-test-geoproximity.zone-1.ext-dns-test-2.teapot.zalan.do."),
902+
Type: route53types.RRTypeA,
903+
TTL: aws.Int64(defaultTTL),
904+
ResourceRecords: []route53types.ResourceRecord{{Value: aws.String("1.2.3.4")}},
905+
SetIdentifier: aws.String("geoproximity-update"),
906+
GeoProximityLocation: &route53types.GeoProximityLocation{
907+
LocalZoneGroup: aws.String("usw2-lax1-az2"),
908+
},
909+
},
889910
{
890911
Name: aws.String("weighted-to-simple.zone-1.ext-dns-test-2.teapot.zalan.do."),
891912
Type: route53types.RRTypeA,
@@ -956,6 +977,13 @@ func TestAWSApplyChanges(t *testing.T) {
956977
endpoint.NewEndpoint("create-test-multiple.zone-2.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "8.8.8.8", "8.8.4.4"),
957978
endpoint.NewEndpoint("create-test-multiple-aaaa.zone-2.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeAAAA, "2606:4700:4700::1111", "2606:4700:4700::1001"),
958979
endpoint.NewEndpoint("create-test-mx.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeMX, "10 mailhost1.foo.elb.amazonaws.com"),
980+
endpoint.NewEndpoint("create-test-geoproximity-region.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "8.8.8.8").
981+
WithSetIdentifier("geoproximity-region").
982+
WithProviderSpecific(providerSpecificGeoProximityLocationAWSRegion, "us-west-2").
983+
WithProviderSpecific(providerSpecificGeoProximityLocationBias, "10"),
984+
endpoint.NewEndpoint("create-test-geoproximity-coordinates.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "8.8.8.8").
985+
WithSetIdentifier("geoproximity-coordinates").
986+
WithProviderSpecific(providerSpecificGeoProximityLocationCoordinates, "60,60"),
959987
}
960988

961989
currentRecords := []*endpoint.Endpoint{
@@ -971,6 +999,9 @@ func TestAWSApplyChanges(t *testing.T) {
971999
endpoint.NewEndpoint("update-test-cname-alias.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeAAAA, "bar.elb.amazonaws.com").WithProviderSpecific(providerSpecificAlias, "true"),
9721000
endpoint.NewEndpoint("update-test-multiple.zone-2.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "8.8.8.8", "8.8.4.4"),
9731001
endpoint.NewEndpoint("update-test-multiple-aaaa.zone-2.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeAAAA, "2606:4700:4700::1111", "2606:4700:4700::1001"),
1002+
endpoint.NewEndpoint("update-test-geoproximity.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "1.2.3.4").
1003+
WithSetIdentifier("geoproximity-update").
1004+
WithProviderSpecific(providerSpecificGeoProximityLocationLocalZoneGroup, "usw2-lax1-az2"),
9741005
endpoint.NewEndpoint("weighted-to-simple.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "1.2.3.4").WithSetIdentifier("weighted-to-simple").WithProviderSpecific(providerSpecificWeight, "10"),
9751006
endpoint.NewEndpoint("simple-to-weighted.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "1.2.3.4"),
9761007
endpoint.NewEndpoint("policy-change.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "1.2.3.4").WithSetIdentifier("policy-change").WithProviderSpecific(providerSpecificWeight, "10"),
@@ -992,6 +1023,9 @@ func TestAWSApplyChanges(t *testing.T) {
9921023
endpoint.NewEndpoint("update-test-cname-alias.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeAAAA, "baz.elb.amazonaws.com").WithProviderSpecific(providerSpecificAlias, "true"),
9931024
endpoint.NewEndpoint("update-test-multiple.zone-2.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "1.2.3.4", "4.3.2.1"),
9941025
endpoint.NewEndpoint("update-test-multiple-aaaa.zone-2.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeAAAA, "2606:4700:4700::1001", "2606:4700:4700::1111"),
1026+
endpoint.NewEndpoint("update-test-geoproximity.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "1.2.3.4").
1027+
WithSetIdentifier("geoproximity-update").
1028+
WithProviderSpecific(providerSpecificGeoProximityLocationLocalZoneGroup, "usw2-phx2-az1"),
9951029
endpoint.NewEndpoint("weighted-to-simple.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "1.2.3.4"),
9961030
endpoint.NewEndpoint("simple-to-weighted.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "1.2.3.4").WithSetIdentifier("simple-to-weighted").WithProviderSpecific(providerSpecificWeight, "10"),
9971031
endpoint.NewEndpoint("policy-change.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "1.2.3.4").WithSetIdentifier("policy-change").WithProviderSpecific(providerSpecificRegion, "us-east-1"),
@@ -1010,6 +1044,7 @@ func TestAWSApplyChanges(t *testing.T) {
10101044
endpoint.NewEndpoint("delete-test-cname-alias.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeAAAA, "qux.elb.amazonaws.com").WithProviderSpecific(providerSpecificAlias, "true"),
10111045
endpoint.NewEndpoint("delete-test-multiple.zone-2.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "1.2.3.4", "4.3.2.1"),
10121046
endpoint.NewEndpoint("delete-test-multiple-aaaa.zone-2.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeAAAA, "2606:4700:4700::1111", "2606:4700:4700::1001"),
1047+
endpoint.NewEndpoint("delete-test-geoproximity.zone-2.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "1.2.3.4").WithSetIdentifier("geoproximity-delete").WithProviderSpecific(providerSpecificGeoProximityLocationAWSRegion, "us-west-2").WithProviderSpecific(providerSpecificGeoProximityLocationBias, "10"),
10131048
endpoint.NewEndpoint("delete-test-mx.zone-2.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeMX, "30 mailhost1.foo.elb.amazonaws.com"),
10141049
}
10151050

@@ -1159,6 +1194,40 @@ func TestAWSApplyChanges(t *testing.T) {
11591194
TTL: aws.Int64(defaultTTL),
11601195
ResourceRecords: []route53types.ResourceRecord{{Value: aws.String("10 mailhost1.foo.elb.amazonaws.com")}},
11611196
},
1197+
{
1198+
Name: aws.String("create-test-geoproximity-region.zone-1.ext-dns-test-2.teapot.zalan.do."),
1199+
Type: route53types.RRTypeA,
1200+
TTL: aws.Int64(defaultTTL),
1201+
ResourceRecords: []route53types.ResourceRecord{{Value: aws.String("8.8.8.8")}},
1202+
SetIdentifier: aws.String("geoproximity-region"),
1203+
GeoProximityLocation: &route53types.GeoProximityLocation{
1204+
AWSRegion: aws.String("us-west-2"),
1205+
Bias: aws.Int32(10),
1206+
},
1207+
},
1208+
{
1209+
Name: aws.String("update-test-geoproximity.zone-1.ext-dns-test-2.teapot.zalan.do."),
1210+
Type: route53types.RRTypeA,
1211+
TTL: aws.Int64(defaultTTL),
1212+
ResourceRecords: []route53types.ResourceRecord{{Value: aws.String("1.2.3.4")}},
1213+
SetIdentifier: aws.String("geoproximity-update"),
1214+
GeoProximityLocation: &route53types.GeoProximityLocation{
1215+
LocalZoneGroup: aws.String("usw2-phx2-az1"),
1216+
},
1217+
},
1218+
{
1219+
Name: aws.String("create-test-geoproximity-coordinates.zone-1.ext-dns-test-2.teapot.zalan.do."),
1220+
Type: route53types.RRTypeA,
1221+
TTL: aws.Int64(defaultTTL),
1222+
ResourceRecords: []route53types.ResourceRecord{{Value: aws.String("8.8.8.8")}},
1223+
SetIdentifier: aws.String("geoproximity-coordinates"),
1224+
GeoProximityLocation: &route53types.GeoProximityLocation{
1225+
Coordinates: &route53types.Coordinates{
1226+
Latitude: aws.String("60"),
1227+
Longitude: aws.String("60"),
1228+
},
1229+
},
1230+
},
11621231
})
11631232
validateRecords(t, listAWSRecords(t, provider.clients[defaultAWSProfile], "/hostedzone/zone-2.ext-dns-test-2.teapot.zalan.do."), []route53types.ResourceRecordSet{
11641233
{

0 commit comments

Comments
 (0)