test: add comprehensive test suite for dream-doctor.sh#373
test: add comprehensive test suite for dream-doctor.sh#373Lightheartdevs merged 2 commits intoLight-Heart-Labs:mainfrom
Conversation
Lightheartdevs
left a comment
There was a problem hiding this comment.
Review: test suite for dream-doctor.sh
Bug: Test 10 always passes
if [[ -x "$ROOT_DIR/scripts/dream-doctor.sh" ]] || true; thenThe || true makes this unconditionally pass — dead test. Direct CLAUDE.md violation (rule 4: never || true). Remove it or drop the test (tests 1 and 3 already prove runnability).
CLAUDE.md violation: 2>/dev/null
Lines 96, 103, 117, 127, 138, 149 — multiple jq calls suppress stderr. CLAUDE.md rule 4 prohibits this. The set +e / conditional pattern already handles non-zero exits. Let jq errors surface.
Tests are structural, not behavioral
All 11 tests are JSON schema checks (field exists, field is boolean, valid JSON). None test actual doctor behavior — does it detect missing Docker? Does autofix_hints populate? The suite would pass if doctor logic were completely wrong as long as JSON shape is correct. Add 2-3 behavioral tests with environment mocking.
CI conflict with PR #376
Both PRs add a step to .github/workflows/test-linux.yml at the same insertion point. Whichever merges second hits a merge conflict.
|
What's needed to get this merged:
|
|
I addressed review feedback for dream-doctor test suite |
Lightheartdevs
left a comment
There was a problem hiding this comment.
Approve — Good test coverage.
Adds 11-test suite for dream-doctor.sh covering script existence, help flag, JSON output validity, key field presence (system, gpu, disk, docker, services), macOS compatibility, and CI integration.
+218, 2 files. Tests follow the project's established pattern (pass/fail/skip with color output, behavioral tests). Integrated into CI via test-linux.yml. LGTM.
Lightheartdevs
left a comment
There was a problem hiding this comment.
Installer-stability audit: SAFE
Zero installer-path files touched. The new test (tests/test-dream-doctor.sh) and CI workflow change (.github/workflows/test-linux.yml) are test/CI infrastructure only — never invoked during installation.
dream-doctor.sh itself is a post-install diagnostic tool, only optionally called at the tail end of macOS installs with || true (non-blocking). It is not in the critical install path for any platform.
The test is written defensively: set +e around doctor invocation, accepts exit 0 or 1, skips jq-dependent checks if jq is absent, temp files cleaned via trap. Good coverage of JSON output structure and behavioral tests.
The second commit addressed the substantive feedback from the first review (removing || true, adding behavioral tests). Solid work.
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
Summary
dream-doctor.shdiagnostic tooltests/test-dream-doctor.shwith 11 test cases covering all critical functionality.github/workflows/test-linux.ymlMotivation
dream-doctor.shis a critical diagnostic tool (207 lines) that:doctor.json,macos-doctor.json)This PR closes the testing gap by following the same pattern as
test-health-check.sh.Test Coverage
The new test suite validates:
--helpflag displays usage informationjq)version,generated_at,autofix_hints,capability_profile,preflight,runtime,summary)autofix_hintsis an arrayruntimesection has correct boolean fields (docker_cli,docker_daemon,compose_cli,dashboard_http,webui_http)summarysection has correct numeric fields (preflight_blockers,preflight_warnings)Test Results
CI Integration
Added test step to
.github/workflows/test-linux.ymlbetween "Health Check Tests" and "Validate Env Tests" to ensure dream-doctor is validated on every PR and push to main.Impact