Skip to content

Commit

Permalink
Merge pull request #9974 from viccuad/fix-win-resolver-test
Browse files Browse the repository at this point in the history
test: Make internal/resolver/resolver_test.go pass on Win
  • Loading branch information
hickeyma committed Jul 27, 2021
2 parents 29d273f + 84a07a4 commit e9e6b07
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions internal/resolver/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.
package resolver

import (
"runtime"
"testing"

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

0 comments on commit e9e6b07

Please sign in to comment.