Files
kubernetes/cmd
Patrick Ohly e04d25c222 apiserver testing: fix support for pre-created TContext
When StartTestServer is called with a TContext by the caller, tearing down the
apiserver via its tear-down function would also cancel the context for everyone
else using it, which is unexpected and not intended.

Accidentally, scheduler_perf and scheduler/batch relied on this behavior:
- The apiserver clients waited on a context that got its cancellation
  from the root context and thus gets canceled last.
- The apiserver was told to stop earlier, but then waited because
  it still had active clients.
- Shutdown gets slowed down enough that integration testing times out.

The fix is to explicitly cancel the clients before the apiserver. Long-term
ktesting should be changed to do the same as the new testing.T.Context: cancel
the context *before* cleaning up, not *after* it.
2026-03-17 07:50:18 +01:00
..