Skip to content

Expand the pithead bash test suite: backup/restore round-trip + doctor/upgrade/generate_caddyfile #140

@VijitSingh97

Description

@VijitSingh97

Summary

tests/stack/run.sh covers many helpers and the apply/status flows, but several data-safety / security-relevant paths are untested.

Gaps

  • backup/restore round-trip (stack_backup, stack_restore) — untested. These touch irreplaceable state (onion keys, dashboard history DB) and have fiddly logic: leading-/ strip/restore, the disk pre-check arithmetic, and the stop→backup→start sequencing. All shell out only to tar/df/du/docker/sudo — stubbable with the existing make_stubs pattern. A round-trip test (backup a fixture tree → restore into a clean sandbox → assert layout) needs no real nodes. (Would also have caught the backup errexit bug in pithead robustness: 'backup' aborts on a non-fatal du/df error; 'doctor' always exits 0 even on FAIL #127.)
  • generate_caddyfile — untested; it decides HTTPS-vs-HTTP (a security-relevant branch). Trivially unit-testable: assert the rendered Caddyfile contains tls internal when DASHBOARD_SECURE=true.
  • stack_upgrade — untested; a docker-stub assertion that it runs compose up -d --build (mirrors the existing apply "compose up called" assertion).
  • doctor — no black-box test of the dr_ok/dr_warn/dr_fail tally + exit code (see pithead robustness: 'backup' aborts on a non-fatal du/df error; 'doctor' always exits 0 even on FAIL #127). Plus pure helpers detect_host_timezone, detect_os, deps_satisfied, resolve_dashboard_host are untested.

Acceptance

  • backup→restore round-trip test (stubbed) asserting archive layout + restore placement, incl. the low-space branch.
  • generate_caddyfile secure/insecure branch tests.
  • stack_upgrade + doctor black-box tests.

Related

Distinct from #54 (real-server e2e) — all sandboxed/unit. Supports #127.

Metadata

Metadata

Assignees

No one assigned

    Labels

    testingTests, CI, and test infrastructurewave-5-ci-testsv1.0 Wave 5: CI & test hardening (de-risk the release)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions