fix appveyor builds

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
pull/4934/head
Matthew Fisher 7 years ago
parent dee2a1a000
commit 819c5c5ed3
No known key found for this signature in database
GPG Key ID: 92AA783CBAAE8E3B

@ -0,0 +1,18 @@
version: "{build}"
clone_folder: c:\go\src\k8s.io\helm
environment:
GOPATH: c:\go
PATH: c:\ProgramData\bin;$(PATH)
install:
- ps: iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/fishworks/gofish/master/scripts/install.ps1'))
- gofish init
- gofish install dep go
- go version
- dep ensure -vendor-only
cache:
- vendor -> Gopkg.lock
build: "off"
deploy: "off"
test_script:
- go build .\cmd\...
- go test .\...

@ -86,7 +86,7 @@ func TestCreateStarterCmd(t *testing.T) {
defer testChdir(t, tdir)() defer testChdir(t, tdir)()
// Run a create // Run a create
if _, err := executeCommand(nil, fmt.Sprintf("--home=%s create --starter=starterchart %s", hh, cname)); err != nil { if _, err := executeCommand(nil, fmt.Sprintf("--home=%s create --starter=starterchart %s", hh.String(), cname)); err != nil {
t.Errorf("Failed to run create: %s", err) t.Errorf("Failed to run create: %s", err)
return return
} }

@ -135,7 +135,7 @@ func (o *dependencyLisOptions) run(out io.Writer) error {
} }
if c.Metadata.Dependencies == nil { if c.Metadata.Dependencies == nil {
fmt.Fprintf(out, "WARNING: no dependencies at %s/charts\n", o.chartpath) fmt.Fprintf(out, "WARNING: no dependencies at %s\n", filepath.Join(o.chartpath, "charts"))
return nil return nil
} }

@ -16,20 +16,31 @@ limitations under the License.
package main package main
import ( import (
"runtime"
"testing" "testing"
) )
func TestDependencyListCmd(t *testing.T) { func TestDependencyListCmd(t *testing.T) {
tests := []cmdTestCase{{ noSuchChart := cmdTestCase{
name: "No such chart", name: "No such chart",
cmd: "dependency list /no/such/chart", cmd: "dependency list /no/such/chart",
golden: "output/dependency-list-no-chart.txt", golden: "output/dependency-list-no-chart-linux.txt",
wantError: true, wantError: true,
}, { }
noDependencies := cmdTestCase{
name: "No dependencies", name: "No dependencies",
cmd: "dependency list testdata/testcharts/alpine", cmd: "dependency list testdata/testcharts/alpine",
golden: "output/dependency-list-no-requirements.txt", golden: "output/dependency-list-no-requirements-linux.txt",
}, { }
if runtime.GOOS == "windows" {
noSuchChart.golden = "output/dependency-list-no-chart-windows.txt"
noDependencies.golden = "output/dependency-list-no-requirements-windows.txt"
}
tests := []cmdTestCase{noSuchChart,
noDependencies, {
name: "Dependencies in chart dir", name: "Dependencies in chart dir",
cmd: "dependency list testdata/testcharts/reqtest", cmd: "dependency list testdata/testcharts/reqtest",
golden: "output/dependency-list.txt", golden: "output/dependency-list.txt",

@ -52,7 +52,7 @@ func TestDependencyUpdateCmd(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
out, err := executeCommand(nil, fmt.Sprintf("--home=%s dependency update %s", hh, hh.Path(chartname))) out, err := executeCommand(nil, fmt.Sprintf("--home=%s dependency update %s", hh.String(), hh.Path(chartname)))
if err != nil { if err != nil {
t.Logf("Output: %s", out) t.Logf("Output: %s", out)
t.Fatal(err) t.Fatal(err)

@ -57,7 +57,6 @@ func init() {
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
os.Unsetenv("HELM_HOME") os.Unsetenv("HELM_HOME")
exitCode := m.Run() exitCode := m.Run()
os.RemoveAll(testingDir) os.RemoveAll(testingDir)
os.Exit(exitCode) os.Exit(exitCode)

@ -0,0 +1 @@
Error: FindFirstFile \no\such\chart: The system cannot find the path specified.

@ -0,0 +1 @@
WARNING: no requirements at testdata\testcharts\alpine\charts

@ -15,6 +15,8 @@ limitations under the License.
package chartutil package chartutil
import ( import (
"os"
"path/filepath"
"sort" "sort"
"strconv" "strconv"
"testing" "testing"
@ -315,7 +317,12 @@ func TestDependentChartWithSubChartsHelmignore(t *testing.T) {
} }
func TestDependentChartsWithSubChartsSymlink(t *testing.T) { func TestDependentChartsWithSubChartsSymlink(t *testing.T) {
c := loadChart(t, "testdata/joonix") joonix := filepath.Join("testdata", "joonix")
if err := os.Symlink(filepath.Join("..", "..", "frobnitz"), filepath.Join(joonix, "charts", "frobnitz")); err != nil {
t.Fatal(err)
}
defer os.RemoveAll(filepath.Join(joonix, "charts", "frobnitz"))
c := loadChart(t, joonix)
if c.Name() != "joonix" { if c.Name() != "joonix" {
t.Fatalf("unexpected chart name: %s", c.Name()) t.Fatalf("unexpected chart name: %s", c.Name())

@ -21,6 +21,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"path"
"path/filepath" "path/filepath"
"sort" "sort"
"strings" "strings"
@ -110,7 +111,7 @@ func (i IndexFile) Add(md *chart.Metadata, filename, baseURL, digest string) {
_, file := filepath.Split(filename) _, file := filepath.Split(filename)
u, err = urlutil.URLJoin(baseURL, file) u, err = urlutil.URLJoin(baseURL, file)
if err != nil { if err != nil {
u = filepath.Join(baseURL, file) u = path.Join(baseURL, file)
} }
} }
cr := &ChartVersion{ cr := &ChartVersion{
@ -246,9 +247,11 @@ func IndexDirectory(dir, baseURL string) (*IndexFile, error) {
var parentDir string var parentDir string
parentDir, fname = filepath.Split(fname) parentDir, fname = filepath.Split(fname)
// filepath.Split appends an extra slash to the end of parentDir. We want to strip that out.
parentDir = strings.TrimSuffix(parentDir, string(os.PathSeparator))
parentURL, err := urlutil.URLJoin(baseURL, parentDir) parentURL, err := urlutil.URLJoin(baseURL, parentDir)
if err != nil { if err != nil {
parentURL = filepath.Join(baseURL, parentDir) parentURL = path.Join(baseURL, parentDir)
} }
c, err := loader.Load(arch) c, err := loader.Load(arch)

Loading…
Cancel
Save