testutil/environment: Add GetTestDanglingImageId

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit a96e6044cc)
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
This commit is contained in:
Paweł Gronowski 2023-06-28 14:25:11 +02:00 committed by Bjorn Neergaard
parent e0091d6616
commit e2bade43e7
No known key found for this signature in database
2 changed files with 9 additions and 5 deletions
integration/image
testutil/environment

View file

@ -19,12 +19,9 @@ func TestImageInspectEmptyTagsAndDigests(t *testing.T) {
client := testEnv.APIClient()
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)
// Must be a zero length array, not null.

View file

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