File tree 6 files changed +8
-20
lines changed
JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions
6 files changed +8
-20
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,7 @@ private string GetConnectionString()
44
44
throw GetErrorForInvalidTenant ( tenantName ) ;
45
45
}
46
46
47
- string postgresPassword = Environment . GetEnvironmentVariable ( "PGPASSWORD" ) ?? "postgres" ;
48
- return connectionString . Replace ( "###" , postgresPassword ) ;
47
+ return connectionString ;
49
48
}
50
49
51
50
private string ? GetTenantName ( )
Original file line number Diff line number Diff line change 1
1
{
2
2
"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"
6
6
},
7
7
"Logging" : {
8
8
"LogLevel" : {
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ static void ConfigureServices(WebApplicationBuilder builder)
49
49
50
50
builder . Services . AddDbContext < AppDbContext > ( options =>
51
51
{
52
- string ? connectionString = GetConnectionString ( builder . Configuration ) ;
52
+ string ? connectionString = builder . Configuration . GetConnectionString ( "Default" ) ;
53
53
options . UseNpgsql ( connectionString ) ;
54
54
55
55
SetDbContextDebugOptions ( options ) ;
@@ -73,12 +73,6 @@ static void ConfigureServices(WebApplicationBuilder builder)
73
73
}
74
74
}
75
75
76
- static string ? GetConnectionString ( IConfiguration configuration )
77
- {
78
- string postgresPassword = Environment . GetEnvironmentVariable ( "PGPASSWORD" ) ?? "postgres" ;
79
- return configuration . GetConnectionString ( "Default" ) ? . Replace ( "###" , postgresPassword ) ;
80
- }
81
-
82
76
[ Conditional ( "DEBUG" ) ]
83
77
static void SetDbContextDebugOptions ( DbContextOptionsBuilder options )
84
78
{
Original file line number Diff line number Diff line change 1
1
{
2
2
"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"
4
4
},
5
5
"Logging" : {
6
6
"LogLevel" : {
Original file line number Diff line number Diff line change @@ -27,10 +27,8 @@ public AtomicTransactionConsistencyTests(IntegrationTestContext<TestableStartup<
27
27
services . AddResourceRepository < MusicTrackRepository > ( ) ;
28
28
services . AddResourceRepository < LyricRepository > ( ) ;
29
29
30
- string postgresPassword = Environment . GetEnvironmentVariable ( "PGPASSWORD" ) ?? "postgres" ;
31
-
32
30
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";
34
32
35
33
services . AddDbContext < ExtraDbContext > ( options => options . UseNpgsql ( dbConnectionString ) ) ;
36
34
} ) ;
Original file line number Diff line number Diff line change @@ -64,10 +64,7 @@ protected override HttpClient CreateClient()
64
64
65
65
private WebApplicationFactory < TStartup > CreateFactory ( )
66
66
{
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";
71
68
72
69
var factory = new IntegrationTestWebApplicationFactory ( ) ;
73
70
You can’t perform that action at this time.
0 commit comments