@@ -74,7 +74,7 @@ func (m *mockRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) {
7474 return & http.Response {Body : ioutil .NopCloser (bytes .NewBufferString (ua ))}, nil
7575}
7676
77- func Test_OCILayoutPath (t * testing.T ) {
77+ func TestOCILayoutPath (t * testing.T ) {
7878 tmpDir , err := ioutil .TempDir ("" , "" )
7979 if err != nil {
8080 t .Fatalf ("could not create temp dir: %s" , err )
@@ -91,6 +91,11 @@ func Test_OCILayoutPath(t *testing.T) {
9191 t .Fatalf ("could not get image digest: %s" , err )
9292 }
9393
94+ want , err := image .Manifest ()
95+ if err != nil {
96+ t .Fatalf ("could not get image manifest: %s" , err )
97+ }
98+
9499 opts := config.KanikoOptions {
95100 NoPush : true ,
96101 OCILayoutPath : tmpDir ,
@@ -100,12 +105,17 @@ func Test_OCILayoutPath(t *testing.T) {
100105 t .Fatalf ("could not push image: %s" , err )
101106 }
102107
103- index , err := layout .ImageIndexFromPath (tmpDir )
108+ layoutIndex , err := layout .ImageIndexFromPath (tmpDir )
104109 if err != nil {
105110 t .Fatalf ("could not get index from layout: %s" , err )
106111 }
107- testutil .CheckError (t , false , validate .Index (index ))
112+ testutil .CheckError (t , false , validate .Index (layoutIndex ))
113+
114+ layoutImage , err := layoutIndex .Image (digest )
115+ if err != nil {
116+ t .Fatalf ("could not get image from layout: %s" , err )
117+ }
108118
109- got , err := index . Image ( digest )
110- testutil .CheckErrorAndDeepEqual (t , false , err , image , got )
119+ got , err := layoutImage . Manifest ( )
120+ testutil .CheckErrorAndDeepEqual (t , false , err , want , got )
111121}
0 commit comments