Skip to content

Commit 70e02a0

Browse files
authored
Fix DockerService test for Docker 29 containerd image store (#1633)
1 parent a8222d2 commit 70e02a0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/Microsoft.ComponentDetection.Common.Tests/DockerServiceTests.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,17 @@ public async Task DockerService_PopulatesBaseImageAndLayerDetailsAsync()
6565

6666
details.Should().NotBeNull();
6767
details.Tags.Should().Contain("governancecontainerregistry.azurecr.io/testcontainers/dockertags_test:testtag");
68-
var expectedImageId = "sha256:5edc12e9a797b59b9209354ff99d8550e7a1f90ca924c103fa3358e1a9ce15fe";
6968
var expectedCreatedAt = DateTime.Parse("2021-09-23T23:47:57.442225064Z").ToUniversalTime();
7069

7170
details.Should().NotBeNull();
7271
details.Id.Should().BePositive();
73-
details.ImageId.Should().BeEquivalentTo(expectedImageId);
72+
73+
// The image ID depends on the Docker storage backend:
74+
// - Legacy graphdriver: returns the config digest
75+
// - containerd image store (default since Docker 29): returns the manifest digest
76+
var configDigest = "sha256:5edc12e9a797b59b9209354ff99d8550e7a1f90ca924c103fa3358e1a9ce15fe";
77+
var manifestDigest = "sha256:144c8d7e446fa9da415418ef7844ab87ad8fd93a0ca48919c29cf82150c81982";
78+
details.ImageId.Should().BeOneOf(configDigest, manifestDigest);
7479
details.CreatedAt.ToUniversalTime().Should().Be(expectedCreatedAt);
7580
details.BaseImageDigest.Should().Be("sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412");
7681
details.BaseImageRef.Should().Be("docker.io/library/hello-world:latest");

0 commit comments

Comments
 (0)