mirror of
https://github.com/coredns/coredns.git
synced 2025-12-07 10:55:17 -05:00
fix: convert key to domain (#5064)
fix convert key to domain when key ends with '/'
This commit is contained in:
@@ -10,3 +10,15 @@ func TestPath(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDomain(t *testing.T) {
|
||||
result1 := Domain("/skydns/local/cluster/staging/service/")
|
||||
if result1 != "service.staging.cluster.local." {
|
||||
t.Errorf("Failure to get domain from etcd key (with a trailing '/'), expect: 'service.staging.cluster.local.', actually get: '%s'", result1)
|
||||
}
|
||||
|
||||
result2 := Domain("/skydns/local/cluster/staging/service")
|
||||
if result2 != "service.staging.cluster.local." {
|
||||
t.Errorf("Failure to get domain from etcd key (without trailing '/'), expect: 'service.staging.cluster.local.' actually get: '%s'", result2)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user