diff --git a/backend/Contexture.Api.Tests/Contexture.Api.Tests.fsproj b/backend/Contexture.Api.Tests/Contexture.Api.Tests.fsproj index ff8ca03..0309b54 100644 --- a/backend/Contexture.Api.Tests/Contexture.Api.Tests.fsproj +++ b/backend/Contexture.Api.Tests/Contexture.Api.Tests.fsproj @@ -39,7 +39,8 @@ - + + diff --git a/backend/Contexture.Api.Tests/EventStore.Tests.fs b/backend/Contexture.Api.Tests/EventStore.Tests.fs index 90f73a3..5cb347b 100644 --- a/backend/Contexture.Api.Tests/EventStore.Tests.fs +++ b/backend/Contexture.Api.Tests/EventStore.Tests.fs @@ -264,7 +264,7 @@ type MsSqlBackedEventStore(msSql: MsSqlFixture) = let config = MsSqlPersistenceOptions( loggerFactory, - ConnectionString = msSql.Container.ConnectionString, + ConnectionString = msSql.Container.GetConnectionString(), StreamsTableName = $"streams_{Interlocked.Increment(counter)}_{this.GetType().Name}", Serializer = NStoreBased.JsonMsSqlSerializer.Default ) diff --git a/backend/Contexture.Api.Tests/PositionStorage.Tests.fs b/backend/Contexture.Api.Tests/PositionStorage.Tests.fs index 6ea6b45..c40aff3 100644 --- a/backend/Contexture.Api.Tests/PositionStorage.Tests.fs +++ b/backend/Contexture.Api.Tests/PositionStorage.Tests.fs @@ -81,10 +81,10 @@ type SqlServerPositionStorage(msSql: MsSqlFixture) = inherit PositionStorageBehavior() override this.EmptyStorage() = - SqlServer.PositionStorage(msSql.Container.ConnectionString) + SqlServer.PositionStorage(msSql.Container.GetConnectionString()) override this.StorageWith items = task { - use client = new SqlConnection(msSql.Container.ConnectionString) + use client = new SqlConnection(msSql.Container.GetConnectionString()) do! client.OpenAsync() // using string concatenation over parameters here is OK because it's just (unit) test code @@ -98,15 +98,15 @@ type SqlServerPositionStorage(msSql: MsSqlFixture) = let! result = command.ExecuteNonQueryAsync() Assert.Equal(items |> List.length, result) - return SqlServer.PositionStorage(msSql.Container.ConnectionString) :> IStorePositions + return SqlServer.PositionStorage(msSql.Container.GetConnectionString()) :> IStorePositions } interface IAsyncLifetime with member this.DisposeAsync() = - SqlServer.PositionStorage.RemoveSchema(msSql.Container.ConnectionString) + SqlServer.PositionStorage.RemoveSchema(msSql.Container.GetConnectionString()) member this.InitializeAsync() = - SqlServer.PositionStorage.CreateSchema(msSql.Container.ConnectionString) + SqlServer.PositionStorage.CreateSchema(msSql.Container.GetConnectionString()) interface IClassFixture with diff --git a/backend/Contexture.Api.Tests/SqlServerFixture.fs b/backend/Contexture.Api.Tests/SqlServerFixture.fs index 11d95a5..a793eb2 100644 --- a/backend/Contexture.Api.Tests/SqlServerFixture.fs +++ b/backend/Contexture.Api.Tests/SqlServerFixture.fs @@ -1,27 +1,20 @@ namespace Contexture.Api.Tests -#nowarn "44" // ContainerBuilder() is deprecated but does not provide a clear guidance yet - open System open System.Threading -open DotNet.Testcontainers.Builders -open DotNet.Testcontainers.Configurations -open DotNet.Testcontainers.Containers +open Testcontainers.MsSql open Xunit type MsSqlFixture() = static let mutable counter = ref 0 - let container = + let container = let containerConfiguration = - ContainerBuilder() - .WithDatabase(new MsSqlTestcontainerConfiguration(Password = "localdevpassword#123")) - .WithImage("mcr.microsoft.com/mssql/server:2019-latest") + MsSqlBuilder() .WithName($"MS-SQL-Integration-Tests-{Interlocked.Increment counter}") .WithCleanUp(false) .WithAutoRemove(true) - let instance = containerConfiguration.Build() - instance + containerConfiguration.Build() member _.Container = container