wip: doctor/cli/docs/api to vector db consolidation; api hardening for descriptions, tenant, and scopes; migrations and conversions of all DALs to EF v10

This commit is contained in:
master
2026-02-23 15:30:50 +02:00
parent bd8fee6ed8
commit e746577380
1424 changed files with 81225 additions and 25251 deletions

View File

@@ -1,7 +1,10 @@
using FluentAssertions;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Npgsql;
using StellaOps.Infrastructure.Postgres.Options;
using StellaOps.Unknowns.Core.Models;
using StellaOps.Unknowns.Persistence.Postgres;
using StellaOps.Unknowns.Persistence.Postgres.Repositories;
using Testcontainers.PostgreSql;
using Xunit;
@@ -16,7 +19,7 @@ public sealed class PostgresUnknownRepositoryTests : IAsyncLifetime
.WithImage("postgres:16")
.Build();
private NpgsqlDataSource _dataSource = null!;
private UnknownsDataSource _dataSource = null!;
private PostgresUnknownRepository _repository = null!;
private const string TestTenantId = "test-tenant";
@@ -25,10 +28,17 @@ public sealed class PostgresUnknownRepositoryTests : IAsyncLifetime
await _postgres.StartAsync();
var connectionString = _postgres.GetConnectionString();
_dataSource = NpgsqlDataSource.Create(connectionString);
// Run schema migrations
await RunMigrationsAsync();
// Run schema migrations using a raw NpgsqlDataSource
await RunMigrationsAsync(connectionString);
// Create the UnknownsDataSource with PostgresOptions
var options = Options.Create(new PostgresOptions
{
ConnectionString = connectionString,
SchemaName = "unknowns"
});
_dataSource = new UnknownsDataSource(options, NullLogger<UnknownsDataSource>.Instance);
_repository = new PostgresUnknownRepository(
_dataSource,
@@ -41,9 +51,10 @@ public sealed class PostgresUnknownRepositoryTests : IAsyncLifetime
await _postgres.DisposeAsync();
}
private async Task RunMigrationsAsync()
private static async Task RunMigrationsAsync(string connectionString)
{
await using var connection = await _dataSource.OpenConnectionAsync();
var rawDataSource = NpgsqlDataSource.Create(connectionString);
await using var connection = await rawDataSource.OpenConnectionAsync();
// Create schema and types
const string schema = """
@@ -153,6 +164,8 @@ public sealed class PostgresUnknownRepositoryTests : IAsyncLifetime
await using var command = new NpgsqlCommand(schema, connection);
await command.ExecuteNonQueryAsync();
await rawDataSource.DisposeAsync();
}
[Trait("Category", TestCategories.Unit)]