tests: guarantee cleanup in Modbus cache-reset fixture failure paths #727
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Read-only #725 cancellation-warning review found a separate test-owned resource cleanup gap beyond #726’s approved six-fixture scope. Verified at local head
eed7cc7d75e4690fb409e0358249489547ace641.tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Modbus.Tests/ModbusLifecycleHygieneTests.cs:112(Reinitialize_clears_lastPublished_and_lastWritten_caches) creates a fake-transport driver and initializes it at line124. Assertions and the subscription/polling path at lines135–142 run beforeUnsubscribeAsync/ShutdownAsyncat143–145. The class is not IDisposable/IAsyncLifetime, and this method has no using/finally cleanup. An initialization or assertion failure bypasses those calls.Default probing is enabled (
src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Modbus.Contracts/ModbusDriverOptions.cs:39,236); initialization starts the probe CTS/background work (ModbusDriver.cs:354–358). Shutdown/disposal cancels those tokens, disposes the poll engine and fake transport (ModbusDriver.cs:1798–1819). Subscription ownership is additional work on the successful subscribe path. Thus the test owns resources whose cleanup is not registered for failures. This is source evidence of an ownership omission, not a reproduced leak duration, deadlock, production-driver defect or historical CI cause.Acceptance:
Related #725 and #726. #726’s empty-bitmap test cleanup is already independently reviewed and locally committed; this cache-reset fixture is not in that bounded implementation. The warning audit sampled19 sites, not every lifecycle test. Exact-test-name state=all duplicate search returned no issue. Evidence:
work/lmx725-cancellation-warning-audit.mdplus parent source inspection. No implementation has been performed for this follow-up; it needs its own bounded design approval.The bounded source check found a separate production token-acquisition race window, now tracked in#729. Modbus’s scheduling token is evaluated immediately while the worker lambda retrieves its token later from mutable CTS fields. Local BCL/docs support a post-start-check teardown/replacement interleaving; execution impact remains unmeasured. No#728/historical CI cause is inferred. #727 remains strictly the approved-question test-only cleanup scope; do not blend production token/join changes into it. No source edits or test execution were performed for the new finding. Existing#726 fake-resource evidence remains scenario-specific and does not establish an authoritative probe-task join.