Skip to content

ci: run the Go test suite with -race #2189

Closed

Description

@JohnStrunk

Summary

The Go test suite is never run with the race detector, in CI or in the Makefile. The operator is concurrent by nature — controller-runtime's caches and work queues, the Syncthing HTTPS API client/server, and the pod-log reader all use goroutines — so a data race can reach main and only manifest as a flaky or corrupted run in the field.

The suite is cheap enough that this is close to free: 14 suites / 656 specs currently finish in about 59 seconds with ginkgo -p.

Proposal

Add -race to the Go test invocation. Two options:

  1. Add -race to the existing Test-operator job (-race on make test, e.g. via TEST_ARGS), which roughly doubles the Go phase from ~1 min to ~2 min. Simplest; keeps a single gate.
  2. Add a separate parallel Test-operator-race job so the primary gate does not slow down, and mark the race job non-blocking until clean. Better if the existing job sits on the critical path of e2e-success.

Because envtest starts a real API server, -race also catches races between the test's direct client writes and the manager's cache — a class of flake that currently shows up as unexplained Unexpected error failures (e.g. the CreateOrUpdateDeleteOnImmutableErr and restic immutable-Job specs, which are version-sensitive today).

Acceptance criteria

  • CI runs the Go suite with -race.
  • A data race fails the build (blocking, once the suite is clean).
  • No change to e2e runtime or matrix.
  • Runtime cost documented in the workflow comment (~+1 min).

(AI generated)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions