File tree 1 file changed +7
-0
lines changed
CheckDrive.Api/Tests/CheckDrive.Tests.Api/Helpers
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 1
1
using CheckDrive . Infrastructure . Persistence ;
2
+ using DotNet . Testcontainers . Builders ;
2
3
using Microsoft . Data . SqlClient ;
3
4
using Microsoft . EntityFrameworkCore ;
4
5
using Testcontainers . MsSql ;
@@ -8,7 +9,9 @@ namespace CheckDrive.Tests.Api.Helpers;
8
9
public class DatabaseFixture : IAsyncLifetime
9
10
{
10
11
private readonly MsSqlContainer _sqlServerContainer = new MsSqlBuilder ( )
12
+ . WithExposedPort ( 1433 )
11
13
. WithName ( "TestDb" )
14
+ . WithWaitStrategy ( Wait . ForUnixContainer ( ) . UntilPortIsAvailable ( 1433 ) )
12
15
. Build ( ) ;
13
16
14
17
private CheckDriveDbContext ? _context ;
@@ -61,6 +64,10 @@ public async Task InitializeAsync()
61
64
catch ( Exception ex )
62
65
{
63
66
Console . WriteLine ( "There was an error intializing test database, {0}" , ex . Message ) ;
67
+
68
+ var logs = await _sqlServerContainer . GetLogsAsync ( ) ;
69
+ Console . WriteLine ( "Container Logs: " + logs ) ;
70
+
64
71
throw ;
65
72
}
66
73
}
You can’t perform that action at this time.
0 commit comments