-
Notifications
You must be signed in to change notification settings - Fork 933
Update health check to ensure blob containers created at right time #9159
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
Changes from 4 commits
4ba607c
ec3a2df
6aa390f
e993433
eddebef
5bd0c61
48e2d5d
9737260
80ce587
4ebf0d7
a72f514
c21f230
53fac90
3242c5c
ba67f13
273233b
30641bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using Azure.Storage.Blobs; | ||
| using Microsoft.Extensions.Diagnostics.HealthChecks; | ||
|
|
||
| namespace Aspire.Hosting; | ||
|
|
||
| /// <summary> | ||
| /// Azure Blob Storage container health check. | ||
| /// </summary> | ||
| /// <param name="blobContainerClient"> | ||
| /// The <see cref="BlobContainerClient"/> used to perform Azure Blob Storage container operations. | ||
| /// Azure SDK recommends treating clients as singletons <see href="https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/"/>, | ||
| /// so this should be the exact same instance used by other parts of the application. | ||
| /// </param> | ||
| internal sealed class AzureBlobStorageContainerHealthCheck(BlobContainerClient blobContainerClient) : IHealthCheck | ||
| { | ||
| /// <inheritdoc /> | ||
| public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) | ||
| { | ||
| try | ||
| { | ||
| await blobContainerClient.ExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); | ||
| return HealthCheckResult.Healthy(); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| return new HealthCheckResult(context.Registration.FailureStatus, exception: ex); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,7 +135,6 @@ public async Task VerifyAzureStorageEmulatorResource() | |
|
|
||
| [Fact] | ||
| [RequiresDocker] | ||
| [QuarantinedTest("https://github.com/dotnet/aspire/issues/9139")] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we sure that this can be dropped? For quarantined tests we want to take it out after it has been green for a certain number of runs (~100 right now).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will add it back then. What else? Reopening the issues? Is tracking automatic or is there a process to follow to unquarantine like for aspnet?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, re-open the issue. And it will be tracked automatically. And I will take care of taking it out of quarantine for now. It will get semi-automated in medium term.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! |
||
| public async Task VerifyAzureStorageEmulator_blobcontainer_auto_created() | ||
| { | ||
| using var builder = TestDistributedApplicationBuilder.Create().WithTestAndResourceLogging(testOutputHelper); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.