Skip to content

test: make the REST and e2e harnesses reliable off the project's own stands - #199

Draft
Andrei Kvapil (kvaps) wants to merge 3 commits into
mainfrom
test/rest-harness
Draft

Andrei Kvapil (kvaps) wants to merge 3 commits into
mainfrom
test/rest-harness

Conversation

@kvaps

Copy link
Copy Markdown
Member

Three test-harness fixes split out of #190, independent of it.

  • The REST test server is ready when its own OnReady fires, not when a dial succeeds. pickFreeAddr releases its probe port before Start binds, so a parallel test could take it: the readiness dial then reached that test's server, and the handler under test answered 404 from a store that never held the fixture. A bind that loses the race is retried on a fresh port.
  • The e2e lib and the replay runner find the nodes that run a satellite through the satellite DaemonSet when the control-plane selector returns nothing, as it does on a three-control-plane Cozystack cluster.
  • BS_WORKERS and BS_SP let a stand override the replay's node list and pool name.

It does not fix the separate server did not stop within 2s after cancel flake in pkg/rest, which comes from how startServerWithStore stops the server.

…abel

Worker discovery asked "which nodes are not control-plane", and every
cell then used the answer as "which nodes run a satellite". Those are
the same set on the project's own stands and not elsewhere: a Cozystack
cluster of three control-plane nodes runs satellites on all three and
has no node without the label, so the selector returned nothing,
WORKER_1..3 came back empty and require_workers skipped every scenario
as unexercisable. A stand where nothing can be exercised is
indistinguishable from a stand where everything passes.

The satellite DaemonSet is the authority on the question actually being
asked, so it answers when the label selector cannot: one extra call,
and only on the clusters where the first answer was empty.
require_workers counts Ready off that same set rather than re-running
the selector. BS_WORKERS overrides both, for a stand whose shape
neither rule fits.

The worker-count expansion is guarded for bash older than 4.4, which
treats "${empty[@]}" as unbound under `set -u` and would turn "this
cluster has no satellites" into a crash inside the preflight whose job
is to report it.

Verified against a three-control-plane Cozystack cluster: discovery
returns all three nodes and the preflight passes where it previously
skipped.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
pickFreeAddr closes its probe listener before Start binds, so a
parallel test can take the port in between. The readiness dial then
reached that test's server, this one had already failed to bind, and
every request was answered by a store that never held the fixture,
which surfaced as a 404 from the handler under test. The harness now
waits for the server's OnReady and retries a bind that lost the race
on a fresh port.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The runner discovered nodes the way the cli-matrix lib did, as "not a
control-plane node", so on a Cozystack cluster of three control-plane
nodes it found none and skipped every workflow. The satellite
DaemonSet answers when the label selector cannot, and BS_WORKERS
overrides both.

The pool name is a property of the stand, not of the workflow: the
project's stands call it `stand`, a Cozystack cluster calls it
whatever its LinstorCluster declares. BS_SP overrides it, which is the
difference between a harness and a fixture.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant