Skip to content

test: BATS coverage for dream-cli robustness (compose wrapper + set -u/pipefail guards) #438

@yasinBursali

Description

@yasinBursali

test: BATS coverage for dream-cli robustness (compose wrapper + set -u/pipefail guards)

Consolidated from: #406 + #410

Scope

Add BATS coverage that pins:

Coverage matrix

#406 — compose wrapper:

  • Success path: compose exits 0 → " — done" message, temp log removed, function returns 0.
  • Failure path with matching keywords: error banner emitted, relevant lines extracted, log path printed, function returns compose exit code.
  • Failure path with zero grep matches: || warn "..." fires, log path still printed, function returns compose exit code (not grep's 1).
  • Caller usage (dream restart/stop/start) propagates the wrapper's exit correctly.

#410 — set -u + pipefail guards:

  • Top of dream-cli has set -euo pipefail.
  • Running dream-cli with minimal env (env -i HOME=/tmp PATH=/usr/bin:/bin) doesn't crash on unbound variables.
  • All conditional vars accessed via ${FOO:-default} form (static grep assertion).
  • sed -n '1p' replacements for | head -1 still in place (BSD SIGPIPE-safe).

Files

  • New: dream-server/tests/bats-tests/test-compose-summary-wrapper.bats
  • New: dream-server/tests/bats-tests/test-dream-cli-flags.bats

Rationale for merge

#410's body explicitly states "naturally bundles with #406." Both are BATS, both target dream-cli internals, small combined PR. If either test regresses in CI both indicate distinct concerns (compose wrapper robustness vs. shell flag hygiene) — no hidden failures.

Discovery context

Filed during 23APR audit/fix cycle. PR-7 added pipefail; PR-11 enabled set -u + nounset guards; PR-10 introduced the compose summary wrapper (and round-2 fixup replaced || true with || warn). All live in 23APRdevelopments.

Closes #406, #410. Labels: test, bash

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions