mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-24 16:41:30 +02:00
[infrastructure] Assert the cancellation error, not just any error
A non-nil check passes for a lookup that failed for some unrelated reason, which would let the context handling regress unnoticed. exec.Cmd.Start returns the context's own error when it is already done, so the wrapped error carries context.Canceled and can be asserted directly.
This commit is contained in:
@@ -157,5 +157,5 @@ func TestModuleDirHonoursContext(t *testing.T) {
|
||||
cancel()
|
||||
|
||||
_, err := moduleDir(ctx, modulePath)
|
||||
assert.Error(t, err, "a cancelled context must fail the lookup")
|
||||
assert.ErrorIs(t, err, context.Canceled, "a cancelled context must stop the lookup")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user