Skip to content

test(e2e): verify tracebloc delete offboard teardown on a throwaway k3d cluster (#140) - #236

Merged
aptracebloc merged 1 commit into
developfrom
feat/140-e2e-delete-teardown
Jul 13, 2026
Merged

test(e2e): verify tracebloc delete offboard teardown on a throwaway k3d cluster (#140)#236
aptracebloc merged 1 commit into
developfrom
feat/140-e2e-delete-teardown

Conversation

@LukasWodka

@LukasWodkaLukasWodka commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

What

Closes#140. Adds real e2e coverage for tracebloc delete offboard teardown against a throwaway k3d cluster — today e2e.yml only exercises data ingest.

What it verifies (the rescoped acceptance)

An integration-tagged test (//go:build integration, test/integration/delete_e2e_test.go) + a new gated job in e2e.yml:

  • (a) credential REVOKED (POST /edge-device/…/revoke), not hard-deleted — a real HTTP round-trip asserts exactly one POST revoke.
  • (b) Helm release uninstalled.
  • (c) k3d cluster deleted (authoritative k3d cluster list post-check).
  • (d)~/.tracebloc wiped (via TRACEBLOC_CONFIG_DIR).
  • (e) the foreign-tbfix(cli): delete only removes tb when it is tracebloc's own alias #171 guard fires — a planted non-tracebloc tb survives and delete refuses to touch it.

Honesty / scope

  • Black-box and offline — no live backend contacted (egress via a dead proxy), does not touch the shared reference box. The live-backend revoke can't run in CI (the CLI has no base-URL override), so that piece is scoped honestly (binary runs against a dead endpoint) rather than silently skipped.
  • New job mirrors the existing ingest e2e job (same schedule / workflow_dispatch / e2e-label gating); //go:build integration keeps it out of the default-tag coverage run, so coverage floor is unaffected.

Nits (noted, not blocking)

  • (b) helm-uninstall is asserted via the CLI success line, not an authoritative post-run helm list (unlike (c), which is authoritative).
  • The create/install/delete path depends on NO_PROXY exempting the k3d API-server endpoint.

Closes#140.

🤖 Generated with Claude Code


Note

Low Risk
Test-only and workflow changes; no production CLI behavior modified. k3d e2e is env-gated to avoid clobbering local clusters.

Overview
Adds integration e2e coverage for tracebloc delete offboarding (#140): a new gated delete-teardown job in e2e.yml (same schedule / e2e label rules as the kind job) installs k3d and Helm, sets TB_E2E_K3D=1, and runs TestE2E_Delete|TestE2E_Revoke.

TestE2E_RevokeUsesPostNotDelete hits a recording HTTP stub and asserts RevokeClient sends exactly POST /edge-device/<id>/revoke/ and never DELETE.

TestE2E_DeleteTeardown (opt-in via env so dev tracebloc k3d clusters aren’t touched) builds the real CLI, stands up a throwaway k3d cluster named tracebloc, installs a minimal Helm release, seeds config via TRACEBLOC_CONFIG_DIR, and runs delete --yes --force offline (dead proxy for revoke; NO_PROXY for local k3d/helm). It checks Helm uninstall, cluster removal, config wipe, foreign tb (#171) left alone, best-effort revoke messaging, and self-removal of the binary.

Docs in test/integration/README.md describe scope and that live-backend revoke stays out of CI.

Reviewed by Cursor Bugbot for commit f567544. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds real e2e coverage of the top-level `tracebloc delete` offboard
(RFC-0001 §7.10), which CI's e2e.yml previously left untested (it only
exercised `data ingest`). New test/integration/delete_e2e_test.go:
- TestE2E_RevokeUsesPostNotDelete: a real HTTP round-trip against a
recording stub asserts acceptance (a) — the credential is REVOKED via
POST /edge-device/<id>/revoke/, never a hard DELETE of the row.
- TestE2E_DeleteTeardown: builds the real binary and runs
`tracebloc delete --yes --force` black-box against a throwaway k3d
cluster with a real Helm release, asserting (b) the release is
uninstalled, (c) the k3d cluster is deleted, (d) ~/.tracebloc is wiped,
and (e) the foreign-`tb` guard (#171) leaves a `tb` it didn't create in
place. Opt-in via TB_E2E_K3D=1 and refuses a pre-existing `tracebloc`
cluster, so it never clobbers a dev machine.
The black-box run is kept fully offline (egress through a dead proxy) so
the revoke takes its documented best-effort transport-failure path while
the local teardown runs for real; the POST-not-DELETE contract a live
backend enforces is covered by the stub test. Revoke against a live
backend is left to the pre-prod FR (CI can't provide one — no base-URL
override on the CLI).
Wires a new `delete-teardown` job (k3d + helm) into e2e.yml, mirroring
the ingest e2e job's nightly/dispatch/`e2e`-label gating.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@aptracebloc
aptracebloc merged commit 78ed06d into developJul 13, 2026
21 checks passed
@aptracebloc
aptracebloc deleted the feat/140-e2e-delete-teardown branch July 13, 2026 09:19
Sign up for freeto 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.

3 participants

@LukasWodka@aptracebloc@saadqbal