Skip to content

Commit 7c710cb

Browse files
committed
fix test
1 parent bd63619 commit 7c710cb

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/Containers/Microsoft.NET.Build.Containers/Resources/Strings.Designer.cs

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Tests/Microsoft.NET.Build.Containers.UnitTests/ImageBuilderTests.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public class ImageBuilderTests
1313
{
1414
private readonly TestLoggerFactory _loggerFactory;
1515

16+
private static readonly string StaticKnownDigestValue = "sha256:338c0b702da88157ba4bb706678e43346ece2e4397b888d59fb2d9f6113c8070";
17+
1618
public ImageBuilderTests(ITestOutputHelper output)
1719
{
1820
_loggerFactory = new TestLoggerFactory(output);
@@ -681,8 +683,8 @@ public void CanSetBaseImageDigestLabel()
681683
JsonNode? result = JsonNode.Parse(builtImage.Config);
682684
Assert.NotNull(result);
683685
var labels = result["config"]?["Labels"]?.AsObject();
684-
var digest = labels?.AsEnumerable().First(label => label.Key == "org.opencontainers.image.base.digest");
685-
digest?.Value.Should().NotBeNull();
686+
var digest = labels?.AsEnumerable().First(label => label.Key == "org.opencontainers.image.base.digest").Value!;
687+
digest.GetValue<string>().Should().Be(StaticKnownDigestValue);
686688
}
687689

688690
private ImageBuilder FromBaseImageConfig(string baseImageConfig, [CallerMemberName] string testName = "")
@@ -695,9 +697,10 @@ private ImageBuilder FromBaseImageConfig(string baseImageConfig, [CallerMemberNa
695697
{
696698
mediaType = "",
697699
size = 0,
698-
digest = "sha256:0"
700+
digest = "sha256:"
699701
},
700-
Layers = new List<ManifestLayer>()
702+
Layers = new List<ManifestLayer>(),
703+
KnownDigest = StaticKnownDigestValue
701704
};
702705
return new ImageBuilder(manifest, new ImageConfig(baseImageConfig), _loggerFactory.CreateLogger(testName));
703706
}

0 commit comments

Comments
 (0)