fix: absolute chart path (#753)

Resolves #743
This commit is contained in:
KUOKA Yusuke
2019-07-12 22:37:54 +09:00
committed by GitHub
parent 4166b418c9
commit b2a6231dcf
4 changed files with 88 additions and 10 deletions
+34
View File
@@ -27,6 +27,10 @@ func TestIsLocalChart(t *testing.T) {
input: "./charts/mysubsystem/myapp",
expected: true,
},
{
input: "/charts/mysubsystem/myapp",
expected: true,
},
{
// Regression test case for:
// * https://github.com/roboll/helmfile/issues/675
@@ -80,6 +84,10 @@ func TestResolveRemortChart(t *testing.T) {
input: "./charts/mysubsystem/myapp",
remote: false,
},
{
input: "/charts/mysubsystem/myapp",
remote: false,
},
{
// Regression test case for:
// * https://github.com/roboll/helmfile/issues/675
@@ -111,3 +119,29 @@ func TestResolveRemortChart(t *testing.T) {
}
}
}
func TestNormalizeChart(t *testing.T) {
testcases := []struct {
input string
expected string
}{
{
input: "mychart",
expected: "/path/to/mychart",
},
{
input: "/charts/mychart",
expected: "/charts/mychart",
},
}
for i := range testcases {
testcase := testcases[i]
actual := normalizeChart("/path/to", testcase.input)
if testcase.expected != actual {
t.Fatalf("unexpected result: normalizeChart(\"/path/to\", \"%s\"): expected=%v, got=%v", testcase.input, testcase.expected, actual)
}
}
}