forked from jenkins-x/jx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helm_fake.go
125 lines (97 loc) · 3.18 KB
/
helm_fake.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package helm
import (
"strings"
"github.com/jenkins-x/jx/pkg/log"
)
type HelmFake struct {
helm *HelmCLI
}
func createRunner(output string) helmRunner {
return helmRunner{
run: func(dir string, name string, args ...string) error {
log.Infof("Dir: '%s', Executed: '%s'\n", dir, name+" "+strings.Join(args, " "))
return nil
},
runWithOutput: func(dir string, name string, args ...string) (string, error) {
log.Infof("Dir: '%s', Executed: '%s'\n", dir, name+" "+strings.Join(args, " "))
return output, nil
},
}
}
func NewHelmFake(binary string, version Version, cwd string, output string) *HelmFake {
fakeRunner := createRunner(output)
return &HelmFake{
helm: newHelmCLIWithRunner(binary, version, cwd, fakeRunner),
}
}
func (h *HelmFake) SetOutput(output string) {
h.helm.runner = createRunner(output)
}
func (h *HelmFake) SetCWD(dir string) {
h.helm.SetCWD(dir)
}
func (h *HelmFake) HelmBinary() string {
return h.helm.HelmBinary()
}
func (h *HelmFake) SetHelmBinary(binary string) {
h.helm.SetHelmBinary(binary)
}
func (h *HelmFake) Init(clientOnly bool, serviceAccount string, tillerNamespace string, upgrade bool) error {
return h.helm.Init(clientOnly, serviceAccount, tillerNamespace, upgrade)
}
func (h *HelmFake) AddRepo(repo string, URL string) error {
return h.helm.AddRepo(repo, URL)
}
func (h *HelmFake) RemoveRepo(repo string) error {
return h.helm.RemoveRepo(repo)
}
func (h *HelmFake) ListRepos() (map[string]string, error) {
return h.helm.ListRepos()
}
func (h *HelmFake) UpdateRepo() error {
return h.helm.UpdateRepo()
}
func (h *HelmFake) IsRepoMissing(URL string) (bool, error) {
return h.helm.IsRepoMissing(URL)
}
func (h *HelmFake) RemoveRequirementsLock() error {
return h.helm.RemoveRequirementsLock()
}
func (h *HelmFake) BuildDependency() error {
return h.helm.BuildDependency()
}
func (h *HelmFake) InstallChart(chart string, releaseName string, ns string, version *string,
timeout *int, values []string, valueFiles []string) error {
return h.helm.InstallChart(chart, releaseName, ns, version, timeout, values, valueFiles)
}
func (h *HelmFake) UpgradeChart(chart string, releaseName string, ns string, version *string,
install bool, timeout *int, force bool, wait bool, values []string, valueFiles []string) error {
return h.helm.UpgradeChart(chart, releaseName, ns, version, install, timeout, force, wait, values, valueFiles)
}
func (h *HelmFake) DeleteRelease(releaseName string, purge bool) error {
return h.helm.DeleteRelease(releaseName, purge)
}
func (h *HelmFake) ListCharts() (string, error) {
return h.helm.ListCharts()
}
func (h *HelmFake) SearchChartVersions(chart string) ([]string, error) {
return h.helm.SearchChartVersions(chart)
}
func (h *HelmFake) FindChart() (string, error) {
return h.helm.FindChart()
}
func (h *HelmFake) PackageChart() error {
return h.helm.PackageChart()
}
func (h *HelmFake) StatusRelease(releaseName string) error {
return h.helm.StatusRelease(releaseName)
}
func (h *HelmFake) StatusReleases() (map[string]string, error) {
return h.helm.StatusReleases()
}
func (h *HelmFake) Lint() (string, error) {
return h.helm.Lint()
}
func (h *HelmFake) Version(tls bool) (string, error) {
return h.helm.Version(tls)
}