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 CanDeleteRegistryArtifact() { // Arrange string repository = $"library/node"; string tag = "test-delete-image"; ContainerRepositoryClient client = CreateClient(repository); if (Mode != RecordedTestMode.Playback) { await ImportImage(repository, tag); } TagProperties tagProperties = await client.GetTagPropertiesAsync(tag); string digest = tagProperties.Digest; // Act await client.DeleteRegistryArtifactAsync(digest); // Assert // This will be removed, pending investigation into potential race condition. // https://github.com/azure/azure-sdk-for-net/issues/19699 if (Mode != RecordedTestMode.Playback) { await Task.Delay(5000); } Assert.ThrowsAsync <RequestFailedException>(async() => { await client.GetRegistryArtifactPropertiesAsync(tag); }); }
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); }