...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package empty
16
17 import (
18 "testing"
19
20 "github.com/google/go-containerregistry/pkg/v1/validate"
21 )
22
23 func TestImage(t *testing.T) {
24 if err := validate.Image(Image); err != nil {
25 t.Fatalf("validate.Image(empty.Image) = %v", err)
26 }
27 }
28
29 func TestManifestAndConfig(t *testing.T) {
30 manifest, err := Image.Manifest()
31 if err != nil {
32 t.Fatalf("Error loading manifest: %v", err)
33 }
34 if got, want := len(manifest.Layers), 0; got != want {
35 t.Fatalf("num layers; got %v, want %v", got, want)
36 }
37
38 config, err := Image.ConfigFile()
39 if err != nil {
40 t.Fatalf("Error loading config file: %v", err)
41 }
42 if got, want := len(config.RootFS.DiffIDs), 0; got != want {
43 t.Fatalf("num diff ids; got %v, want %v", got, want)
44 }
45 if got, want := config.RootFS.Type, "layers"; got != want {
46 t.Fatalf("rootfs type; got %v, want %v", got, want)
47 }
48 }
49
View as plain text