forked from Azure/azure-sdk-for-net
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement updated digest validation for DownloadManifest (Azure#34332)
- Loading branch information
1 parent
f6d847c
commit 176fd47
Showing
4 changed files
with
124 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...inerregistry/Azure.Containers.ContainerRegistry/tests/ContainerRegistryTestDataHelpers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Azure.Containers.ContainerRegistry.Specialized; | ||
|
||
namespace Azure.Containers.ContainerRegistry.Tests | ||
{ | ||
internal static class ContainerRegistryTestDataHelpers | ||
{ | ||
/// <summary> | ||
/// Create an OciManifest type that matches the contents of the manifest.json test data file. | ||
/// </summary> | ||
/// <returns></returns> | ||
internal static OciManifest CreateManifest() | ||
{ | ||
OciManifest manifest = new OciManifest() | ||
{ | ||
SchemaVersion = 2, | ||
Config = new OciBlobDescriptor() | ||
{ | ||
MediaType = "application/vnd.acme.rocket.config", | ||
Digest = "sha256:d25b42d3dbad5361ed2d909624d899e7254a822c9a632b582ebd3a44f9b0dbc8", | ||
Size = 171 | ||
} | ||
}; | ||
manifest.Layers.Add(new OciBlobDescriptor() | ||
{ | ||
MediaType = "application/vnd.oci.image.layer.v1.tar", | ||
Digest = "sha256:654b93f61054e4ce90ed203bb8d556a6200d5f906cf3eca0620738d6dc18cbed", | ||
Size = 28, | ||
Annotations = new OciAnnotations() | ||
{ | ||
Name = "artifact.txt" | ||
} | ||
}); | ||
|
||
return manifest; | ||
} | ||
} | ||
} |