Skip to content

Commit 225c59b

Browse files
committed
Randomize ports fxd + new healthcheck
1 parent d886b72 commit 225c59b

File tree

3 files changed

+8
-66
lines changed

3 files changed

+8
-66
lines changed

src/CommunityToolkit.Aspire.Hosting.Minio/MinioBuilderExtensions.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,13 @@ public static IResourceBuilder<MinioContainerResource> AddMinioContainer(
5353
var healthCheckKey = $"{name}_check";
5454

5555
builder.Services.AddHealthChecks()
56-
.Add(new HealthCheckRegistration(
57-
healthCheckKey,
58-
sp =>
59-
{
60-
var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient("miniohealth");
61-
62-
return new MinioHealthCheck(endpoint.Url, httpClient);
63-
},
64-
failureStatus: default,
65-
tags: default,
66-
timeout: default));
56+
.AddUrlGroup(options =>
57+
{
58+
var uri = new Uri(endpoint.Url);
59+
options.AddUri(new Uri(uri,"/minio/health/live"), setup => setup.ExpectHttpCode(200));
60+
options.AddUri(new Uri(uri, "/minio/health/cluster"), setup => setup.ExpectHttpCode(200));
61+
options.AddUri(new Uri(uri, "/minio/health/cluster/read"), setup => setup.ExpectHttpCode(200));
62+
}, healthCheckKey);
6763

6864
builderWithResource.WithHealthCheck(healthCheckKey);
6965

src/CommunityToolkit.Aspire.Hosting.Minio/MinioHealthCheck.cs

Lines changed: 0 additions & 54 deletions
This file was deleted.

tests/CommunityToolkit.Aspire.Testing/TestDistributedApplicationBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void Configure(DistributedApplicationOptions applicationOptions, HostApplication
7979
var cfg = hostBuilderOptions.Configuration ??= new();
8080
cfg.AddInMemoryCollection(new Dictionary<string, string?>
8181
{
82-
["DcpPublisher:RandomizePorts"] = "false",
82+
["DcpPublisher:RandomizePorts"] = "true",
8383
["DcpPublisher:DeleteResourcesOnShutdown"] = "true",
8484
["DcpPublisher:ResourceNameSuffix"] = $"{Random.Shared.Next():x}",
8585
});

0 commit comments

Comments
 (0)