Skip to content

Commit abae8c9

Browse files
committed
test: add validate.Image
1 parent bb5ea5e commit abae8c9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/v1/daemon/image_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"github.com/google/go-containerregistry/internal/compare"
2929
"github.com/google/go-containerregistry/pkg/name"
3030
"github.com/google/go-containerregistry/pkg/v1/tarball"
31+
"github.com/google/go-containerregistry/pkg/v1/validate"
3132
)
3233

3334
var imagePath = "../tarball/testdata/test_image_1.tar"
@@ -128,6 +129,15 @@ func TestImage(t *testing.T) {
128129
t.Errorf("wanted %s to contain %s", err.Error(), tc.wantErr)
129130
}
130131
}
132+
133+
err = validate.Image(dmn)
134+
if err != nil {
135+
if tc.wantErr == "" {
136+
t.Errorf("validate.Image: %v", err)
137+
} else if !strings.Contains(err.Error(), tc.wantErr) {
138+
t.Errorf("wanted %s to contain %s", err.Error(), tc.wantErr)
139+
}
140+
}
131141
}
132142

133143
tc.buffered = true

0 commit comments

Comments
 (0)