1
0
mirror of https://github.com/ko-build/ko.git synced 2025-01-29 18:53:53 +02:00

fix unit tests

This commit is contained in:
Jason Hall 2019-03-21 15:59:33 -04:00
parent b1ce0513a1
commit d580f39279

View File

@ -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(