diff --git a/go.mod b/go.mod index a53507673..1b2fe8cce 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ require ( k8s.io/apimachinery v0.0.0-20180904193909-def12e63c512 k8s.io/client-go v0.0.0-20180910083459-2cefa64ff137 k8s.io/kube-openapi v0.0.0-20181114233023-0317810137be // indirect - sigs.k8s.io/kustomize v1.0.11 + sigs.k8s.io/kustomize v2.0.3+incompatible ) replace github.com/Nvveen/Gotty => github.com/ijc/Gotty v0.0.0-20170406111628-a8b993ba6abd diff --git a/go.sum b/go.sum index 5828f270a..b8f88f6fe 100644 --- a/go.sum +++ b/go.sum @@ -346,8 +346,6 @@ github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= -github.com/pivotal/go-ape v0.0.0-20190404203804-81ff0d7e7716 h1:2thc2e0pNH/rqWqZoHEo+Dsf4LybZ1wYyRDKYHvZR1Q= -github.com/pivotal/go-ape v0.0.0-20190404203804-81ff0d7e7716/go.mod h1:WRTmFu8GsOA1bSwOUVchskvhrQA9gIZiZV2U+WOW2wY= github.com/pivotal/go-ape v0.0.0-20190405150324-756013ecae13 h1:Wg9lCEP1JL6E2Ip6wCTD1W3+8R8v9DML/xZo5pk7rpk= github.com/pivotal/go-ape v0.0.0-20190405150324-756013ecae13/go.mod h1:WRTmFu8GsOA1bSwOUVchskvhrQA9gIZiZV2U+WOW2wY= github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= @@ -544,5 +542,5 @@ k8s.io/client-go v0.0.0-20180910083459-2cefa64ff137 h1:4DIWGqvAjLME47asVwjb14H+6 k8s.io/client-go v0.0.0-20180910083459-2cefa64ff137/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= k8s.io/kube-openapi v0.0.0-20181114233023-0317810137be h1:aWEq4nbj7HRJ0mtKYjNSk/7X28Tl6TI6FeG8gKF+r7Q= k8s.io/kube-openapi v0.0.0-20181114233023-0317810137be/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc= -sigs.k8s.io/kustomize v1.0.11 h1:Yb+6DDt9+aR2AvQApvUaKS/ugteeG4MPyoFeUHiPOjk= -sigs.k8s.io/kustomize v1.0.11/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU= +sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0= +sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU= diff --git a/pkg/core/kustomize/kustomize.go b/pkg/core/kustomize/kustomize.go index 1006adfc0..b0c885f86 100644 --- a/pkg/core/kustomize/kustomize.go +++ b/pkg/core/kustomize/kustomize.go @@ -21,6 +21,7 @@ import ( "fmt" "io/ioutil" "net/url" + "path/filepath" "sort" "strings" "time" @@ -51,7 +52,7 @@ type kustomizer struct { func MakeKustomizer(timeout time.Duration) Kustomizer { return &kustomizer{ fs: fs.MakeFakeFS(), // keep contents in-memory - fakeDir: "/", + fakeDir: filepath.FromSlash("/"), httpTimeout: timeout, } } diff --git a/pkg/core/kustomize/kustomize_test.go b/pkg/core/kustomize/kustomize_test.go index 2da0ba063..447e6a4ce 100644 --- a/pkg/core/kustomize/kustomize_test.go +++ b/pkg/core/kustomize/kustomize_test.go @@ -24,7 +24,6 @@ import ( "github.com/projectriff/riff/pkg/test_support" "net" "net/url" - "runtime" "time" ) @@ -80,34 +79,29 @@ spec: test_support.CleanupDirs(GinkgoT(), workDir) }) - // ToDo: figure out how to run the kustomize tests on Windows https://github.com/projectriff/riff/issues/1226 - if runtime.GOOS != "windows" { - - It("customizes remote resources with provided labels", func() { - resourceListener, _ := net.Listen("tcp", "127.0.0.1:0") - go func() { - err := test_support.Serve(resourceListener, httpResponse) - Expect(err).NotTo(HaveOccurred()) - }() - resourceUrl := unsafeParseUrl(fmt.Sprintf("http://%s/%s", resourceListener.Addr().String(), "pvc.yaml")) - - result, err := kustomizer.ApplyLabels(resourceUrl, initLabels) - + It("customizes remote resources with provided labels", func() { + resourceListener, _ := net.Listen("tcp", "127.0.0.1:0") + go func() { + err := test_support.Serve(resourceListener, httpResponse) Expect(err).NotTo(HaveOccurred()) - Expect(string(result)).To(Equal(expectedResourceContent)) - }) + }() + resourceUrl := unsafeParseUrl(fmt.Sprintf("http://%s/%s", resourceListener.Addr().String(), "pvc.yaml")) - It("customizes local resources with provided labels", func() { - file := test_support.CreateFile(workDir, "pvc.yaml", initialResourceContent) - resourceUrl := unsafeParseUrl(test_support.FileURL(test_support.AbsolutePath(file))) + result, err := kustomizer.ApplyLabels(resourceUrl, initLabels) - result, err := kustomizer.ApplyLabels(resourceUrl, initLabels) + Expect(err).NotTo(HaveOccurred()) + Expect(string(result)).To(Equal(expectedResourceContent)) + }) - Expect(err).NotTo(HaveOccurred()) - Expect(string(result)).To(Equal(expectedResourceContent)) - }) + It("customizes local resources with provided labels", func() { + file := test_support.CreateFile(workDir, "pvc.yaml", initialResourceContent) + resourceUrl := unsafeParseUrl(test_support.FileURL(test_support.AbsolutePath(file))) - } + result, err := kustomizer.ApplyLabels(resourceUrl, initLabels) + + Expect(err).NotTo(HaveOccurred()) + Expect(string(result)).To(Equal(expectedResourceContent)) + }) It("fails on unsupported scheme", func() { resourceUrl := unsafeParseUrl("ftp://127.0.0.1/goodluck.yaml")