🧪 Add tests for idstack-status#54
Conversation
Added `test/test-status.sh` to thoroughly test `idstack-status` against various states, including missing setups, mock timeline generation, learning logs, and exports. Also moved tests out of `integration-test.sh` and hooked `test-status.sh` inside `smoke-test.sh` for reliable regression checking. Co-authored-by: savvides <1580637+savvides@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Code Review
This pull request migrates the integration tests for idstack-status from test/integration-test.sh into a dedicated unit test suite in test/test-status.sh, which is now executed during the smoke test. The feedback recommends wrapping the $STATUS executable in a helper function to avoid word-splitting issues when paths contain spaces, and capturing assertion output to a log file to improve debuggability upon test failures.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" | ||
| STATUS="$REPO_ROOT/bin/idstack-status" |
There was a problem hiding this comment.
If the repository path contains spaces or special characters (e.g., in CI environments or user directories), executing $STATUS directly inside eval will fail due to word splitting.
To prevent this, define a helper function status that safely wraps the executable with proper double-quoting, and use status instead of $STATUS in the assert calls.
| REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" | |
| STATUS="$REPO_ROOT/bin/idstack-status" | |
| REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" | |
| STATUS="$REPO_ROOT/bin/idstack-status" | |
| status() { | |
| "$STATUS" "$@" | |
| } |
| assert() { | ||
| TOTAL=$((TOTAL + 1)) | ||
| if eval "$2" >/dev/null 2>&1; then | ||
| PASS=$((PASS + 1)) | ||
| echo " PASS: $1" | ||
| else | ||
| FAIL=$((FAIL + 1)) | ||
| echo " FAIL: $1" | ||
| fi | ||
| } |
There was a problem hiding this comment.
When an assertion fails, the standard output and error are redirected to /dev/null, making it extremely difficult to debug test failures.
Consider capturing the output of the command to a temporary log file and printing it when the assertion fails to provide helpful diagnostic information.
| assert() { | |
| TOTAL=$((TOTAL + 1)) | |
| if eval "$2" >/dev/null 2>&1; then | |
| PASS=$((PASS + 1)) | |
| echo " PASS: $1" | |
| else | |
| FAIL=$((FAIL + 1)) | |
| echo " FAIL: $1" | |
| fi | |
| } | |
| assert() { | |
| TOTAL=$((TOTAL + 1)) | |
| local logfile="${WORK:-/tmp}/assert.log" | |
| if eval "$2" >"$logfile" 2>&1; then | |
| PASS=$((PASS + 1)) | |
| echo " PASS: $1" | |
| else | |
| FAIL=$((FAIL + 1)) | |
| echo " FAIL: $1" | |
| if [ -s "$logfile" ]; then | |
| echo " --- Output ---" | |
| sed 's/^/ /' "$logfile" | |
| echo " --------------" | |
| fi | |
| fi | |
| rm -f "$logfile" | |
| } |
🎯 What: The testing gap addressed
The
idstack-statuscommand lacked comprehensive and isolated unit tests. The previous tests inintegration-test.shwere sparse and didn't cover key functionality such as mock configurations or readiness flags.📊 Coverage: What scenarios are now tested
.idstackdirectory scenario.project.json.INCOMPLETE,NOT-READY, andREADY TO EXPORTconditions with the--readinessflag based on metric threshold logic.✨ Result: The improvement in test coverage
test-status.shisolated unit tests were created, old tests moved out, and added to the suite insmoke-test.sh. Tests successfully run and ensure proper functional checks foridstack-status.PR created automatically by Jules for task 16130625847682278631 started by @savvides