Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
devices: Fix panic in tests when logger used after stopping
The netlink unsubscribing is async and the error callback is sometimes called with an error after unsubscribing: panic: Log in goroutine after TestDevicesController has completed: time=2024-05-14T15:40:53.086Z level=WARN msg="Netlink error received, restarting" module=devices-controller error="Receive failed: Receive called on a closed socket" Ignore the error if we've cancelled the context. Before this fix: $ PRIVILEGED_TESTS=1 sudo -E stress go test . -test.v -test.run Devices -test.count 2 20s: 32 runs so far, 25 failures (78.12%) After this fix: $ PRIVILEGED_TESTS=1 sudo -E stress go test . -test.v -test.run Devices -test.count 2 30s: 51 runs so far, 0 failures Fixes: 18ed625 ("devices: Convert from logrus to slog") Signed-off-by: Jussi Maki <jussi@isovalent.com>
- Loading branch information