Repository navigation
test: add e2e smoke test and manual test matrix - #54
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds end-to-end testing for vmsan: a new smoke test script with seven test cases, a manual test matrix for KVM hosts, and a changeset entry documenting the addition. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/e2e/MANUAL-TESTS.md`:
- Line 8: Update the table row that uses `--allowed-domain "*.github.com"` so
the Expectation matches the flag and capitalizes “GitHub”: either add the apex
domain to the flag (e.g., include `--allowed-domain "github.com,*.github.com"`)
or change the Expected column to “Only GitHub subdomains reachable.” Ensure the
word “GitHub” is capitalized in the Expected cell.
In `@tests/e2e/smoke.sh`:
- Around line 99-103: The test treats any non-zero exit from vmsan exec "$VM_ID"
ping ... as a pass, which can mask exec failures or missing ping; update
tests/e2e/smoke.sh to first verify vmsan exec works by running a simple harmless
command (e.g., vmsan exec "$VM_ID" true or echo) and failing the test if that
fails, then run the ping and consider it a pass only if exec succeeded and the
ping command fails with an expected network-blocking indication (check ping's
specific non-zero exit code or stderr text such as "Network is unreachable" /
"connect: Network is unreachable"); reference the existing vmsan exec
invocation, VM_ID, and the I3 fail/pass labels when making these changes.
- Around line 29-33: The extract_vm_id function currently uses a brittle grep
pattern that fails on spaced/pretty JSON; replace its implementation to use jq
to robustly parse the first vmId from possibly-multi-line JSON output (e.g.,
echo "$output" | jq -r '.[0].vmId // .vmId' or a jq filter that returns the
first non-null "vmId"), ensure it still returns an empty string when none found
so VM_IDS handling/cleanup works, and update any call sites relying on
extract_vm_id to keep behavior consistent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4c3ed79c-a7e3-4d42-ac4d-8809d495cd01
📒 Files selected for processing (3)
.changeset/e2e-smoke-tests.mdtests/e2e/MANUAL-TESTS.mdtests/e2e/smoke.sh
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/e2e/smoke.sh (1)
48-48: Array element removal leaves empty strings instead of removing the element.The pattern
VM_IDS=("${VM_IDS[@]/$VM_ID/}")performs substring replacement, not element removal. IfVM_ID="vm-123", this replaces the substring with empty, leaving""in the array. The cleanup loop then callsvmsan remove --force "", which fails (benignly due to|| true).This pattern appears at lines 48, 83, 107, 150, and 163.
Consider either accepting the current behavior (cleanup handles it gracefully) or using proper element filtering:
♻️ Proposed helper for correct element removal
+# Remove a VM ID from the tracking array +remove_vm_id() { + local val="$1" + local new_arr=() + for item in "${VM_IDS[@]+"${VM_IDS[@]}"}"; do + [[ -n "$item" && "$item" != "$val" ]] && new_arr+=("$item") + done + VM_IDS=("${new_arr[@]+"${new_arr[@]}"}") +} + # Then replace all occurrences like: -VM_IDS=("${VM_IDS[@]/$VM_ID/}") +remove_vm_id "$VM_ID"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/e2e/smoke.sh` at line 48, The current use of substring replacement VM_IDS=("${VM_IDS[@]/$VM_ID/}") leaves empty strings in the VM_IDS array when an element equals VM_ID; replace that with explicit filtering: iterate the current VM_IDS array, append only entries not equal to VM_ID into a new array, then assign VM_IDS to that filtered array so elements are actually removed (apply this fix to the places using VM_IDS/VM_ID removal and referenced by the cleanup loop that runs vmsan remove --force "" so it no longer passes empty strings).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/e2e/smoke.sh`:
- Line 48: The current use of substring replacement
VM_IDS=("${VM_IDS[@]/$VM_ID/}") leaves empty strings in the VM_IDS array when an
element equals VM_ID; replace that with explicit filtering: iterate the current
VM_IDS array, append only entries not equal to VM_ID into a new array, then
assign VM_IDS to that filtered array so elements are actually removed (apply
this fix to the places using VM_IDS/VM_ID removal and referenced by the cleanup
loop that runs vmsan remove --force "" so it no longer passes empty strings).
- Use jq instead of brittle grep pattern to parse vmId from JSON output - Add exec pre-check in I3 deny-all test to distinguish network blocking from exec failures, and verify ping fails for expected network reasons - Fix manual test matrix: include apex domain in allowed-domain flag, capitalize GitHub, and align expectation text with wildcard behavior
Summary
tests/e2e/smoke.sh— automated bash smoke test with 7 scenarios covering the core vmsan workflowtests/e2e/MANUAL-TESTS.md— manual test matrix for scenarios that cannot be fully automatedSmoke test scenarios
--forcevmsan --versionreturns valid versionvmsan list --jsonproduces valid JSONRequirements
sudo bash tests/e2e/smoke.sh)jqavailable on PATHTest plan
sudo bash tests/e2e/smoke.shon a KVM hostSummary by CodeRabbit
Tests
Documentation
Chores