Fix race in pod watcher test

What does this MR do?

Fix race in pod watcher test

Set the pod name as soon as possible, this also aligns more with the actual usage in the executor, where we set the pod name in prepare and consume from the error channel later.

Why was this MR needed?

To deflake the tests

What's the best way to test this MR?

  • see the pipeline not be falky for that test
  • run tests a lot locally
    go test -count=100 -failfast -race -run 'TestPodWatcher$' ./executors/kubernetes/internal/watchers/

What are the relevant issue numbers?

closes #38491 (closed)

Merge request reports

Loading