|
@@ -27,3 +27,34 @@ func TestMergeLxcConfig(t *testing.T) {
|
|
|
t.Fatalf("expected %s got %s", expected, cpuset)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+func TestRemoveLocalDns(t *testing.T) {
|
|
|
+ ns0 := "nameserver 10.16.60.14\nnameserver 10.16.60.21\n"
|
|
|
+
|
|
|
+ if result := utils.RemoveLocalDns([]byte(ns0)); result != nil {
|
|
|
+ if ns0 != string(result) {
|
|
|
+ t.Fatalf("Failed No Localhost: expected \n<%s> got \n<%s>", ns0, string(result))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ns1 := "nameserver 10.16.60.14\nnameserver 10.16.60.21\nnameserver 127.0.0.1\n"
|
|
|
+ if result := utils.RemoveLocalDns([]byte(ns1)); result != nil {
|
|
|
+ if ns0 != string(result) {
|
|
|
+ t.Fatalf("Failed Localhost: expected \n<%s> got \n<%s>", ns0, string(result))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ns1 = "nameserver 10.16.60.14\nnameserver 127.0.0.1\nnameserver 10.16.60.21\n"
|
|
|
+ if result := utils.RemoveLocalDns([]byte(ns1)); result != nil {
|
|
|
+ if ns0 != string(result) {
|
|
|
+ t.Fatalf("Failed Localhost: expected \n<%s> got \n<%s>", ns0, string(result))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ns1 = "nameserver 127.0.1.1\nnameserver 10.16.60.14\nnameserver 10.16.60.21\n"
|
|
|
+ if result := utils.RemoveLocalDns([]byte(ns1)); result != nil {
|
|
|
+ if ns0 != string(result) {
|
|
|
+ t.Fatalf("Failed Localhost: expected \n<%s> got \n<%s>", ns0, string(result))
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|