File tree Expand file tree Collapse file tree 6 files changed +8
-20
lines changed
JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions Expand file tree Collapse file tree 6 files changed +8
-20
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,7 @@ private string GetConnectionString()
4444 throw GetErrorForInvalidTenant ( tenantName ) ;
4545 }
4646
47- string postgresPassword = Environment . GetEnvironmentVariable ( "PGPASSWORD" ) ?? "postgres" ;
48- return connectionString . Replace ( "###" , postgresPassword ) ;
47+ return connectionString ;
4948 }
5049
5150 private string ? GetTenantName ( )
Original file line number Diff line number Diff line change 11{
22 "ConnectionStrings" : {
3- "Default" : " Host=localhost;Database=DefaultTenantDb;User ID=postgres;Password=### ;Include Error Detail=true" ,
4- "AdventureWorks" : " Host=localhost;Database=AdventureWorks;User ID=postgres;Password=### ;Include Error Detail=true" ,
5- "Contoso" : " Host=localhost;Database=Contoso;User ID=postgres;Password=### ;Include Error Detail=true"
3+ "Default" : " Host=localhost;Database=DefaultTenantDb;User ID=postgres;Password=postgres ;Include Error Detail=true" ,
4+ "AdventureWorks" : " Host=localhost;Database=AdventureWorks;User ID=postgres;Password=postgres ;Include Error Detail=true" ,
5+ "Contoso" : " Host=localhost;Database=Contoso;User ID=postgres;Password=postgres ;Include Error Detail=true"
66 },
77 "Logging" : {
88 "LogLevel" : {
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ static void ConfigureServices(WebApplicationBuilder builder)
4949
5050 builder . Services . AddDbContext < AppDbContext > ( options =>
5151 {
52- string ? connectionString = GetConnectionString ( builder . Configuration ) ;
52+ string ? connectionString = builder . Configuration . GetConnectionString ( "Default" ) ;
5353 options . UseNpgsql ( connectionString ) ;
5454
5555 SetDbContextDebugOptions ( options ) ;
@@ -73,12 +73,6 @@ static void ConfigureServices(WebApplicationBuilder builder)
7373 }
7474}
7575
76- static string ? GetConnectionString ( IConfiguration configuration )
77- {
78- string postgresPassword = Environment . GetEnvironmentVariable ( "PGPASSWORD" ) ?? "postgres" ;
79- return configuration . GetConnectionString ( "Default" ) ? . Replace ( "###" , postgresPassword ) ;
80- }
81-
8276[ Conditional ( "DEBUG" ) ]
8377static void SetDbContextDebugOptions ( DbContextOptionsBuilder options )
8478{
Original file line number Diff line number Diff line change 11{
22 "ConnectionStrings" : {
3- "Default" : " Host=localhost;Database=JsonApiDotNetCoreExample;User ID=postgres;Password=### ;Include Error Detail=true"
3+ "Default" : " Host=localhost;Database=JsonApiDotNetCoreExample;User ID=postgres;Password=postgres ;Include Error Detail=true"
44 },
55 "Logging" : {
66 "LogLevel" : {
Original file line number Diff line number Diff line change @@ -27,10 +27,8 @@ public AtomicTransactionConsistencyTests(IntegrationTestContext<TestableStartup<
2727 services . AddResourceRepository < MusicTrackRepository > ( ) ;
2828 services . AddResourceRepository < LyricRepository > ( ) ;
2929
30- string postgresPassword = Environment . GetEnvironmentVariable ( "PGPASSWORD" ) ?? "postgres" ;
31-
3230 string dbConnectionString =
33- $ "Host=localhost;Database=JsonApiTest-Extra-{ Guid . NewGuid ( ) : N} ;User ID=postgres;Password={ postgresPassword } ;Include Error Detail=true";
31+ $ "Host=localhost;Database=JsonApiTest-Extra-{ Guid . NewGuid ( ) : N} ;User ID=postgres;Password=postgres ;Include Error Detail=true";
3432
3533 services . AddDbContext < ExtraDbContext > ( options => options . UseNpgsql ( dbConnectionString ) ) ;
3634 } ) ;
Original file line number Diff line number Diff line change @@ -64,10 +64,7 @@ protected override HttpClient CreateClient()
6464
6565 private WebApplicationFactory < TStartup > CreateFactory ( )
6666 {
67- string postgresPassword = Environment . GetEnvironmentVariable ( "PGPASSWORD" ) ?? "postgres" ;
68-
69- string dbConnectionString =
70- $ "Host=localhost;Database=JsonApiTest-{ Guid . NewGuid ( ) : N} ;User ID=postgres;Password={ postgresPassword } ;Include Error Detail=true";
67+ string dbConnectionString = $ "Host=localhost;Database=JsonApiTest-{ Guid . NewGuid ( ) : N} ;User ID=postgres;Password=postgres;Include Error Detail=true";
7168
7269 var factory = new IntegrationTestWebApplicationFactory ( ) ;
7370
You can’t perform that action at this time.
0 commit comments