Commit 1068af2
authored
tests: restore DescriptorParserTests in a separate SamRockProtocol.UnitTests project (#17)
* tests: restore DescriptorParserTests in a separate SamRockProtocol.UnitTests project
PR #15 deleted DescriptorParserTests because the compile-time refs
to SamRockProtocol.Services types triggered a JIT-time assembly
load in the SamRockProtocol.Tests integration assembly, which then
poisoned BTCPay's PluginManager AppDomain scan and locked out MVC
controller registration for the plugin under test.
Restore them in a dedicated SamRockProtocol.UnitTests project that
references ONLY the plugin csproj (no BTCPayServer test fixtures).
The integration test assembly (SamRockProtocol.Tests) stays
disentangled - it does not reference this new project, and this
new project does not reference any BTCPay test types, so the
poison-via-AppDomain-load path stays closed.
- New SamRockProtocol.UnitTests/SamRockProtocol.UnitTests.csproj
(net8.0, xunit + xunit.runner.visualstudio + Microsoft.NET.Test.Sdk).
- New SamRockProtocol.UnitTests/DescriptorParserTests.cs - 16
restored tests from c881ef2's original PR #13 content, namespace
renamed to SamRockProtocol.UnitTests. 25 distinct test cases
including the [Theory] parametrizations.
- SamRockProtocol.sln gets the new project.
- .github/workflows/playwright.yml splits the test step into two:
unit tests run first (~1s, no Docker), integration tests after.
Keeps the fast unit-test feedback loop separate from the heavy
ServerTester boot path.
* tests: remove DescriptorParserTests + plugin ProjectReference from integration assembly
PR #15 squash-merge only landed the AppDomain force-load removal from
SharedPluginTestFixture - it did NOT land the DescriptorParserTests
deletion that the PR branch carried. As a result, master still has:
- SamRockProtocol.Tests/DescriptorParserTests.cs with `using
SamRockProtocol.Services;` compile-time refs
- a `<ProjectReference Include="..\Plugins\SamRockProtocol\..." />`
in SamRockProtocol.Tests.csproj
Either is enough to trigger a JIT-time load of the SamRockProtocol
assembly into the integration test process's AppDomain at xunit-
discovery time, before PluginManager.AddPlugins runs. PluginManager
then scans AppDomain.CurrentDomain.GetAssemblies(), finds the plugin
already present, registers with Loader=null, and the dedup at
PluginManager.cs:204 locks out the file-based PluginLoader path.
mvcBuilder.AddPluginLoader is skipped because Loader is null - MVC
ApplicationParts never includes the plugin's controllers - every
plugin route 404s. Master CI #26 on 14a4389 reproduces exactly this:
plugin in DI list, OTP create 404 x20 attempts, test fails.
Removing both the file + the ProjectReference from the integration
assembly closes the AppDomain-poison path by construction. The plugin
DLL is still produced by the solution build (the .sln + the new
SamRockProtocol.UnitTests project both still reference it), and the
"Configure plugin path for tests" workflow step still copies it to
~/.btcpayserver/Plugins/SamRockProtocol/ so the runtime PluginLoader
path can load it cleanly.
The new SamRockProtocol.UnitTests project (added in this PR) keeps
the DescriptorParser unit tests alive in a process-isolated assembly
that has no compile-time relation to SamRockProtocol.Tests, so it
cannot re-poison the integration AppDomain.
Validation:
- Solution build clean (0 errors)
- SamRockProtocol.UnitTests: 25/25 passing locally
- Integration test runs via separate `dotnet test SamRockProtocol.Tests`
step in CI, in its own process, with no plugin metadata reference
* ci: run unit tests before Docker boot so fast-feedback claim is honest
Hermes nit on PR #17 review: workflow comment said unit tests don't
need Docker, but YAML ordering had Docker boot before unit tests so
the fast-feedback loop wasn't actually delivered. Reorder to:
Run unit tests -> Start Docker containers -> Run integration tests
Unit tests fail fast (~1s) without paying the Docker boot cost.
---------
Co-authored-by: r1ckstardev <r1ckstardev@users.noreply.github.com>1 parent 14a4389 commit 1068af2
5 files changed
Lines changed: 68 additions & 3 deletions
File tree
- .github/workflows
- SamRockProtocol.Tests
- SamRockProtocol.UnitTests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
86 | 93 | | |
87 | 94 | | |
88 | | - | |
| 95 | + | |
89 | 96 | | |
90 | 97 | | |
91 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
192 | 206 | | |
193 | 207 | | |
194 | 208 | | |
| |||
0 commit comments