Align CI fixtures with camera config and release manifest
Heimdall Gitea / Build and tests (pull_request) Failing after 1m21s
Heimdall Gitea / Publish versioned release (pull_request) Skipped

This commit is contained in:
Arnaud Dartois committed 2026-10-23 18:58:06 +02:00
1 parent 21084bf00e
commit 0cc950967e
6 files changed
+62 -15

No files matched your search

@@ -1,7 +1,9 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.SignalR;
using System.Reflection;
using System.Text.Json;
using Heimdall.Agent.Services;
using Heimdall.Application.DTOs;
using Heimdall.Application.Security;
@@ -75,7 +77,13 @@ public class ConfigReceiverServiceTests
builder.Services.AddSignalR();
await using var app = builder.Build();
app.MapHub<ReconnectFixtureHub>("/hubs/config");
app.MapGet("/api/settings/agent/{id}", () => Volatile.Read(ref config));
app.MapGet("/api/settings/agent/{id}", (HttpContext context) =>
{
var snapshot = Volatile.Read(ref config);
context.Response.Headers["X-Camera-Config-Version"] = CameraConfigVersion.Compute(snapshot);
return Results.Json(snapshot);
});
app.MapPost("/api/settings/agent/{id}/camera-config-ack", () => Results.NoContent());
await app.StartAsync();
var factory = Substitute.For<IHttpClientFactory>();
factory.CreateClient("Central").Returns(_ => new HttpClient());
@@ -504,7 +512,7 @@ public class ConfigReceiverServiceTests
await service.StopAsync(CancellationToken.None);
}
/// <summary>Returns a fixed JSON body for any request (used to stub the Central config API).</summary>
/// <summary>Returns the versioned Central config and accepts its acknowledgement.</summary>
private sealed class StubHttpMessageHandler : HttpMessageHandler
{
private readonly string _json;
@@ -514,10 +522,14 @@ public class ConfigReceiverServiceTests
protected override Task<HttpResponseMessage> SendAsync(
HttpRequestMessage request, CancellationToken cancellationToken)
{
if (request.Method == HttpMethod.Post)
return Task.FromResult(new HttpResponseMessage(System.Net.HttpStatusCode.NoContent));
var response = new HttpResponseMessage(System.Net.HttpStatusCode.OK)
{
Content = new StringContent(_json, System.Text.Encoding.UTF8, "application/json")
};
var settings = JsonSerializer.Deserialize<Dictionary<string, string>>(_json)!;
response.Headers.Add("X-Camera-Config-Version", CameraConfigVersion.Compute(settings));
return Task.FromResult(response);
}
}