فهرست منبع

testutil/environment: Add GetTestDanglingImageId

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Paweł Gronowski 2 سال پیش
والد
کامیت
a96e6044cc
2فایلهای تغییر یافته به همراه9 افزوده شده و 5 حذف شده
  1. 2 5
      integration/image/inspect_test.go
  2. 7 0
      testutil/environment/special_images.go

+ 2 - 5
integration/image/inspect_test.go

@@ -19,12 +19,9 @@ func TestImageInspectEmptyTagsAndDigests(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	danglingId := environment.DanglingImageIdGraphDriver
-	if testEnv.UsingSnapshotter() {
-		danglingId = environment.DanglingImageIdSnapshotter
-	}
+	danglingID := environment.GetTestDanglingImageId(testEnv)
 
 
-	inspect, raw, err := client.ImageInspectWithRaw(ctx, danglingId)
+	inspect, raw, err := client.ImageInspectWithRaw(ctx, danglingID)
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
 	// Must be a zero length array, not null.
 	// Must be a zero length array, not null.

+ 7 - 0
testutil/environment/special_images.go

@@ -5,3 +5,10 @@ const DanglingImageIdGraphDriver = "sha256:0df1207206e5288f4a989a2f13d1f5b3c4e70
 
 
 // The containerd image store identifies images by the ID of their manifest/manifest list.
 // The containerd image store identifies images by the ID of their manifest/manifest list.
 const DanglingImageIdSnapshotter = "sha256:16d365089e5c10e1673ee82ab5bba38ade9b763296ad918bd24b42a1156c5456"
 const DanglingImageIdSnapshotter = "sha256:16d365089e5c10e1673ee82ab5bba38ade9b763296ad918bd24b42a1156c5456"
+
+func GetTestDanglingImageId(testEnv *Execution) string {
+	if testEnv.UsingSnapshotter() {
+		return DanglingImageIdSnapshotter
+	}
+	return DanglingImageIdGraphDriver
+}