mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
ROUTE53: Allow R53_ALIAS records to enable target health evaluation (#2649)
This commit is contained in:
@ -68,3 +68,69 @@ func TestR53Test_2ttl(t *testing.T) {
|
||||
t.Errorf("makeR53alias failure: got `%s` want `%s`", g, w)
|
||||
}
|
||||
}
|
||||
|
||||
func TestR53Test_3(t *testing.T) {
|
||||
rec := models.RecordConfig{
|
||||
Type: "R53_ALIAS",
|
||||
Name: "foo",
|
||||
NameFQDN: "foo.domain.tld",
|
||||
}
|
||||
rec.SetTarget("bar")
|
||||
rec.R53Alias = make(map[string]string)
|
||||
rec.R53Alias["type"] = "A"
|
||||
rec.R53Alias["evaluate_target_health"] = "true"
|
||||
w := `R53_ALIAS("foo", "A", "bar", R53_EVALUATE_TARGET_HEALTH(true))`
|
||||
if g := makeR53alias(&rec, 0); g != w {
|
||||
t.Errorf("makeR53alias failure: got `%s` want `%s`", g, w)
|
||||
}
|
||||
}
|
||||
|
||||
func TestR53Test_3ttl(t *testing.T) {
|
||||
rec := models.RecordConfig{
|
||||
Type: "R53_ALIAS",
|
||||
Name: "foo",
|
||||
NameFQDN: "foo.domain.tld",
|
||||
}
|
||||
rec.SetTarget("bar")
|
||||
rec.R53Alias = make(map[string]string)
|
||||
rec.R53Alias["type"] = "A"
|
||||
rec.R53Alias["evaluate_target_health"] = "true"
|
||||
w := `R53_ALIAS("foo", "A", "bar", R53_EVALUATE_TARGET_HEALTH(true), TTL(123))`
|
||||
if g := makeR53alias(&rec, 123); g != w {
|
||||
t.Errorf("makeR53alias failure: got `%s` want `%s`", g, w)
|
||||
}
|
||||
}
|
||||
|
||||
func TestR53Test_4(t *testing.T) {
|
||||
rec := models.RecordConfig{
|
||||
Type: "R53_ALIAS",
|
||||
Name: "foo",
|
||||
NameFQDN: "foo.domain.tld",
|
||||
}
|
||||
rec.SetTarget("bar")
|
||||
rec.R53Alias = make(map[string]string)
|
||||
rec.R53Alias["type"] = "A"
|
||||
rec.R53Alias["zone_id"] = "blarg"
|
||||
rec.R53Alias["evaluate_target_health"] = "true"
|
||||
w := `R53_ALIAS("foo", "A", "bar", R53_ZONE("blarg"), R53_EVALUATE_TARGET_HEALTH(true))`
|
||||
if g := makeR53alias(&rec, 0); g != w {
|
||||
t.Errorf("makeR53alias failure: got `%s` want `%s`", g, w)
|
||||
}
|
||||
}
|
||||
|
||||
func TestR53Test_4ttl(t *testing.T) {
|
||||
rec := models.RecordConfig{
|
||||
Type: "R53_ALIAS",
|
||||
Name: "foo",
|
||||
NameFQDN: "foo.domain.tld",
|
||||
}
|
||||
rec.SetTarget("bar")
|
||||
rec.R53Alias = make(map[string]string)
|
||||
rec.R53Alias["type"] = "A"
|
||||
rec.R53Alias["zone_id"] = "blarg"
|
||||
rec.R53Alias["evaluate_target_health"] = "true"
|
||||
w := `R53_ALIAS("foo", "A", "bar", R53_ZONE("blarg"), R53_EVALUATE_TARGET_HEALTH(true), TTL(123))`
|
||||
if g := makeR53alias(&rec, 123); g != w {
|
||||
t.Errorf("makeR53alias failure: got `%s` want `%s`", g, w)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user