Dockerize integration tests to isolate Application event log pollution#535
Merged
Conversation
NikTilton
previously approved these changes
May 20, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a Windows-container-based harness to run the integration test projects in isolation so integration tests that write to the Application event log don’t pollute the developer host’s real event log, plus a small test-race mitigation in the Runtime integration tests.
Changes:
- Introduces a repo-root
compose.ymlwith three services to run each integration test project in an isolated Windows Server Core container. - Adds a PowerShell entrypoint that ensures the Windows Event Log service is running, seeds
Applicationrecords for cold containers, and runsdotnet testusing artifacts output and TRX results to a bind-mounted host directory. - Updates integration-test docs and gitignore, and adds a timing-based mitigation for a disposal/cancellation race in
DatabaseServiceTests.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Integration/README.md | Documents Docker-based integration test workflow, prerequisites, output locations, cleanup, and host fallback. |
| tests/Integration/EventLogExpert.Runtime.IntegrationTests/Database/DatabaseServiceTests.cs | Adds a delay to reduce a cancellation propagation race during disposal with pending batches. |
| docker/integration-tests-entrypoint.ps1 | Container entrypoint: validate eventlog service, seed Application events, run dotnet test with artifacts output + TRX. |
| compose.yml | Defines three Windows-container services (one per integration test project) with shared NuGet/artifacts volumes. |
| .gitignore | Ignores TRX output directory written via Docker bind-mount. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9732119 to
55314ee
Compare
…on event log writes
55314ee to
1f0874a
Compare
NikTilton
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Integration tests (especially
EventLogWatcherTests) write to the host'sApplicationevent log and depend on host-specific provider inventory. Running them during normal development pollutes the dev's event log with test noise.What
Default behavior — integration tests excluded from "Run All Tests"
xunit.v3toxunit.v3.mtp-off(VSTest mode instead of Microsoft.Testing.Platform) so VS Test Explorer honors.runsettingsfilters.EventLogExpert.runsettingswithFullyQualifiedName!~IntegrationTestsfilter, wired viaRunSettingsFilePathinDirectory.Build.props.Docker Compose for running integration tests
compose.ymlwith three services (eventing,runtime,eventdbtool) running inside Windows Server Core containers via Hyper-V isolation.docker/integration-tests-entrypoint.ps1ensures the EventLog service is healthy, then runsdotnet testwith artifacts-output layout and-p:RunSettingsFilePath=to override the default filter.ApplicationLogSeedFixture(assembly-levelIAsyncLifetime) seeds 10 Application records on cold containers (guarded byEVENTLOG_CONTAINERenv var — no-op on host).testenvironments.jsonfor VS Remote Testing dropdown (run tests in container with per-test granularity from Test Explorer).CI
.github/workflows/PullRequest.ymlintegration test step passes-p:RunSettingsFilePath=to run the full suite on ephemeral runners.Test race fix
DatabaseServiceTests.DisposeAsync_WithPendingBatcheshad a pre-existing race:DisposeAsync'sCancelAsyncpropagates to linked batch tokens via async ThreadPool callbacks — fast container I/O raced pastThrowIfCancellationRequestedbefore propagation arrived. Added a 250ms yield with justifying comment. Passes on both host and container.Verification
dotnet test EventLogExpert.slnx --settings EventLogExpert.runsettings: 2,161 unit tests pass, 0 integration tests run.docker compose run --rm eventing: 334 passed, 2 skipped, 0 failed.docker compose run --rm runtime: 124 passed, 0 failed.docker compose run --rm eventdbtool: 38 passed, 0 failed.