Found in review of #66: the TestLive* tests run against the user's live Rex server whenever rex is on PATH #69

Merged
city-root merged 1 commit from worker/rexcity-nxb62 into main 2026-11-12 10:19:20 +00:00
Contributor

The TestLive* tests in internal/rex now run only when REXCITY_LIVE_TESTS is set, whatever rex is on PATH. Before, any rex that answered rex --autostart=false whoami made them run against the user's own Rex server and create and kill rexcity-test-* sessions there.

Changes:

  • internal/rex/rex_test.go: liveClient skips unless REXCITY_LIVE_TESTS is set. It still skips when no server answers.
  • README.md, Development section: how to ask for them, REXCITY_LIVE_TESTS=1 go test ./internal/rex.
  • No CHANGELOG entry: REVIEW.md says a change to tests or docs alone carries none.

Verified without reaching the real Rex server, using stub rex binaries first on PATH:

  • A stub that answers every call and logs it: the default run skipped all four TestLive* tests and the stub saw no call.
  • A stub that exits non-zero: the package passes.
  • REXCITY_LIVE_TESTS=1 with the answering stub: TestLiveClients ran and the stub logged its calls.

Bead: rexcity-nxb62

The TestLive* tests in internal/rex now run only when REXCITY_LIVE_TESTS is set, whatever rex is on PATH. Before, any rex that answered `rex --autostart=false whoami` made them run against the user's own Rex server and create and kill rexcity-test-* sessions there. Changes: - internal/rex/rex_test.go: liveClient skips unless REXCITY_LIVE_TESTS is set. It still skips when no server answers. - README.md, Development section: how to ask for them, `REXCITY_LIVE_TESTS=1 go test ./internal/rex`. - No CHANGELOG entry: REVIEW.md says a change to tests or docs alone carries none. Verified without reaching the real Rex server, using stub `rex` binaries first on PATH: - A stub that answers every call and logs it: the default run skipped all four TestLive* tests and the stub saw no call. - A stub that exits non-zero: the package passes. - REXCITY_LIVE_TESTS=1 with the answering stub: TestLiveClients ran and the stub logged its calls. Bead: rexcity-nxb62
test: TestLive* run only when asked for with REXCITY_LIVE_TESTS (rexcity-nxb62)
All checks were successful
test / changelog (pull_request) Successful in 4s
image / image (pull_request) Successful in 9s
test / go (pull_request) Successful in 1m44s
96179fe57e
The TestLive* tests in internal/rex ran whenever a rex that answered
'rex --autostart=false whoami' was on PATH. On a development machine, or a
city's Mac, that rex selects the user's own Rex server, so a plain
'go test ./...' created and killed rexcity-test-* sessions on it. Removing the
REX_* variables did not isolate them: a reviewer's run did exactly that and the
tests still reached the user's server.

liveClient now skips unless REXCITY_LIVE_TESTS is set, whatever is on PATH, and
keeps its skip when no server answers. The README's Development section says how
to ask for them: REXCITY_LIVE_TESTS=1 go test ./internal/rex.

Validation: with a fake rex that answers every call and logs it first on PATH,
the default run skipped all four TestLive* tests and the stub saw no call; with
a fake rex that exits non-zero the package passes; with REXCITY_LIVE_TESTS=1
and the answering stub, TestLiveClients ran and the stub saw its calls. The real
Rex server was not reached in any run.

No CHANGELOG entry: REVIEW.md says a change to tests or docs alone carries none.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
city-root-review left a comment

Reviewed 96179fe merged into main 5faf322: TestLive* gated on REXCITY_LIVE_TESTS; vet, test and changelog check pass with a stub rex.

Reviewed 96179fe merged into main 5faf322: TestLive* gated on REXCITY_LIVE_TESTS; vet, test and changelog check pass with a stub rex.
Author
Contributor

Reviewed 96179fe, merged into main at 5faf322 (after #76 and #77). The merge was clean.

What I checked:

  • The diff touches only internal/rex/rex_test.go and README.md. liveClient now skips unless REXCITY_LIVE_TESTS is set, before it runs rex. The four TestLive* tests (SessionLifecycle, Windows, Panes, Clients) all go through it.
  • I looked across the repository for other tests that could reach a Rex server. internal/rpp uses the in-memory fakeRex. The other rex tests in internal/rex use a script in a temp dir. TestFault never runs the binary. Nothing else runs rex, dials its socket or reads REX_SERVER.
  • No workflow, Makefile or Dockerfile sets REXCITY_LIVE_TESTS. CI's ubuntu runner has no rex, so these tests always skipped in CI. CI loses no coverage.
  • On the merge result, with the REX/GC/REXCITY/BEADS/BD variables removed (0 left) and a rex stub that exits non-zero first on PATH: go vet ./... passed for the host, darwin/arm64 and linux/amd64, go test ./... passed, and the changelog check (mikluko/changelog v1.6.0, built from the tag) passed.
  • I then put a stub rex first on PATH that records its calls and exits 0. go test ./... on the merge result passed and the stub recorded 0 calls. The same stub on the base, main, recorded 8 calls (whoami, session new rexcity-test-...), so the gate works.
  • The README's Development section says how to ask for the live tests: REXCITY_LIVE_TESTS=1 go test ./internal/rex. The test file says it too.
  • No CHANGELOG entry. That is right: REVIEW.md says a change to tests alone carries none.
  • No shell added.

Minor, no change needed now: any non-empty value turns the live tests on, so REXCITY_LIVE_TESTS=0 turns them on too.

Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.

Reviewed 96179fe, merged into main at 5faf322 (after #76 and #77). The merge was clean. What I checked: - The diff touches only `internal/rex/rex_test.go` and `README.md`. `liveClient` now skips unless `REXCITY_LIVE_TESTS` is set, before it runs `rex`. The four `TestLive*` tests (SessionLifecycle, Windows, Panes, Clients) all go through it. - I looked across the repository for other tests that could reach a Rex server. `internal/rpp` uses the in-memory `fakeRex`. The other `rex` tests in `internal/rex` use a script in a temp dir. `TestFault` never runs the binary. Nothing else runs `rex`, dials its socket or reads `REX_SERVER`. - No workflow, Makefile or Dockerfile sets `REXCITY_LIVE_TESTS`. CI's ubuntu runner has no `rex`, so these tests always skipped in CI. CI loses no coverage. - On the merge result, with the REX/GC/REXCITY/BEADS/BD variables removed (0 left) and a `rex` stub that exits non-zero first on PATH: `go vet ./...` passed for the host, darwin/arm64 and linux/amd64, `go test ./...` passed, and the changelog check (mikluko/changelog v1.6.0, built from the tag) passed. - I then put a stub `rex` first on PATH that records its calls and exits 0. `go test ./...` on the merge result passed and the stub recorded 0 calls. The same stub on the base, main, recorded 8 calls (`whoami`, `session new rexcity-test-...`), so the gate works. - The README's Development section says how to ask for the live tests: `REXCITY_LIVE_TESTS=1 go test ./internal/rex`. The test file says it too. - No CHANGELOG entry. That is right: REVIEW.md says a change to tests alone carries none. - No shell added. Minor, no change needed now: any non-empty value turns the live tests on, so `REXCITY_LIVE_TESTS=0` turns them on too. Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/rexcity!69
No description provided.