-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcleaner_test.go
More file actions
35 lines (31 loc) · 829 Bytes
/
cleaner_test.go
File metadata and controls
35 lines (31 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package cleaner
import (
"os"
"path/filepath"
"strings"
"testing"
"github.com/arschles/assert"
"k8s.io/kubernetes/pkg/api"
)
func TestGetDisjunction(t *testing.T) {
nsList := []api.Namespace{
api.Namespace{ObjectMeta: api.ObjectMeta{Name: "app1"}},
api.Namespace{ObjectMeta: api.ObjectMeta{Name: "app2"}},
}
dirList := []string{"app1", "app3"}
disj := getDisjunction(nsList, dirList)
assert.Equal(t, len(disj), 2, "number of items in the disjunction")
}
func TestLocalDirs(t *testing.T) {
wd, err := os.Getwd()
assert.NoErr(t, err)
pkgDir, err := filepath.Abs(wd + "/..")
assert.NoErr(t, err)
lDirs, err := localDirs(pkgDir)
for _, dir := range lDirs {
rel, err := filepath.Rel(pkgDir, dir)
assert.NoErr(t, err)
spl := strings.Split(rel, "/")
assert.Equal(t, len(spl), 1, "directory depth")
}
}