Skip to content

fix(test): add missing .clone() in image_registries test after #604#606

Merged
DorianZheng merged 1 commit into
boxlite-ai:mainfrom
G4614:fix/missing-clone-image-registries
May 27, 2026
Merged

fix(test): add missing .clone() in image_registries test after #604#606
DorianZheng merged 1 commit into
boxlite-ai:mainfrom
G4614:fix/missing-clone-image-registries

Conversation

@G4614

@G4614 G4614 commented May 27, 2026

Copy link
Copy Markdown
Contributor

#604 added `impl Drop for PerTestBoxHome` but missed one site. Line 40 still moves `home.path` directly, triggering E0509 on every `cargo build --tests -p boxlite` on current main.

Reproduce on origin/main (2b9b545):

```
$ cargo build --tests -p boxlite
error[E0509]: cannot move out of type `PerTestBoxHome`, which implements the `Drop` trait
--> src/boxlite/tests/image_registries.rs:40:19
```

Same file's line 14 and every other test file (e.g. `shutdown.rs`, 10+ sites) was already updated to `home.path.clone()`; this is the one site sed/find-replace skipped.

After this change `cargo build --tests -p boxlite` compiles clean.

…e-ai#604

boxlite-ai#604 added `impl Drop for PerTestBoxHome` but missed updating
`structured_image_registries_validate_at_runtime_start` — the rest of
the file (line 14) and every other test file (e.g. shutdown.rs, 10+
sites) were updated to `home.path.clone()`, but line 40 still moves
`home.path` directly, triggering E0509 on a Drop-implementing type.

Reproduce on origin/main (2b9b545):

    $ cargo build --tests -p boxlite
    error[E0509]: cannot move out of type `PerTestBoxHome`,
                  which implements the `Drop` trait
      --> src/boxlite/tests/image_registries.rs:40:19

After this change `cargo build --tests -p boxlite` compiles clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@DorianZheng DorianZheng merged commit 5d717f5 into boxlite-ai:main May 27, 2026
21 checks passed
G4614 pushed a commit to G4614/boxlite that referenced this pull request May 28, 2026
…check

PR boxlite-ai#604 added a strict PerTestBoxHome::Drop assertion that fails if any
shim referenced by <home>/boxes/*/shim.pid is still alive when the home
drops. Two health_check tests tripped it:

- health_check_transitions_to_healthy_after_startup: the box stays
  healthy; RuntimeImpl::Drop's safety-net shutdown_sync skips boxes that
  aren't plainly Running and does not reliably stop a box with an active
  health-check actor before the home's leak check fires. Add
  `t.bx.stop().await.ok()`.

- health_check_becomes_unhealthy_when_shim_killed: the test kill -9's
  the shim, leaving a zombie (dead, unreaped while the runtime parent
  lives). The leak check counts zombies as live (kill(pid,0)==0), and
  the now-Stopped box is skipped by shutdown_sync, so nothing reaps it.
  Add `t.runtime.remove(box_id, true).await.ok()` which reaps the child.

Test-only change. The box already reports Stopped correctly; only the
test-side cleanup was missing. The production safety-net gap is noted
in the comments but left unchanged to avoid unprompted scope creep.

(image_registries.rs .clone() compile fix dropped from this branch —
upstream boxlite-ai#606 landed the same fix; rebased onto current main.)

Two-side verified:
  pre-fix:  2 tests run: 0 passed, 2 failed (both "PerTestBoxHome dropped with 1 live shim")
  post-fix: 2 tests run: 2 passed

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@G4614 G4614 deleted the fix/missing-clone-image-registries branch May 28, 2026 08:39
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.

2 participants