36fe158b43
Stand up the modular-monolith skeleton per docs/V1_BUILD_PLAN.md: one .NET 10 solution with web + worker hosts sharing seven interface-bounded module projects, PostgreSQL 17 + pgvector via EF Core 10, a React 19 + Vite SPA built into wwwroot, and Docker Compose for one-command local dev. Skeleton only — no feature code. Architecture - One project per module (OrgBoard, Identity, Skills, Assembler, Governance, Memory, Integrations); each is its own assembly so non-public types (entities, DbContext) are invisible across modules at compile time. - TeamUp.Bootstrap is the only library that references all modules; both hosts reference only Bootstrap. SharedKernel/Infrastructure never reference modules. - IModule seam: Register(...) runs in both hosts; MapEndpoints(...) only in web. - PlatformDbContext owns the pgvector extension + the seven module schemas (InitialPlatform migration); MigrationRunner applies it then any module context. - One image, two roles selected by RUN_MODE at the Docker entrypoint. Verified - dotnet build green (nullable + warnings-as-errors). - ArchitectureTests 8/8 — reflection-based boundary rules (no module -> module, -> Infrastructure, -> Bootstrap, or -> host references). - IntegrationTests 10/10 — Testcontainers boots the host against real pgvector: migration applies, vector extension + 7 schemas exist, /health 200, every /api/<module>/ping 200, /openapi/v1.json served. - client builds clean (Vite 6 — pinned for Node 22.3.0; Vite 8 needs Node >=22.12). Packages and base images route through the Nexus mirror (mirror.soroushasadi.com), reachable from Iran when nuget.org / Docker Hub / MCR are not. CI is intentionally deferred to a later session. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
92 lines
3.1 KiB
C#
92 lines
3.1 KiB
C#
using System.Net;
|
|
using System.Net.Http.Json;
|
|
using Npgsql;
|
|
using Xunit;
|
|
|
|
namespace TeamUp.IntegrationTests;
|
|
|
|
/// <summary>
|
|
/// End-to-end skeleton proof: the web host boots, the platform migration applies (vector
|
|
/// extension + the 7 module schemas), health is green, every module endpoint seam is wired, and
|
|
/// the OpenAPI document is served. All tests share one container (sequential, same collection).
|
|
/// </summary>
|
|
[Collection(PostgresCollection.Name)]
|
|
public sealed class BootAndMigrateTests(PostgresFixture postgres)
|
|
{
|
|
private static readonly string[] ExpectedSchemas =
|
|
["identity", "orgboard", "skills", "integrations", "memory", "assembler", "governance"];
|
|
|
|
[Fact]
|
|
public async Task Health_endpoint_reports_200()
|
|
{
|
|
await using var factory = new TeamUpWebFactory(postgres.ConnectionString);
|
|
using var client = factory.CreateClient();
|
|
|
|
var response = await client.GetAsync("/health");
|
|
|
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Startup_migration_creates_vector_extension_and_module_schemas()
|
|
{
|
|
await using var factory = new TeamUpWebFactory(postgres.ConnectionString);
|
|
using (factory.CreateClient())
|
|
{
|
|
// Creating the client forces the host to start, which applies the migration.
|
|
}
|
|
|
|
await using var connection = new NpgsqlConnection(postgres.ConnectionString);
|
|
await connection.OpenAsync();
|
|
|
|
await using (var extensionCmd =
|
|
new NpgsqlCommand("SELECT 1 FROM pg_extension WHERE extname = 'vector'", connection))
|
|
{
|
|
Assert.NotNull(await extensionCmd.ExecuteScalarAsync());
|
|
}
|
|
|
|
foreach (var schema in ExpectedSchemas)
|
|
{
|
|
await using var schemaCmd = new NpgsqlCommand(
|
|
"SELECT 1 FROM information_schema.schemata WHERE schema_name = @schema", connection);
|
|
schemaCmd.Parameters.AddWithValue("schema", schema);
|
|
Assert.NotNull(await schemaCmd.ExecuteScalarAsync());
|
|
}
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("identity")]
|
|
[InlineData("orgboard")]
|
|
[InlineData("skills")]
|
|
[InlineData("integrations")]
|
|
[InlineData("memory")]
|
|
[InlineData("assembler")]
|
|
[InlineData("governance")]
|
|
public async Task Module_ping_endpoint_responds(string module)
|
|
{
|
|
await using var factory = new TeamUpWebFactory(postgres.ConnectionString);
|
|
using var client = factory.CreateClient();
|
|
|
|
var response = await client.GetAsync($"/api/{module}/ping");
|
|
|
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
|
|
var payload = await response.Content.ReadFromJsonAsync<ModulePingResponse>();
|
|
Assert.NotNull(payload);
|
|
Assert.Equal(module, payload!.Module);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task OpenApi_document_is_served()
|
|
{
|
|
await using var factory = new TeamUpWebFactory(postgres.ConnectionString);
|
|
using var client = factory.CreateClient();
|
|
|
|
var response = await client.GetAsync("/openapi/v1.json");
|
|
|
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
}
|
|
|
|
private sealed record ModulePingResponse(string Module, string Status);
|
|
}
|