From d580f392794e8359a352f81b8bd3ef526be6c912 Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Thu, 21 Mar 2019 15:59:33 -0400 Subject: [PATCH 1/2] fix unit tests --- pkg/build/gobuild_test.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/build/gobuild_test.go b/pkg/build/gobuild_test.go index d72b58c0ad..10ca7a999e 100644 --- a/pkg/build/gobuild_test.go +++ b/pkg/build/gobuild_test.go @@ -40,9 +40,8 @@ func TestGoBuildIsSupportedRef(t *testing.T) { // Supported import paths. for _, importpath := range []string{ - filepath.FromSlash("github.com/google/go-containerregistry/cmd/crane"), - filepath.FromSlash("github.com/google/go-containerregistry/vendor/k8s.io/code-generator/cmd/deepcopy-gen"), // vendored commands work too. - filepath.FromSlash("github.com/google/ko/cmd"), + filepath.FromSlash("github.com/google/ko/cmd/ko"), + filepath.FromSlash("github.com/google/ko/vendor/github.com/googleapis/gnostic/compiler"), // vendored commands work too. } { t.Run(importpath, func(t *testing.T) { if !ng.IsSupportedReference(importpath) { @@ -53,8 +52,8 @@ func TestGoBuildIsSupportedRef(t *testing.T) { // Unsupported import paths. for _, importpath := range []string{ - filepath.FromSlash("github.com/google/go-containerregistry/v1/remote"), // not a command. - filepath.FromSlash("github.com/google/go-containerregistry/pkg/foo"), // does not exist. + filepath.FromSlash("github.com/google/ko/pkg/build"), // not a command. + filepath.FromSlash("github.com/google/ko/pkg/nonexistent"), // does not exist. } { t.Run(importpath, func(t *testing.T) { if ng.IsSupportedReference(importpath) { @@ -88,7 +87,7 @@ func TestGoBuildNoKoData(t *testing.T) { if err != nil { t.Fatalf("random.Image() = %v", err) } - importpath := "github.com/google/go-containerregistry" + importpath := "github.com/google/ko" creationTime := v1.Time{time.Unix(5000, 0)} ng, err := NewGo( @@ -165,7 +164,7 @@ func TestGoBuild(t *testing.T) { if err != nil { t.Fatalf("random.Image() = %v", err) } - importpath := "github.com/google/go-containerregistry" + importpath := "github.com/google/ko" creationTime := v1.Time{time.Unix(5000, 0)} ng, err := NewGo( From d90911552c802b60175c37b49f421b816a0dfdcd Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Thu, 21 Mar 2019 16:03:47 -0400 Subject: [PATCH 2/2] fix gobuild_test.go --- pkg/build/gobuild_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/build/gobuild_test.go b/pkg/build/gobuild_test.go index 10ca7a999e..dc5a12ddbd 100644 --- a/pkg/build/gobuild_test.go +++ b/pkg/build/gobuild_test.go @@ -40,8 +40,7 @@ func TestGoBuildIsSupportedRef(t *testing.T) { // Supported import paths. for _, importpath := range []string{ - filepath.FromSlash("github.com/google/ko/cmd/ko"), - filepath.FromSlash("github.com/google/ko/vendor/github.com/googleapis/gnostic/compiler"), // vendored commands work too. + filepath.FromSlash("github.com/google/ko/cmd/ko"), // ko can build itself. } { t.Run(importpath, func(t *testing.T) { if !ng.IsSupportedReference(importpath) { @@ -96,7 +95,7 @@ func TestGoBuildNoKoData(t *testing.T) { withBuilder(writeTempFile), ) - img, err := ng.Build(filepath.Join(importpath, "cmd", "crane")) + img, err := ng.Build(filepath.Join(importpath, "cmd", "ko")) if err != nil { t.Fatalf("Build() = %v", err) } @@ -118,7 +117,7 @@ func TestGoBuildNoKoData(t *testing.T) { t.Run("check determinism", func(t *testing.T) { expectedHash := v1.Hash{ Algorithm: "sha256", - Hex: "a688c9bc444d0a34cbc24abd62aa2fa263f61f2060963bb7a4fc3fa92075a2bf", + Hex: "1d4fb5a6e81840aa5996d6efad00cca54b14412917ed42acf51d88d3f9482fd0", } appLayer := ls[baseLayers+1] @@ -195,7 +194,7 @@ func TestGoBuild(t *testing.T) { t.Run("check determinism", func(t *testing.T) { expectedHash := v1.Hash{ Algorithm: "sha256", - Hex: "71912d718600c5a2b8db3a127a14073bba61dded0dac8e1a6ebdeb4a37f2ce8d", + Hex: "481f1025f9a594d8742cadb1928d1d601115a14a77001958dc539cee04fddfcf", } appLayer := ls[baseLayers+1]