@@ -926,6 +926,95 @@ func TestCheckEndpoint(t *testing.T) {
926926 },
927927 expected : true ,
928928 },
929+ {
930+ description : "A record with alias=true is valid" ,
931+ endpoint : Endpoint {
932+ DNSName : "example.com" ,
933+ RecordType : RecordTypeA ,
934+ Targets : Targets {"my-elb-123.us-east-1.elb.amazonaws.com" },
935+ ProviderSpecific : ProviderSpecific {{Name : "alias" , Value : "true" }},
936+ },
937+ expected : true ,
938+ },
939+ {
940+ description : "AAAA record with alias=true is valid" ,
941+ endpoint : Endpoint {
942+ DNSName : "example.com" ,
943+ RecordType : RecordTypeAAAA ,
944+ Targets : Targets {"dualstack.my-elb-123.us-east-1.elb.amazonaws.com" },
945+ ProviderSpecific : ProviderSpecific {{Name : "alias" , Value : "true" }},
946+ },
947+ expected : true ,
948+ },
949+ {
950+ description : "CNAME record with alias=true is valid" ,
951+ endpoint : Endpoint {
952+ DNSName : "example.com" ,
953+ RecordType : RecordTypeCNAME ,
954+ Targets : Targets {"d111111abcdef8.cloudfront.net" },
955+ ProviderSpecific : ProviderSpecific {{Name : "alias" , Value : "true" }},
956+ },
957+ expected : true ,
958+ },
959+ {
960+ description : "MX record with alias=true is invalid" ,
961+ endpoint : Endpoint {
962+ DNSName : "example.com" ,
963+ RecordType : RecordTypeMX ,
964+ Targets : Targets {"10 mail.example.com" },
965+ ProviderSpecific : ProviderSpecific {{Name : "alias" , Value : "true" }},
966+ },
967+ expected : false ,
968+ },
969+ {
970+ description : "TXT record with alias=true is invalid" ,
971+ endpoint : Endpoint {
972+ DNSName : "example.com" ,
973+ RecordType : RecordTypeTXT ,
974+ Targets : Targets {"v=spf1 ~all" },
975+ ProviderSpecific : ProviderSpecific {{Name : "alias" , Value : "true" }},
976+ },
977+ expected : false ,
978+ },
979+ {
980+ description : "NS record with alias=true is invalid" ,
981+ endpoint : Endpoint {
982+ DNSName : "example.com" ,
983+ RecordType : RecordTypeNS ,
984+ Targets : Targets {"ns1.example.com" },
985+ ProviderSpecific : ProviderSpecific {{Name : "alias" , Value : "true" }},
986+ },
987+ expected : false ,
988+ },
989+ {
990+ description : "SRV record with alias=true is invalid" ,
991+ endpoint : Endpoint {
992+ DNSName : "_sip._tcp.example.com" ,
993+ RecordType : RecordTypeSRV ,
994+ Targets : Targets {"10 5 5060 sip.example.com." },
995+ ProviderSpecific : ProviderSpecific {{Name : "alias" , Value : "true" }},
996+ },
997+ expected : false ,
998+ },
999+ {
1000+ description : "MX record with alias=false is valid" ,
1001+ endpoint : Endpoint {
1002+ DNSName : "example.com" ,
1003+ RecordType : RecordTypeMX ,
1004+ Targets : Targets {"10 mail.example.com" },
1005+ ProviderSpecific : ProviderSpecific {{Name : "alias" , Value : "false" }},
1006+ },
1007+ expected : true ,
1008+ },
1009+ {
1010+ description : "MX record without alias property is valid" ,
1011+ endpoint : Endpoint {
1012+ DNSName : "example.com" ,
1013+ RecordType : RecordTypeMX ,
1014+ Targets : Targets {"10 mail.example.com" },
1015+ },
1016+ expected : true ,
1017+ },
9291018 }
9301019
9311020 for _ , tt := range tests {
0 commit comments