Skip to content

fix(test): fix 4 bugs in snapshot integration tests#344

Merged
DorianZheng merged 1 commit intomainfrom
fix/snapshot-integration-tests
Mar 4, 2026
Merged

fix(test): fix 4 bugs in snapshot integration tests#344
DorianZheng merged 1 commit intomainfrom
fix/snapshot-integration-tests

Conversation

@DorianZheng
Copy link
Copy Markdown
Member

@DorianZheng DorianZheng commented Mar 4, 2026

Summary

  • Fixed in Integration tests broken: stale base_disk record + cargo test overwrites link-krun shim #343
  • Wrong disk paths: Tests asserted files at boxes/{id}/disk.qcow2 but actual path is boxes/{id}/disks/disk.qcow2. Added disks_dir() helper.
  • Handle invalidation after stop(): stop() cancels the shutdown token, making the handle unusable for start(). Fixed by calling runtime.get("test-box") to get a fresh handle after each stop().
  • False guest-rootfs assertion in snapshot dir: Snapshot only forks the container disk; removed incorrect assertion.
  • False guest-rootfs assertion after restore: restore_disks() intentionally deletes guest-rootfs so next start recreates it fresh. Flipped assertion to !exists().
  • Stale DB record cleanup: GuestRootfsManager::find() now deletes stale DB records when the backing file is missing.
  • Missing --features link-krun: Integration test make target was missing the feature flag.
  • Doc comment fix: Updated disk/constants.rs paths to include disks/ subdirectory.

Test plan

  • cargo clippy -p boxlite --tests -- -D warnings — clean
  • cargo fmt --check — clean
  • make test:integration:rust — all 111 integration tests pass (including 5 snapshot tests)

- Fix wrong disk paths: use `disks/` subdirectory instead of box root
- Fix handle invalidation: get fresh handle via runtime.get() after stop()
- Remove false assertion that guest-rootfs exists in snapshot directory
- Flip guest-rootfs assertion after restore (restore deletes it intentionally)
- Fix stale DB record cleanup in GuestRootfsManager::find()
- Add --features link-krun to integration test make target
- Fix doc comments in disk/constants.rs to include disks/ path segment
@DorianZheng DorianZheng merged commit 8dc7b6c into main Mar 4, 2026
17 checks passed
@DorianZheng DorianZheng deleted the fix/snapshot-integration-tests branch March 4, 2026 14:09
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