This repository has been archived by the owner on Nov 7, 2020. It is now read-only.
forked from Praqma/helmsman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelm_helpers_test.go
67 lines (65 loc) · 1.63 KB
/
helm_helpers_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
66
67
package main
import "testing"
func Test_validateReleaseCharts(t *testing.T) {
type args struct {
apps map[string]*release
}
tests := []struct {
name string
args args
want bool
wantErr bool
}{
{
name: "Valid stable Helm chart",
args: args{apps: map[string]*release{"jenkins": {
Name: "jenkins",
Chart: "stable/jenkins",
Version: "0.16.1",
}}},
want: true,
}, {
name: "Valid local Helm chart",
args: args{apps: map[string]*release{"nginx": {
Name: "nginx",
Chart: "test_files/example_chart",
Version: "0.1.0",
}}},
want: true,
}, {
name: "Check invalid version",
args: args{apps: map[string]*release{"nginx": {
Name: "nginx",
Chart: "test_files/example_chart",
Version: "0.0.0",
}}},
wantErr: true,
}, {
name: "Ignore empty version",
args: args{apps: map[string]*release{"nginx": {
Name: "nginx",
Chart: "test_files/example_chart",
}}},
want: true,
}, {
name: "Invalid stable Helm chart",
args: args{apps: map[string]*release{"jenkins": {Name: "jenkins", Chart: "stable/invalid123"}}},
wantErr: true,
}, {
name: "Invalid local Helm chart",
args: args{apps: map[string]*release{"test": {Name: "jenkins", Chart: "./test_files"}}},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := validateReleaseCharts(tt.args.apps)
if got != tt.want {
t.Errorf("validateReleaseCharts() got = %v, want %v", got, tt.want)
}
if (err == "") == tt.wantErr {
t.Errorf("validateReleaseCharts() err = %v, want %v", err, tt.wantErr)
}
})
}
}