-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflare_test.go
65 lines (55 loc) · 1.24 KB
/
flare_test.go
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"os"
"testing"
)
func TestLocalAuth(t *testing.T) {
// Will pass if you have a valid ~/kube/config file
homeDir := os.Getenv("HOME")
file := homeDir + "/.kube/config"
// use local file?
_, err := auth(&file)
// Expected err == nil
// Got
if err != nil {
t.Errorf("Error building the ~/.kube/config clientset " + err.Error())
}
}
func TestAuthPartial(t *testing.T) {
badFile := "test/partial_config"
// This file is good enough to parse
_, err := auth(&badFile)
//fmt.Println(cs)
// fmt.Println(err)
// Expected non-nil
if err != nil {
t.Errorf("Expected an Error but err == nil")
}
}
func TestAuthMissing(t *testing.T) {
missingFile := "test/324567890hfusagdf7tqwyhrnuh"
// use local file?
_, err := auth(&missingFile)
// Expected non-nil
if err == nil {
t.Errorf("Expected an Error but err was nil")
}
}
func TestAuthEmptyFile(t *testing.T) {
missingFile := "test/empty_config"
// use local file?
_, err := auth(&missingFile)
// Expected non-nil
if err == nil {
t.Errorf("Expected an Error but err was nil")
}
}
func TestAuthNoPath(t *testing.T) {
badFile := ""
// use local file?
_, err := auth(&badFile)
// Expected non-nil
if err == nil {
t.Errorf("Expected an Error but err was nil")
}
}