diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-01-08 04:56:39 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-02-09 03:32:52 +0000 |
| commit | 3f0745b4e3c0d2dbfb6a0c0e21467a5853c6a9e7 (patch) | |
| tree | a2f53dd3fd093cf9a0ffc946938eab3b63f3587e /tests/conftest.py | |
| parent | 0ebf4ef7838d5c831a7e56a91981a53480ea5d5f (diff) | |
| download | meta-virtualization-3f0745b4e3c0d2dbfb6a0c0e21467a5853c6a9e7.tar.gz | |
tests: add tests for auto-start and dynamic port forwarding
Add test coverage for new vmemres features:
TestAutoStartDaemon:
- test_auto_start_on_first_command: Verify daemon auto-starts
- test_no_daemon_flag: Verify --no-daemon uses ephemeral mode
- test_vconfig_auto_daemon: Test auto-daemon config setting
- test_vconfig_idle_timeout: Test idle-timeout config setting
TestDynamicPortForwarding:
- test_dynamic_port_forward_run: Run -d -p adds forward dynamically
- test_port_forward_cleanup_on_stop: Forwards removed on stop
- test_port_forward_cleanup_on_rm: Forwards removed on rm
- test_multiple_dynamic_port_forwards: Multiple containers work
TestPortForwardRegistry:
- test_port_forward_cleared_on_memres_stop: Registry cleared
Also add ensure_busybox() helper to both VdkrRunner and VpdmnRunner.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'tests/conftest.py')
| -rw-r--r-- | tests/conftest.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index b35f190c..71b86430 100644 --- a/tests/conftest.py +++ b/tests/conftest.py | |||
| @@ -400,6 +400,13 @@ class VdkrRunner: | |||
| 400 | if not self.has_image("alpine"): | 400 | if not self.has_image("alpine"): |
| 401 | self.pull("alpine:latest", timeout=timeout) | 401 | self.pull("alpine:latest", timeout=timeout) |
| 402 | 402 | ||
| 403 | def ensure_busybox(self, timeout=300): | ||
| 404 | """Ensure busybox:latest is available, pulling if necessary.""" | ||
| 405 | # Ensure memres is running first (in case a previous test stopped it) | ||
| 406 | self.ensure_memres() | ||
| 407 | if not self.has_image("busybox"): | ||
| 408 | self.pull("busybox:latest", timeout=timeout) | ||
| 409 | |||
| 403 | 410 | ||
| 404 | @pytest.fixture(scope="session") | 411 | @pytest.fixture(scope="session") |
| 405 | def vdkr(vdkr_bin, vdkr_env, arch, test_state_dir): | 412 | def vdkr(vdkr_bin, vdkr_env, arch, test_state_dir): |
| @@ -611,6 +618,13 @@ class VpdmnRunner: | |||
| 611 | if not self.has_image("alpine"): | 618 | if not self.has_image("alpine"): |
| 612 | self.pull("alpine:latest", timeout=timeout) | 619 | self.pull("alpine:latest", timeout=timeout) |
| 613 | 620 | ||
| 621 | def ensure_busybox(self, timeout=300): | ||
| 622 | """Ensure busybox:latest is available, pulling if necessary.""" | ||
| 623 | # Ensure memres is running first (in case a previous test stopped it) | ||
| 624 | self.ensure_memres() | ||
| 625 | if not self.has_image("busybox"): | ||
| 626 | self.pull("busybox:latest", timeout=timeout) | ||
| 627 | |||
| 614 | 628 | ||
| 615 | @pytest.fixture(scope="session") | 629 | @pytest.fixture(scope="session") |
| 616 | def vpdmn(vpdmn_bin, vdkr_env, arch, vpdmn_test_state_dir): | 630 | def vpdmn(vpdmn_bin, vdkr_env, arch, vpdmn_test_state_dir): |
