Skip to content

🧪 Add comprehensive tests for idstack-migrate#53

Open
savvides wants to merge 1 commit into
mainfrom
improve-migrate-tests-14472023552349704849
Open

🧪 Add comprehensive tests for idstack-migrate#53
savvides wants to merge 1 commit into
mainfrom
improve-migrate-tests-14472023552349704849

Conversation

@savvides

@savvides savvides commented Jun 6, 2026

Copy link
Copy Markdown
Owner

🎯 What: The testing gap addressed
Created dedicated unit tests for the idstack-migrate bin script. Previously, these were just a block of inline checks inside smoke-test.sh. The new test suite properly tests failure conditions and edge cases rather than only the happy paths.

📊 Coverage: What scenarios are now tested

  • Forward migrations from schemas 1.0, 1.2, and 1.3-drifted to 1.4
  • Missing manifest files
  • Malformed manifest files / gracefully degrading to raw output

Result: The improvement in test coverage
The code is now more robustly tested with 12 distinct assertions specifically targeting the migration logic, making the smoke-test.sh script more maintainable and increasing confidence in schema changes.


PR created automatically by Jules for task 14472023552349704849 started by @savvides

Moved inline migration tests from smoke-test.sh to a dedicated
test-migrate.sh script. Added new coverage for missing manifests and malformed
json inputs.

Co-authored-by: savvides <1580637+savvides@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the migration tests by moving them from test/smoke-test.sh into a dedicated unit test script test/test-migrate.sh. The feedback highlights potential issues in test/test-migrate.sh where the script might exit prematurely under set -e when testing failure scenarios, and suggests safely capturing exit codes. Additionally, it is recommended to run the migration tests directly in test/smoke-test.sh rather than conditionally checking for the script's existence, to avoid silently skipping tests if the file is missing or not executable.

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.

Comment thread test/test-migrate.sh
Comment on lines +70 to +72
"$MIGRATE" "$WORK/project.json" >/dev/null 2>&1
EC=$?
assert "missing manifest exits 0" "[ $EC -eq 0 ]"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Under set -e, if the $MIGRATE command fails, the script will immediately terminate at line 70 instead of continuing to the assertion. To safely capture the exit code without triggering set -e on failure, initialize EC and use the || operator.

Suggested change
"$MIGRATE" "$WORK/project.json" >/dev/null 2>&1
EC=$?
assert "missing manifest exits 0" "[ $EC -eq 0 ]"
EC=0
"$MIGRATE" "$WORK/project.json" >/dev/null 2>&1 || EC=$?
assert "missing manifest exits 0" "[ $EC -eq 0 ]"

Comment thread test/test-migrate.sh
Comment on lines +77 to +79
OUT=$("$MIGRATE" "$WORK/project.json" 2>/dev/null)
EC=$?
assert "malformed manifest exits 0" "[ $EC -eq 0 ]"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If $MIGRATE fails here, the command substitution inside the variable assignment will trigger set -e and terminate the script immediately. Initialize EC and use || to safely capture the exit code.

Suggested change
OUT=$("$MIGRATE" "$WORK/project.json" 2>/dev/null)
EC=$?
assert "malformed manifest exits 0" "[ $EC -eq 0 ]"
EC=0
OUT=$("$MIGRATE" "$WORK/project.json" 2>/dev/null) || EC=$?
assert "malformed manifest exits 0" "[ $EC -eq 0 ]"

Comment thread test/smoke-test.sh
Comment on lines +170 to 172
if [ -x "$IDSTACK_DIR/test/test-migrate.sh" ]; then
check "idstack-migrate unit tests pass" "'$IDSTACK_DIR/test/test-migrate.sh'"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If test-migrate.sh is missing or not executable, the smoke test will silently skip these unit tests instead of failing. It is safer to run the test script directly so that any execution failure or missing file is caught.

Suggested change
if [ -x "$IDSTACK_DIR/test/test-migrate.sh" ]; then
check "idstack-migrate unit tests pass" "'$IDSTACK_DIR/test/test-migrate.sh'"
fi
check "idstack-migrate unit tests pass" "'$IDSTACK_DIR/test/test-migrate.sh'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant