|
|
@ -16,6 +16,7 @@ limitations under the License.
|
|
|
|
package resolver
|
|
|
|
package resolver
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
|
|
|
|
"runtime"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
|
|
"helm.sh/helm/v3/pkg/chart"
|
|
|
|
"helm.sh/helm/v3/pkg/chart"
|
|
|
@ -246,24 +247,28 @@ func TestGetLocalPath(t *testing.T) {
|
|
|
|
repo string
|
|
|
|
repo string
|
|
|
|
chartpath string
|
|
|
|
chartpath string
|
|
|
|
expect string
|
|
|
|
expect string
|
|
|
|
|
|
|
|
winExpect string
|
|
|
|
err bool
|
|
|
|
err bool
|
|
|
|
}{
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: "absolute path",
|
|
|
|
name: "absolute path",
|
|
|
|
repo: "file:////tmp",
|
|
|
|
repo: "file:////",
|
|
|
|
expect: "/tmp",
|
|
|
|
expect: "/",
|
|
|
|
|
|
|
|
winExpect: "\\",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: "relative path",
|
|
|
|
name: "relative path",
|
|
|
|
repo: "file://../../testdata/chartpath/base",
|
|
|
|
repo: "file://../../testdata/chartpath/base",
|
|
|
|
chartpath: "foo/bar",
|
|
|
|
chartpath: "foo/bar",
|
|
|
|
expect: "testdata/chartpath/base",
|
|
|
|
expect: "testdata/chartpath/base",
|
|
|
|
|
|
|
|
winExpect: "testdata\\chartpath\\base",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: "current directory path",
|
|
|
|
name: "current directory path",
|
|
|
|
repo: "../charts/localdependency",
|
|
|
|
repo: "../charts/localdependency",
|
|
|
|
chartpath: "testdata/chartpath/charts",
|
|
|
|
chartpath: "testdata/chartpath/charts",
|
|
|
|
expect: "testdata/chartpath/charts/localdependency",
|
|
|
|
expect: "testdata/chartpath/charts/localdependency",
|
|
|
|
|
|
|
|
winExpect: "testdata\\chartpath\\charts\\localdependency",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: "invalid local path",
|
|
|
|
name: "invalid local path",
|
|
|
@ -291,8 +296,12 @@ func TestGetLocalPath(t *testing.T) {
|
|
|
|
if tt.err {
|
|
|
|
if tt.err {
|
|
|
|
t.Fatalf("Expected error in test %q", tt.name)
|
|
|
|
t.Fatalf("Expected error in test %q", tt.name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if p != tt.expect {
|
|
|
|
expect := tt.expect
|
|
|
|
t.Errorf("%q: expected %q, got %q", tt.name, tt.expect, p)
|
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
|
|
|
|
expect = tt.winExpect
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if p != expect {
|
|
|
|
|
|
|
|
t.Errorf("%q: expected %q, got %q", tt.name, expect, p)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|