aboutsummaryrefslogtreecommitdiff
path: root/middleware/fs_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'middleware/fs_test.go')
-rw-r--r--middleware/fs_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/middleware/fs_test.go b/middleware/fs_test.go
new file mode 100644
index 000000000..44133c4eb
--- /dev/null
+++ b/middleware/fs_test.go
@@ -0,0 +1,19 @@
+package middleware
+
+import (
+ "os"
+ "strings"
+ "testing"
+)
+
+func TestfsPath(t *testing.T) {
+ if actual := fsPath(); !strings.HasSuffix(actual, ".coredns") {
+ t.Errorf("Expected path to be a .coredns folder, got: %v", actual)
+ }
+
+ os.Setenv("COREDNSPATH", "testpath")
+ defer os.Setenv("COREDNSPATH", "")
+ if actual, expected := fsPath(), "testpath"; actual != expected {
+ t.Errorf("Expected path to be %v, got: %v", expected, actual)
+ }
+}