44using System . Text ;
55using System . Threading . Tasks ;
66using DotNet . Testcontainers . Configurations ;
7+ using Npgsql . Tests . Replication ;
78using Testcontainers . PostgreSql ;
89
910namespace Npgsql . Tests . Support ;
1011
1112static class PostgreSqlContainerExtensions
1213{
13- public static async Task EnableSslAsync ( this PostgreSqlContainer container )
14+ /// <summary>
15+ /// Configures the container for maximum test compatibility.
16+ /// <list type="bullet">
17+ /// <item>Enable SSL for <see cref="SecurityTests"/></item>
18+ /// <item>Configure wal_level to <c>logical</c> and max_wal_senders to <c>50</c> for <see cref="SafeReplicationTestBase{T}"/></item>
19+ /// <item>Configure max_prepared_transactions to <c>100</c> for <see cref="DistributedTransactionTests"/></item>
20+ /// </list>
21+ /// </summary>
22+ public static async Task ConfigureAsync ( this PostgreSqlContainer container )
1423 {
1524 var now = DateTimeOffset . UtcNow ;
1625 const UnixFileModes certMode = UnixFileModes . UserRead | UnixFileModes . UserWrite | UnixFileModes . GroupRead | UnixFileModes . OtherRead ;
@@ -21,6 +30,9 @@ public static async Task EnableSslAsync(this PostgreSqlContainer container)
2130 ALTER SYSTEM SET ssl = 'on';
2231 ALTER SYSTEM SET ssl_cert_file = '{ sslCertPath } ';
2332 ALTER SYSTEM SET ssl_key_file = '{ sslKeyPath } ';
33+ ALTER SYSTEM SET wal_level = 'logical';
34+ ALTER SYSTEM SET max_wal_senders = '50';
35+ ALTER SYSTEM SET max_prepared_transactions = '100';
2436 """ ;
2537
2638 var uid = uint . Parse ( ( await container . ExecAsync ( [ "id" , "-u" , "postgres" ] ) ) . Stdout ) ;
0 commit comments