Files
Marc Schier 60dc5ab404 Reset the push coordinator after each PushComplianceRegressionTests test (#4719)
# Description

`dotnet test tests/Opc.Ua.Server.Tests` exits 1 even when every test
passes. The assembly-level `LeakDetectionSetup` teardown reports
`Certificate leak detected: 3 instance(s) created but not disposed`.

Cause: `CloseAndUpdateRejectsRetainedCrlOfRemovedCaAsync` and
`CloseAndUpdateAcceptsVersion3CertificateWithoutExtensionsAsync` stage
TrustList updates through `CloseAndUpdate` and finish without
`ApplyChanges` or `CancelChanges`. `TearDown` disposed the TrustLists
but not the staged operations, so the
`PushConfigurationTransactionCoordinator` kept the staged and original
`CertificateCollection`s undisposed.

CI did not catch it: `.github/scripts/get-test-verdict.ps1` accepts a
nonzero exit when the TRX counters show no failures, and reports it only
as an "at-exit stall" warning.

Fix: `TearDown` calls `m_coordinator.Reset()`, which discards the staged
operations and disposes their collections. This is a test-only change;
in production, a session's staged operations are applied, cancelled, or
discarded when the session closes.

### Validation

| Command | Result |
| --- | --- |
| `dotnet test tests/Opc.Ua.Server.Tests -f net10.0
-p:CustomTestTarget=net10.0 --filter
"FullyQualifiedName~PushComplianceRegressionTests"`, before the fix | 15
passed, but exit 1: `TearDown failed for test fixture
Opc.Ua.Server.Tests.LeakDetectionSetup`, `Certificate leak detected: 3
instance(s) created but not disposed (created=49, disposed=46)` |
| Same, after the fix, 3 runs | 15 passed, exit 0, no leak report |
| Same with `-f net48 -p:CustomTestTarget=net48` | 15 passed, exit 0 |
| `dotnet test tests/Opc.Ua.Server.Tests -f net10.0
-p:CustomTestTarget=net10.0` | 8386 passed, 0 failed, 5 skipped; exit 0
|

## Related Issues

- No tracking issue. Found while explaining the exit code 1 of a full
`Opc.Ua.Server.Tests` run for #4716.

## Checklist

- [ ] I have signed the
[CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf)
and read the
[CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md)
doc.
- [ ] I have added tests that prove my fix is effective or that my
feature works and increased code coverage.
- [x] I have added all necessary documentation.
- [x] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [ ] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed.
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [ ] I have addressed **all** PR feedback received.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-09 15:50:41 +02:00
..