Skip to content
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
10 changes: 5 additions & 5 deletions backend/Menu.AppHost/Menu.AppHost.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Aspire.AppHost.Sdk/13.2.4">
<Project Sdk="Aspire.AppHost.Sdk/13.3.5">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -9,10 +9,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.JavaScript" Version="13.2.4" />
<PackageReference Include="Aspire.Hosting.Redis" Version="13.2.4" />
<PackageReference Include="Aspire.Hosting.SqlServer" Version="13.2.4" />
<PackageReference Include="CommunityToolkit.Aspire.Hosting.JavaScript.Extensions" Version="13.1.1" />
<PackageReference Include="Aspire.Hosting.JavaScript" Version="13.3.5" />
<PackageReference Include="Aspire.Hosting.Redis" Version="13.3.5" />
<PackageReference Include="Aspire.Hosting.SqlServer" Version="13.3.5" />
<PackageReference Include="CommunityToolkit.Aspire.Hosting.JavaScript.Extensions" Version="13.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion backend/Menu.MigrationService/Menu.MigrationService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Microsoft.EntityFrameworkCore.SqlServer" Version="13.2.4" />
<PackageReference Include="Aspire.Microsoft.EntityFrameworkCore.SqlServer" Version="13.3.5" />
</ItemGroup>

<ItemGroup>
Expand Down
38 changes: 31 additions & 7 deletions backend/MenuApi.Integration.Tests/Factory/ApiTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public async Task<HttpClient> GetHttpClient()
{
var httpClient = app.CreateHttpClient("apiservice");

cachedAuthHeader ??= await new ApiAuthentication().GetAuthenticationHeaderValue();
cachedAuthHeader ??= await new ApiAuthentication().GetAuthenticationHeaderValue().ConfigureAwait(false);

httpClient.DefaultRequestHeaders.Authorization = cachedAuthHeader;
return httpClient;
Expand All @@ -45,26 +45,50 @@ async ValueTask IAsyncLifetime.InitializeAsync()

app = await appHost.BuildAsync();

await app.StartAsync();
// Retry app startup to handle Docker daemon health checks in CI environments
const int maxRetries = 3;
const int delayMs = 2000;
Exception lastException = null;
for (int attempt = 1; attempt <= maxRetries; attempt++)
{
try
{
await app.StartAsync().ConfigureAwait(false);
break;
}
catch (Exception ex) when (ex.Message.Contains("unhealthy"))
{
lastException = ex;
if (attempt < maxRetries)
{
await Task.Delay(delayMs).ConfigureAwait(false);
}
}
}

if (lastException != null)
{
throw lastException;
}

var resourceNotificationService = app.Services
.GetRequiredService<ResourceNotificationService>();
await resourceNotificationService.WaitForResourceAsync(
"migrations",
KnownResourceStates.Finished
)
.WaitAsync(TimeSpan.FromSeconds(120));
.WaitAsync(TimeSpan.FromSeconds(120)).ConfigureAwait(false);

await resourceNotificationService.WaitForResourceAsync(
"apiservice",
KnownResourceStates.Running
)
.WaitAsync(TimeSpan.FromSeconds(30));
.WaitAsync(TimeSpan.FromSeconds(30)).ConfigureAwait(false);
}
async ValueTask IAsyncDisposable.DisposeAsync()
{
await app.StopAsync();
await app.DisposeAsync();
await app.StopAsync().ConfigureAwait(false);
await app.DisposeAsync().ConfigureAwait(false);
}
}

Expand Down Expand Up @@ -102,7 +126,7 @@ public static async Task ShouldHaveStatusCode(this HttpResponseMessage response,
{
if (response.StatusCode != expected)
{
var body = await response.Content.ReadAsStringAsync();
var body = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
throw new Xunit.Sdk.XunitException(
$"Expected status code {(int)expected} {expected} but received {(int)response.StatusCode} {response.StatusCode}.\n\nResponse body:\n{body}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.Testing" Version="13.2.4" />
<PackageReference Include="Aspire.Hosting.Testing" Version="13.3.5" />
<PackageReference Include="AutoFixture.Xunit3" Version="4.19.0" />
<PackageReference Include="AwesomeAssertions" Version="9.4.0" />
<PackageReference Include="AwesomeAssertions.Analyzers" Version="9.0.8">
Expand Down
2 changes: 1 addition & 1 deletion backend/MenuApi/MenuApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Aspire.Microsoft.EntityFrameworkCore.SqlServer" Version="13.2.4" />
<PackageReference Include="Aspire.Microsoft.EntityFrameworkCore.SqlServer" Version="13.3.5" />
<PackageReference Include="FluentValidation" Version="12.1.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="12.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.8">
Expand Down
Loading