diff --git a/tests/disinto-init-nomad.bats b/tests/disinto-init-nomad.bats index 75bb884..b5d862e 100644 --- a/tests/disinto-init-nomad.bats +++ b/tests/disinto-init-nomad.bats @@ -1,17 +1,17 @@ #!/usr/bin/env bats # ============================================================================= -# tests/disinto-init-nomad.bats — Regression guard for `disinto init` +# tests/disinto-init-nomad.bats - Regression guard for `disinto init` # backend dispatch (S0.5, issue #825). # # Exercises the three CLI paths the Nomad+Vault migration cares about: -# 1. --backend=nomad --dry-run → cluster-up step list -# 2. --backend=nomad --empty --dry-run → same, with "--empty" banner -# 3. --backend=docker --dry-run → docker path unaffected +# 1. --backend=nomad --dry-run -> cluster-up step list +# 2. --backend=nomad --empty --dry-run -> same, with "--empty" banner +# 3. --backend=docker --dry-run -> docker path unaffected # # A throw-away `placeholder/repo` slug satisfies the CLI's positional-arg # requirement (the nomad dispatcher never touches it). --dry-run on both # backends short-circuits before any network/filesystem mutation, so the -# suite is hermetic — no Forgejo, no sudo, no real cluster. +# suite is hermetic - no Forgejo, no sudo, no real cluster. # ============================================================================= setup_file() { @@ -24,7 +24,7 @@ setup_file() { } } -# ── --backend=nomad --dry-run ──────────────────────────────────────────────── +# -- --backend=nomad --dry-run ------------------------------------------------ @test "disinto init --backend=nomad --dry-run exits 0 and prints the step list" { run "$DISINTO_BIN" init placeholder/repo --backend=nomad --dry-run @@ -41,19 +41,19 @@ setup_file() { [[ "$output" == *"[dry-run] Step 5/9: install /etc/nomad.d/server.hcl + client.hcl from repo"* ]] [[ "$output" == *"[dry-run] Step 6/9: first-run vault init + persist unseal.key + root.token"* ]] [[ "$output" == *"[dry-run] Step 7/9: systemctl start vault + poll until unsealed"* ]] - [[ "$output" == *"[dry-run] Step 8/9: systemctl start nomad + poll until ≥1 node ready"* ]] + [[ "$output" == *"[dry-run] Step 8/9: systemctl start nomad + poll until >=1 node ready"* ]] [[ "$output" == *"[dry-run] Step 9/9: write /etc/profile.d/disinto-nomad.sh"* ]] [[ "$output" == *"Dry run complete - no changes made."* ]] } -# ── --backend=nomad --empty --dry-run ──────────────────────────────────────── +# -- --backend=nomad --empty --dry-run ---------------------------------------- @test "disinto init --backend=nomad --empty --dry-run prints the --empty banner + step list" { run "$DISINTO_BIN" init placeholder/repo --backend=nomad --empty --dry-run [ "$status" -eq 0 ] - # --empty changes the dispatcher banner but not the step list — Step 1 + # --empty changes the dispatcher banner but not the step list - Step 1 # of the migration will branch on $empty to gate job deployment; today # both modes invoke the same cluster-up dry-run. [[ "$output" == *"nomad backend: --empty (cluster-up only, no jobs)"* ]] @@ -61,7 +61,7 @@ setup_file() { [[ "$output" == *"Dry run complete - no changes made."* ]] } -# ── --backend=docker (regression guard) ────────────────────────────────────── +# -- --backend=docker (regression guard) -------------------------------------- @test "disinto init --backend=docker does NOT dispatch to the nomad path" { run "$DISINTO_BIN" init placeholder/repo --backend=docker --dry-run @@ -71,14 +71,14 @@ setup_file() { [[ "$output" != *"nomad backend:"* ]] [[ "$output" != *"[dry-run] Step 1/9: install nomad + vault binaries + docker daemon"* ]] - # Positive assertion: docker-path output still appears — the existing + # Positive assertion: docker-path output still appears - the existing # docker dry-run printed "=== disinto init ===" before listing the # intended forge/compose actions. [[ "$output" == *"=== disinto init ==="* ]] - [[ "$output" == *"── Dry-run: intended actions ────"* ]] + [[ "$output" == *"-- Dry-run: intended actions ----"* ]] } -# ── Flag syntax: --flag=value vs --flag value ──────────────────────────────── +# -- Flag syntax: --flag=value vs --flag value -------------------------------- # Both forms must work. The bin/disinto flag loop has separate cases for # `--backend value` and `--backend=value`; a regression in either would @@ -91,7 +91,7 @@ setup_file() { [[ "$output" == *"[dry-run] Step 1/9: install nomad + vault binaries + docker daemon"* ]] } -# ── Flag validation ────────────────────────────────────────────────────────── +# -- Flag validation ---------------------------------------------------------- @test "--backend=bogus is rejected with a clear error" { run "$DISINTO_BIN" init placeholder/repo --backend=bogus --dry-run @@ -105,11 +105,11 @@ setup_file() { [[ "$output" == *"--empty is only valid with --backend=nomad"* ]] } -# ── Positional vs flag-first invocation (#835) ─────────────────────────────── +# -- Positional vs flag-first invocation (#835) ------------------------------- # # Before the #835 fix, disinto_init eagerly consumed $1 as repo_url *before* # argparse ran. That swallowed `--backend=nomad` as a repo_url and then -# complained that `--empty` required a nomad backend — the nonsense error +# complained that `--empty` required a nomad backend - the nonsense error # flagged during S0.1 end-to-end verification. The cases below pin the CLI # to the post-fix contract: the nomad path accepts flag-first invocation, # the docker path still errors helpfully on a missing repo_url. @@ -119,7 +119,7 @@ setup_file() { [ "$status" -eq 0 ] [[ "$output" == *"nomad backend: --empty (cluster-up only, no jobs)"* ]] [[ "$output" == *"[dry-run] Step 1/9: install nomad + vault binaries + docker daemon"* ]] - # The bug symptom must be absent — backend was misdetected as docker + # The bug symptom must be absent - backend was misdetected as docker # when --backend=nomad got swallowed as repo_url. [[ "$output" != *"--empty is only valid with --backend=nomad"* ]] } @@ -144,7 +144,7 @@ setup_file() { [[ "$output" != *"Unknown option"* ]] } -# ── --with flag tests ───────────────────────────────────────────────────────── +# -- --with flag tests --------------------------------------------------------- @test "disinto init --backend=nomad --with forgejo --dry-run prints deploy plan" { run "$DISINTO_BIN" init placeholder/repo --backend=nomad --with forgejo --dry-run @@ -192,7 +192,7 @@ setup_file() { [[ "$output" == *"--empty and --with are mutually exclusive"* ]] } -# ── Import flag validation ──────────────────────────────────────────────────── +# -- Import flag validation ---------------------------------------------------- @test "disinto init --backend=nomad --import-env only is accepted" { run "$DISINTO_BIN" init placeholder/repo --backend=nomad --import-env /tmp/.env --dry-run