Skip to content

Commit

Permalink
Merge pull request #2 from ImJasonH/fix
Browse files Browse the repository at this point in the history
Fix unit tests
  • Loading branch information
imjasonh authored Mar 21, 2019
2 parents b1ce051 + d909115 commit c97dbc9
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions pkg/build/gobuild_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ 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"), // ko can build itself.
} {
t.Run(importpath, func(t *testing.T) {
if !ng.IsSupportedReference(importpath) {
Expand All @@ -53,8 +51,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) {
Expand Down Expand Up @@ -88,7 +86,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(
Expand All @@ -97,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)
}
Expand All @@ -119,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]

Expand Down Expand Up @@ -165,7 +163,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(
Expand Down Expand Up @@ -196,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]

Expand Down

0 comments on commit c97dbc9

Please sign in to comment.