Add Gitea deploy workflow, compose stack and health endpoint
Build and deploy / build (push) Successful in 1m52s
Build and deploy / deploy (push) Successful in 30s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
TomandClaude Opus 5.5 committed 2026-11-14 14:32:25 +01:00
1 parent 7c39cb5562
commit e9758499ff
13 files changed
+421 -2

No files matched your search

@@ -0,0 +1,53 @@
using System.Net;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Data.Sqlite;
using Shouldly;
namespace Flypaper.Tests.Web;
public sealed class HealthEndpointTests : IDisposable
{
private readonly string _dbPath = Path.Combine(Path.GetTempPath(), $"flypaper-health-{Guid.NewGuid():N}.db");
private readonly WebApplicationFactory<Program> _factory;
public HealthEndpointTests()
{
_factory = new WebApplicationFactory<Program>().WithWebHostBuilder(builder =>
{
builder.UseSetting("ConnectionStrings:Flypaper", $"Data Source={_dbPath}");
builder.UseSetting("Flypaper:Http:KnownHosts:0", "localhost");
});
}
[Fact]
public async Task Reports_healthy_without_login()
{
using var client = _factory.CreateClient(new WebApplicationFactoryClientOptions { AllowAutoRedirect = false });
var response = await client.GetAsync("/health");
response.StatusCode.ShouldBe(HttpStatusCode.OK);
(await response.Content.ReadAsStringAsync()).ShouldBe("healthy");
}
[Fact]
public async Task Keeps_dashboard_behind_login()
{
using var client = _factory.CreateClient(new WebApplicationFactoryClientOptions { AllowAutoRedirect = false });
var response = await client.GetAsync("/");
response.StatusCode.ShouldBe(HttpStatusCode.Redirect);
response.Headers.Location!.OriginalString.ShouldStartWith("http://localhost/login");
}
public void Dispose()
{
_factory.Dispose();
SqliteConnection.ClearAllPools();
foreach (var suffix in new[] { "", "-wal", "-shm" })
{
File.Delete(_dbPath + suffix);
}
}
}