28 lines
869 B
C#
28 lines
869 B
C#
|
|
using Testcontainers.PostgreSql;
|
||
|
|
using Xunit;
|
||
|
|
|
||
|
|
namespace TeamUp.IntegrationTests;
|
||
|
|
|
||
|
|
/// <summary>A throwaway Postgres 17 + pgvector container, shared across the integration tests.</summary>
|
||
|
|
public sealed class PostgresFixture : IAsyncLifetime
|
||
|
|
{
|
||
|
|
private readonly PostgreSqlContainer _container = new PostgreSqlBuilder()
|
||
|
|
.WithImage("pgvector/pgvector:pg17")
|
||
|
|
.WithDatabase("teamup")
|
||
|
|
.WithUsername("teamup")
|
||
|
|
.WithPassword("teamup")
|
||
|
|
.Build();
|
||
|
|
|
||
|
|
public string ConnectionString => _container.GetConnectionString();
|
||
|
|
|
||
|
|
public async ValueTask InitializeAsync() => await _container.StartAsync();
|
||
|
|
|
||
|
|
public async ValueTask DisposeAsync() => await _container.DisposeAsync();
|
||
|
|
}
|
||
|
|
|
||
|
|
[CollectionDefinition(Name)]
|
||
|
|
public sealed class PostgresCollection : ICollectionFixture<PostgresFixture>
|
||
|
|
{
|
||
|
|
public const string Name = "postgres";
|
||
|
|
}
|