Files
k8sgpt/pkg
Anas Khan 492af39e14 test: assert Serve error synchronously after shutdown in TestServe (#1687)
TestServe started the server in a goroutine that captured Serve's
return value, slept two seconds, then called assert.NoError on it. The
test body returned immediately after Shutdown without ever joining that
goroutine, so the assertion ran after the test had already been recorded
as passed and could never affect its result (a dead assertion). It was
also wrong: closing the listener in Shutdown makes Serve return a
net.ErrClosed error, not nil.

Capture Serve's error over a buffered channel and assert it synchronously
in the test body after Shutdown, checking it wraps net.ErrClosed so the
check actually runs within the test's lifetime and catches an unexpected
Serve failure.

Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
Co-authored-by: Alex Jones <1235925+AlexsJones@users.noreply.github.com>
2026-07-15 07:07:10 +00:00
..
2025-12-22 08:24:18 +00:00
2025-12-22 08:24:18 +00:00