Skip to content

Commit 10c9a28

Browse files
committed
test: don't call health check for Zitadel integration test
1 parent 2f6ce3f commit 10c9a28

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

tests/CommunityToolkit.Aspire.Hosting.Zitadel.Tests/AppHostTests.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using CommunityToolkit.Aspire.Testing;
22
using Aspire.Components.Common.Tests;
33
using System.Net;
4+
using System.Net.Http.Json;
45

56
namespace CommunityToolkit.Aspire.Hosting.Zitadel.Tests;
67

@@ -22,9 +23,36 @@ await fixture.ResourceNotificationService
2223
var httpClient = fixture.CreateHttpClient(resourceName);
2324

2425
// Test the health endpoint
25-
var response = await httpClient.GetAsync("/healthz");
26+
var request = new HttpRequestMessage(HttpMethod.Get, "/.well-known/openid-configuration");
27+
// Needs to match the external domain for Zitadel or we get a 404
28+
request.Headers.Host = $"{resourceName}.dev.localhost";
29+
var response = await httpClient.SendAsync(request);
30+
31+
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
32+
}
33+
34+
[Fact]
35+
public async Task Zitadel_Starts_And_Serves_Dashboard()
36+
{
37+
var resourceName = "zitadel";
38+
39+
// Wait for Zitadel to be healthy (it has a health check configured)
40+
await fixture.ResourceNotificationService
41+
.WaitForResourceHealthyAsync(resourceName)
42+
.WaitAsync(TimeSpan.FromMinutes(5));
43+
44+
var httpClient = fixture.CreateHttpClient(resourceName);
45+
46+
// Test the health endpoint
47+
var request = new HttpRequestMessage(HttpMethod.Get, "/");
48+
// Needs to match the external domain for Zitadel or we get a 404
49+
request.Headers.Host = $"{resourceName}.dev.localhost";
50+
var response = await httpClient.SendAsync(request);
2651

2752
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
53+
var body = await response.Content.ReadAsStringAsync();
54+
Assert.Contains("<html", body);
55+
Assert.Contains("cnsl-root", body);
2856
}
2957

3058
[Fact]

0 commit comments

Comments
 (0)