File tree 4 files changed +17
-10
lines changed
DapperTests/IntegrationTests
4 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,6 @@ concurrency:
23
23
env :
24
24
DOTNET_SKIP_FIRST_TIME_EXPERIENCE : true
25
25
DOTNET_CLI_TELEMETRY_OPTOUT : true
26
- # The Windows runner image has PostgreSQL pre-installed and sets the PGPASSWORD environment variable to "root".
27
- # This conflicts with the default password "postgres", which is used by ikalnytskyi/action-setup-postgres.
28
- # Because action-setup-postgres forgets to update the environment variable accordingly, we do so here.
29
- PGPASSWORD : " postgres"
30
26
31
27
jobs :
32
28
build-and-test :
42
38
- name : Tune GitHub-hosted runner network
43
39
uses : smorimoto/tune-github-hosted-runner-network@v1
44
40
- name : Setup PostgreSQL
45
- uses : ikalnytskyi/action-setup-postgres@v4
41
+ uses : ikalnytskyi/action-setup-postgres@v5
46
42
with :
47
43
username : postgres
48
44
password : postgres
@@ -131,6 +127,13 @@ jobs:
131
127
run : |
132
128
dotnet build --no-restore --configuration Release /p:VersionSuffix=$env:PACKAGE_VERSION_SUFFIX
133
129
- name : Test
130
+ env :
131
+ # Override log levels, to reduce logging output when running tests in ci-build.
132
+ Logging__LogLevel__Microsoft.Hosting.Lifetime : ' None'
133
+ Logging__LogLevel__Microsoft.AspNetCore.Hosting.Diagnostics : ' None'
134
+ Logging__LogLevel__Microsoft.Extensions.Hosting.Internal.Host : ' None'
135
+ Logging__LogLevel__Microsoft.EntityFrameworkCore.Database.Command : ' None'
136
+ Logging__LogLevel__JsonApiDotNetCore : ' None'
134
137
run : |
135
138
dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --logger "GitHubActions;summary.includeSkippedTests=true"
136
139
- name : Upload coverage to codecov.io
Original file line number Diff line number Diff line change 27
27
<WarnOnPackingNonPackableProject >false</WarnOnPackingNonPackableProject >
28
28
<CodeAnalysisRuleSet >$(MSBuildThisFileDirectory)CodingGuidelines.ruleset</CodeAnalysisRuleSet >
29
29
<RunSettingsFilePath >$(MSBuildThisFileDirectory)tests.runsettings</RunSettingsFilePath >
30
- <JsonApiDotNetCoreVersionPrefix >5.5.1 </JsonApiDotNetCoreVersionPrefix >
30
+ <JsonApiDotNetCoreVersionPrefix >5.5.2 </JsonApiDotNetCoreVersionPrefix >
31
31
</PropertyGroup >
32
32
</Project >
Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ private WebApplicationFactory<TodoItem> CreateFactory()
69
69
{
70
70
if ( _testOutputHelper != null )
71
71
{
72
+ #if ! DEBUG
73
+ // Reduce logging output when running tests in ci-build.
74
+ loggingBuilder . ClearProviders ( ) ;
75
+ #endif
72
76
loggingBuilder . Services . AddSingleton < ILoggerProvider > ( _ => new XUnitLoggerProvider ( _testOutputHelper , "DapperExample." ) ) ;
73
77
}
74
78
} ) ;
Original file line number Diff line number Diff line change @@ -83,8 +83,8 @@ private WebApplicationFactory<TStartup> CreateFactory()
83
83
} ) ;
84
84
} ) ;
85
85
86
- // We have placed an appsettings.json in the TestBuildingBlock project folder and set the content root to there. Note that controllers
87
- // are not discovered in the content root but are registered manually using IntegrationTestContext.UseController.
86
+ // We have placed an appsettings.json in the TestBuildingBlocks project directory and set the content root to there. Note that
87
+ // controllers are not discovered in the content root, but are registered manually using IntegrationTestContext.UseController.
88
88
WebApplicationFactory < TStartup > factoryWithConfiguredContentRoot =
89
89
factory . WithWebHostBuilder ( builder => builder . UseSolutionRelativeContentRoot ( $ "test/{ nameof ( TestBuildingBlocks ) } ") ) ;
90
90
@@ -161,8 +161,8 @@ protected override IHostBuilder CreateHostBuilder()
161
161
. CreateDefaultBuilder ( null )
162
162
. ConfigureAppConfiguration ( builder =>
163
163
{
164
- // For tests asserting on log output, we discard the logging settings from appsettings.json.
165
- // But using appsettings.json for all other tests makes it easy to quickly toggle when debugging.
164
+ // For tests asserting on log output, we discard the log levels from appsettings.json and environment variables .
165
+ // But using appsettings.json for all other tests makes it easy to quickly toggle when debugging tests .
166
166
if ( _loggingConfiguration != null )
167
167
{
168
168
builder . Sources . Clear ( ) ;
You can’t perform that action at this time.
0 commit comments