test: cross-repo fresh-shell last-mile E2E harness (install -> CLI -> cluster info -> push)#214
Draft
LukasWodka wants to merge 1 commit into
Draft
test: cross-repo fresh-shell last-mile E2E harness (install -> CLI -> cluster info -> push)#214LukasWodka wants to merge 1 commit into
LukasWodka wants to merge 1 commit into
Conversation
Contributor
Author
|
👋 Heads-up — Code review queue is at 17 / 8 Above the WIP limit. The team convention is to review existing PRs before opening new work. Open PRs currently in Code review (oldest first):
Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.) |
Adds the two-leg install-journey harness that closes the gap which let a PATH-persistence regression ship green: no existing test opens a fresh shell after install and asserts the documented next command works. Leg 1 — scripts/tests/path-persist.sh: runs in a plain distro container, installs the tracebloc CLI via cli/install.sh (configurable ref via TRACEBLOC_CLI_REF), then for each shell among bash/zsh/fish spawns a fresh login AND non-login shell and asserts `command -v tracebloc` resolves and `tracebloc version` runs. A fresh non-login bash reads ~/.bashrc (not ~/.profile), so this catches the whole PATH-persistence class — red on the pre-fix installer, green on the fixed one. Leg 2 — scripts/tests/e2e-journey.sh: extends the e2e-cluster pattern. Brings the cluster up via create_cluster(), installs the CLI, applies a credential-free stub matching the CLI's real discovery contract (a *-jobs-manager Deployment with the chart's hallmark labels + an `ingestor` ServiceAccount), points the kubeconfig context's namespace at it, and asserts `tracebloc cluster info` succeeds AND resolves from a fresh shell, then `dataset push --dry-run` on a tiny sample CSV. Long steps run under a watchdog timeout so a hang fails instead of spinning. The context-on-default namespace auto-discover sub-assertion is gated pending the CLI change. CI: new path-persist job (distro matrix, like distro-prereqs, fail-fast false) and e2e-journey job (amd64, nightly + `e2e` label only, mirroring cli's e2e.yml gating). Both new scripts added to the static shellcheck list. Part of #737. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
7274175 to
3fa1a8f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #737
Summary
Adds the two-leg install-journey harness that closes the gap which let a PATH-persistence regression ship green: no existing test opens a fresh shell after install and asserts the documented next command works.
distro-prereqsande2e-clusterboth assert in the same shell that ran the installer, so a binary that lands somewhere a new terminal can't see is invisible to them. This harness reproduces "customer opens a new terminal and types the next command."Related
fix/install-path-persistbranchinstall.shfor pre-merge cross-repo coverageWhat's in here
Leg 1 —
scripts/tests/path-persist.sh(cheap, wide, no cluster, no creds)Runs in a plain distro container. Installs the tracebloc CLI via cli's
install.sh(ref configurable viaTRACEBLOC_CLI_REF— URL or local path), then for each shell present among bash / zsh / fish spawns a fresh login AND non-login shell and assertscommand -v traceblocresolves andtracebloc versionruns. A fresh non-login bash reads~/.bashrc, not~/.profile/~/.bash_profile— so this is the cell that goes red on the pre-fix installer and green on the fixed one. Prints a PASS/FAIL line per shell x mode cell.Leg 2 —
scripts/tests/e2e-journey.sh(full journey on a real cluster, amd64, no secrets)Extends the
e2e-cluster.shpattern (sourcescommon.sh/setup-linux.sh/cluster.sh, isolatedCLUSTER_NAME,TRACEBLOC_NO_AUTOSTART=1):create_cluster()+ wait nodes Ready.install.sh.internal/cluster/discover.go): a*-jobs-managerDeployment carryingapp.kubernetes.io/name=client+app.kubernetes.io/managed-by=Helm+ instance/version/chart labels (imageregistry.k8s.io/pause:3.9), plus aningestorServiceAccount (so thecluster infoTokenRequest path doesn't exit 5). Point the kubeconfig context's namespace at it and asserttracebloc cluster info(a) succeeds and (b) succeeds from a fresh login + non-login shell.tracebloc dataset push --dry-runsmoke on a tiny sample CSV (offline-validatable; no creds).Every long step runs under a watchdog timeout so a hang FAILS (exit 124 -> hard error) instead of spinning to the GitHub ceiling.
Note on the stub labels: the issue's shorthand says
app: manager; the CLI actually discovers onapp.kubernetes.io/name=client,app.kubernetes.io/managed-by=Helm+ a*-jobs-managerDeployment name. The manifest uses the real selector so the assertion exercises the actual code path, and keepsapp: manageras a cosmetic extra label. Documented inline.Note on context-on-
default: client#208 (installer sets the kube context) is merged, so the supported state is context-namespace == workspace namespace — that's the core assertion. The opposite case (context left ondefault, CLI auto-discovers across namespaces) needs a CLI change that is not merged yet, so it runs as a non-fatal pending probe, flippable to a hard assertion viaTB_EXPECT_NS_AUTODISCOVER=1once that lands.CI (
.github/workflows/installer-tests.yaml)path-persist—distromatrix (ubuntu:22.04/24.04,debian:12,fedora:latest,almalinux:9,opensuse/leap:15.6,alpine:3),fail-fast: false, one fresh container per distro; the script iterates shell x mode inside. Runs on the samescripts/**paths as the rest of the file.e2e-journey— amd64, gated to nightly schedule + workflow_dispatch + thee2ePR label (mirrors cli'se2e.ymllabel gating), to control cluster cost.staticjob's shellcheck list (error + advisory passes).Type of change
Test plan — Verified locally / Needs CI
Verified locally (green):
bash -nonpath-persist.shande2e-journey.sh— both parse.shellcheck --severity=error(the CI gate) on both new scripts — no findings;--severity=warningadvisory pass — also clean.actionlintoninstaller-tests.yaml— clean (also runs shellcheck on the inline run blocks).yaml.safe_loadon the workflow — parses.command -voutput, check non-empty + version exit code): positive case resolves a real on-PATH binary, negative control (PATH stripped) correctly yields empty -> the guard would fail. Confirms the assert logic.Needs CI (requires GitHub runners / Docker — NOT run locally, not claimed to pass):
path-persistdistro x shell x mode matrix (needs per-distro containers + zsh/fish install).e2e-journeyend to end (needs a real k3d cluster on a Linux runner with Docker, plus a reachable cliinstall.sh).The default
TRACEBLOC_CLI_REFcurrently points at cli'sfix/install-path-persistrawinstall.sh(with an inlineTODO(cli#61)to switch toreleases/latest/download/install.shonce the fix ships in a public release — otherwise the guard would test the old installer from the latest release and report a false red).Checklist