public async Task CanSetManifestProperties() { // Arrange ContainerRepositoryClient client = CreateClient(); string tag = "latest"; TagProperties tagProperties = await client.GetTagPropertiesAsync(tag); string digest = tagProperties.Digest; RegistryArtifactProperties artifactProperties = await client.GetRegistryArtifactPropertiesAsync(digest); ContentProperties originalContentProperties = artifactProperties.WriteableProperties; // Act await client.SetManifestPropertiesAsync( digest, new ContentProperties() { CanList = false, CanRead = false, CanWrite = false, CanDelete = false }); // Assert RegistryArtifactProperties properties = await client.GetRegistryArtifactPropertiesAsync(digest); Assert.IsFalse(properties.WriteableProperties.CanList); Assert.IsFalse(properties.WriteableProperties.CanRead); Assert.IsFalse(properties.WriteableProperties.CanWrite); Assert.IsFalse(properties.WriteableProperties.CanDelete); // Cleanup await client.SetManifestPropertiesAsync(digest, originalContentProperties); }
public async Task CanGetMultiArchitectureImageProperties() { // Arrange ContainerRepositoryClient client = CreateClient(); string tag = "v1"; int helloWorldManifestReferences = 9; // Act RegistryArtifactProperties properties = await client.GetRegistryArtifactPropertiesAsync(tag); // Assert Assert.Contains(tag, properties.Tags.ToList()); Assert.AreEqual(_repositoryName, properties.Repository); Assert.GreaterOrEqual(helloWorldManifestReferences, properties.RegistryArtifacts.Count); Assert.IsTrue(properties.RegistryArtifacts.Any( artifact => artifact.CpuArchitecture == "arm64" && artifact.OperatingSystem == "linux")); Assert.IsTrue(properties.RegistryArtifacts.Any( artifact => artifact.CpuArchitecture == "amd64" && artifact.OperatingSystem == "windows")); }
public async Task CanGetArtifactProperties() { // Arrange ContainerRepositoryClient client = CreateClient(); string tag = "v1"; // Act RegistryArtifactProperties listProperties = await client.GetRegistryArtifactPropertiesAsync(tag); var arm64LinuxImage = listProperties.RegistryArtifacts.First( artifact => artifact.CpuArchitecture == "arm64" && artifact.OperatingSystem == "linux"); RegistryArtifactProperties properties = await client.GetRegistryArtifactPropertiesAsync(arm64LinuxImage.Digest); // Assert Assert.AreEqual(_repositoryName, properties.Repository); Assert.IsNotNull(properties.Digest); Assert.AreEqual("arm64", properties.CpuArchitecture); Assert.AreEqual("linux", properties.OperatingSystem); }
public async Task CanGetArtifacts() { // Arrange var client = CreateClient(); // Act AsyncPageable <RegistryArtifactProperties> images = client.GetRegistryArtifactsAsync(); RegistryArtifactProperties latest = null; await foreach (RegistryArtifactProperties image in images) { if (image.Tags.Count > 0 && image.Tags.Contains("latest")) { latest = image; break; } } // Assert Assert.IsNotNull(latest); Assert.AreEqual(_repositoryName, latest.Repository); }