Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACR] Remove delays after deletes in tests. #21268

Merged
merged 3 commits into from
May 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,12 @@ public async Task CanDeleteRepostitory()
{
if (Mode != RecordedTestMode.Playback)
{
await ImportImage(registry, repository, tags);
await ImportImageAsync(registry, repository, tags);
}

// Act
await client.DeleteRepositoryAsync(repository);

// 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);
}

var repositories = client.GetRepositoryNamesAsync();

await foreach (var item in repositories)
Expand All @@ -146,7 +138,7 @@ public async Task CanDeleteRepostitory()
// Clean up - put the repository with tags back.
if (Mode != RecordedTestMode.Playback)
{
await ImportImage(registry, repository, tags);
await ImportImageAsync(registry, repository, tags);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public ContainerRegistryClient CreateClient(bool anonymousAccess = false)
));
}

public async Task ImportImage(string registry, string repository, string tag)
public async Task ImportImageAsync(string registry, string repository, string tag)
{
await ImportImage(registry, repository, new List<string>() { tag });
await ImportImageAsync(registry, repository, new List<string>() { tag });
}

public async Task ImportImage(string registry, string repository, List<string> tags)
public async Task ImportImageAsync(string registry, string repository, List<string> tags)
{
var credential = new AzureCredentials(
new ServicePrincipalLoginInformation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,12 @@ public async Task CanDeleteRepository()
{
if (Mode != RecordedTestMode.Playback)
{
await ImportImage(TestEnvironment.Registry, _repositoryName, tags);
await ImportImageAsync(TestEnvironment.Registry, _repositoryName, tags);
}

// Act
await repository.DeleteAsync();

// 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
Assert.ThrowsAsync<RequestFailedException>(async () => { await repository.GetPropertiesAsync(); });
}
Expand All @@ -129,7 +122,7 @@ public async Task CanDeleteRepository()
// Clean up - put the repository with tags back.
if (Mode != RecordedTestMode.Playback)
{
await ImportImage(TestEnvironment.Registry, _repositoryName, tags);
await ImportImageAsync(TestEnvironment.Registry, _repositoryName, tags);
}
}
}
Expand Down Expand Up @@ -255,7 +248,7 @@ public async Task CanGetManifestsOrdered()
{
if (Mode != RecordedTestMode.Playback)
{
await ImportImage(TestEnvironment.Registry, repositoryName, tag);
await ImportImageAsync(TestEnvironment.Registry, repositoryName, tag);
}

// Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,13 @@ public async Task CanDeleteRegistryArtifact()

if (Mode != RecordedTestMode.Playback)
{
await ImportImage(TestEnvironment.Registry, repository, tag);
await ImportImageAsync(TestEnvironment.Registry, repository, tag);
}

// Act
await artifact.DeleteAsync();

// 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 artifact.GetManifestPropertiesAsync(); });
}

Expand Down Expand Up @@ -275,7 +267,7 @@ public async Task CanGetTagsOrdered(bool anonymous)

if (Mode != RecordedTestMode.Playback)
{
await ImportImage(registry, _repositoryName, "newest");
await ImportImageAsync(registry, _repositoryName, "newest");
}

// Act
Expand Down Expand Up @@ -358,21 +350,13 @@ public async Task CanDeleteTag()

if (Mode != RecordedTestMode.Playback)
{
await ImportImage(TestEnvironment.Registry, _repositoryName, tag);
await ImportImageAsync(TestEnvironment.Registry, _repositoryName, tag);
}

// Act
await artifact.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 artifact.GetTagPropertiesAsync(tag); });
}
#endregion
Expand Down