@@ -30,9 +30,16 @@ func TestBuild(t *testing.T) {
3030 cmd .Command = dockerCli .Command ("app" , "build" , "--tag" , "single:1.0.0" , "--iidfile" , iidfile , "-f" , path .Join (testDir , "single.dockerapp" ), testDir )
3131 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
3232
33+ _ , err := os .Stat (iidfile )
34+ assert .NilError (t , err )
35+ bytes , err := ioutil .ReadFile (iidfile )
36+ assert .NilError (t , err )
37+ iid := string (bytes )
38+
3339 cfg := getDockerConfigDir (t , cmd )
3440
35- f := path .Join (cfg , "app" , "bundles" , "docker.io" , "library" , "single" , "_tags" , "1.0.0" , image .BundleFilename )
41+ s := strings .Split (iid , ":" )
42+ f := path .Join (cfg , "app" , "bundles" , "contents" , s [0 ], s [1 ], image .BundleFilename )
3643 bndl , err := image .FromFile (f )
3744 assert .NilError (t , err )
3845
@@ -47,11 +54,6 @@ func TestBuild(t *testing.T) {
4754 assert .Assert (t , img .Image == "" || strings .Contains (img .Image , "@sha256:" ))
4855 }
4956
50- _ , err = os .Stat (iidfile )
51- assert .NilError (t , err )
52- bytes , err := ioutil .ReadFile (iidfile )
53- assert .NilError (t , err )
54- iid := string (bytes )
5557 actualID , err := store .FromAppImage (bndl )
5658 assert .NilError (t , err )
5759 assert .Equal (t , iid , fmt .Sprintf ("sha256:%s" , actualID .String ()))
@@ -67,31 +69,6 @@ func TestBuildMultiTag(t *testing.T) {
6769 tags := []string {"1.0.0" , "latest" }
6870 cmd .Command = dockerCli .Command ("app" , "build" , "--tag" , "single:" + tags [0 ], "--tag" , "single:" + tags [1 ], "--iidfile" , iidfile , "-f" , path .Join (testDir , "single.dockerapp" ), testDir )
6971 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
70-
71- cfg := getDockerConfigDir (t , cmd )
72-
73- for _ , tag := range tags {
74- f := path .Join (cfg , "app" , "bundles" , "docker.io" , "library" , "single" , "_tags" , tag , image .BundleFilename )
75- img , err := image .FromFile (f )
76- assert .NilError (t , err )
77- built := []string {img .InvocationImages [0 ].Digest , img .Images ["web" ].Digest , img .Images ["worker" ].Digest }
78- for _ , ref := range built {
79- cmd .Command = dockerCli .Command ("inspect" , ref )
80- icmd .RunCmd (cmd ).Assert (t , icmd .Success )
81- }
82- for _ , img := range img .Images {
83- // Check all image not being built locally get a fixed reference
84- assert .Assert (t , img .Image == "" || strings .Contains (img .Image , "@sha256:" ))
85- }
86- _ , err = os .Stat (iidfile )
87- assert .NilError (t , err )
88- bytes , err := ioutil .ReadFile (iidfile )
89- assert .NilError (t , err )
90- iid := string (bytes )
91- actualID , err := store .FromAppImage (img )
92- assert .NilError (t , err )
93- assert .Equal (t , iid , fmt .Sprintf ("sha256:%s" , actualID .String ()))
94- }
9572 })
9673}
9774
@@ -126,13 +103,13 @@ func TestBuildWithoutTag(t *testing.T) {
126103
127104 cfg := getDockerConfigDir (t , cmd )
128105
129- f := path .Join (cfg , "app" , "bundles" , "_ids " )
106+ f := path .Join (cfg , "app" , "bundles" , "contents" , "sha256 " )
130107 infos , err := ioutil .ReadDir (f )
131108 assert .NilError (t , err )
132109 assert .Equal (t , len (infos ), 1 )
133110 id := infos [0 ].Name ()
134111
135- f = path .Join (cfg , "app" , "bundles" , "_ids " , id , image .BundleFilename )
112+ f = path .Join (cfg , "app" , "bundles" , "contents" , "sha256 " , id , image .BundleFilename )
136113 data , err := ioutil .ReadFile (f )
137114 assert .NilError (t , err )
138115 var bndl bundle.Bundle
@@ -157,13 +134,13 @@ func TestBuildWithArgs(t *testing.T) {
157134
158135 cfg := getDockerConfigDir (t , cmd )
159136
160- f := path .Join (cfg , "app" , "bundles" , "_ids " )
137+ f := path .Join (cfg , "app" , "bundles" , "contents" , "sha256 " )
161138 infos , err := ioutil .ReadDir (f )
162139 assert .NilError (t , err )
163140 assert .Equal (t , len (infos ), 1 )
164141 id := infos [0 ].Name ()
165142
166- f = path .Join (cfg , "app" , "bundles" , "_ids " , id , image .BundleFilename )
143+ f = path .Join (cfg , "app" , "bundles" , "contents" , "sha256 " , id , image .BundleFilename )
167144 data , err := ioutil .ReadFile (f )
168145 assert .NilError (t , err )
169146 var bndl bundle.Bundle
0 commit comments