aboutsummaryrefslogtreecommitdiff
path: root/middleware/fs_test.go
blob: 44133c4eb8e86d917db0f50dc0417597b709b74c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)
	}
}