public async Task CanSetTagProperties() { // Arrange ContainerRepositoryClient client = CreateClient(); string tag = "latest"; TagProperties tagProperties = await client.GetTagPropertiesAsync(tag); ContentProperties originalContentProperties = tagProperties.WriteableProperties; // Act await client.SetTagPropertiesAsync( tag, new ContentProperties() { CanList = false, CanRead = false, CanWrite = false, CanDelete = false }); // Assert TagProperties properties = await client.GetTagPropertiesAsync(tag); Assert.IsFalse(properties.WriteableProperties.CanList); Assert.IsFalse(properties.WriteableProperties.CanRead); Assert.IsFalse(properties.WriteableProperties.CanWrite); Assert.IsFalse(properties.WriteableProperties.CanDelete); // Cleanup await client.SetTagPropertiesAsync(tag, originalContentProperties); }
public async Task CanGetTagProperties() { TagProperties properties = await _client.GetTagPropertiesAsync(_tagName); Assert.AreEqual(_tagName, properties.Name); Assert.AreEqual(_repositoryName, properties.Repository); Assert.AreEqual(new Uri(TestEnvironment.Endpoint).Host, properties.Registry); }
public async Task CanDeleteTag() { // Arrange ContainerRepositoryClient client = CreateClient(); string tag = "test-delete-tag"; if (Mode != RecordedTestMode.Playback) { await ImportImage(_repositoryName, tag); } // Act await client.DeleteTagAsync(tag); // 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.GetTagPropertiesAsync(tag); }); }
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 CanGetTagProperties() { // Arrange ContainerRepositoryClient client = CreateClient(); string tag = "latest"; // Act TagProperties properties = await client.GetTagPropertiesAsync(tag); // Assert Assert.AreEqual(tag, properties.Name); Assert.AreEqual(_repositoryName, properties.Repository); }
public async Task CanDeleteTag() { // Arrange ContainerRepositoryClient client = CreateClient(); string tag = "test-delete"; await ImportImage(tag); // Act await client.DeleteTagAsync(tag); // Assert // The delete takes some time, so if we call GetTagProperties() without a delay, we get a 200 response. await Task.Delay(5000); Assert.ThrowsAsync <RequestFailedException>(async() => { await client.GetTagPropertiesAsync(tag); }); }
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 RegistryArtifactProperties properties = await client.SetManifestPropertiesAsync( digest, new ContentProperties() { CanList = false, CanRead = false, CanWrite = false, CanDelete = false }); // Assert Assert.IsFalse(properties.WriteableProperties.CanList); Assert.IsFalse(properties.WriteableProperties.CanRead); Assert.IsFalse(properties.WriteableProperties.CanWrite); Assert.IsFalse(properties.WriteableProperties.CanDelete); RegistryArtifactProperties updatedProperties = await client.GetRegistryArtifactPropertiesAsync(digest); Assert.IsFalse(updatedProperties.WriteableProperties.CanList); Assert.IsFalse(updatedProperties.WriteableProperties.CanRead); Assert.IsFalse(updatedProperties.WriteableProperties.CanWrite); Assert.IsFalse(updatedProperties.WriteableProperties.CanDelete); // Cleanup await client.SetManifestPropertiesAsync(digest, originalContentProperties); }