Repository navigation
tests: check the CLI's behavior instead of its old output (SL3.11a) - #1512
Merged
Pedro Henrique Penna (ppenna) merged 1 commit intoNov 12, 2026
Merged
Pedro Henrique Penna (ppenna) merged 1 commit into
Pedro Henrique Penna (ppenna) merged 1 commit into
Conversation
Contributor
This pull request changes existing testsIt modifies or removes 2 existing test asset(s), listed below. Review each with care: a change to a test can hide a regression that the test caught. See doc/contribute.md#changes-to-existing-tests. Test code
Relocated unchanged: 0; added: 1. Compared the merge base |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the test and docstring updates.
No open issues 🎉
What changed in this PR
This PR advances SL3.11a by making Python’s checks of the selected nvx-rs CLI verify behavior rather than legacy wording. It changes tests and a docstring only; CLI behavior remains unchanged.
Changes:
- Replace help-text checks with dry-run assertions that each guest’s OpenVMM memory argument matches its Python-defined default.
- Check invalid egress policies by stable error code and single-line message format instead of exact wording.
- Clarify that callers should distinguish failures by code because messages may change.
| File | Description |
|---|---|
scripts/test_nvx_tools.py |
Rewrites guest-memory and egress-error checks to assert behavior. |
scripts/nvx_tools/nvx_rs.py |
Updates the query docstring to emphasize stable error codes. |
Review effort: Balanced
Two of the checks that run the nvx-rs that NVX_RS names still compared its output with the words that it inherited from nvx.py. The refusal of an egress policy that is not an object had to read "egress policy must be an object", the message of the Python code that nvx-rs replaced in #597. The help of nvx-rs run had to state "alpine 128" and the other guests' defaults, as nvx.py's help did before #902. Neither wording is a behavior: a reworded message or help failed the checks, while a refusal with another code, or a run that booted a guest with another memory default, passed them. The egress check now reads the refusal through nvx_rs as the scenarios do: its stable code, unsupported, and a message of one line without that code. The memory check now runs nvx-rs run --dry-run for each guest, through nvx_rs.command_line, on placeholder artifacts, and reads the --memory of the OpenVMM command that a run would launch: the memory that guests.py gives test-microvm. nvx_rs.query's docstring no longer says that nvx.py prints the message of the Python code that nvx-rs replaced. On Windows, with nvx-rs built from this tree, both checks passed. With the message and the help reworded, the old checks failed and the new ones passed; with the refusal's code changed to io and Alpine's default memory to 256 MiB, the old checks passed and the new ones failed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna)
force-pushed
the
agents/slim-sl3-11a-nvx-py
branch
from
November 12, 2026 09:58
5b5b333 to
7d14378
Compare
Pedro Henrique Penna (ppenna)
marked this pull request as ready for review
November 12, 2026 09:58
Pedro Henrique Penna (ppenna)
merged commit Nov 12, 2026
ff15032
into
feature/nvx-refactor
84 of 85 checks passed
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1112 (SL3.11a, "
scripts/nvx.pydrives the CLI, and its checks pass"). Parent #1083, umbrella #1076.What and why
SL3.11a's goal is that
scripts/nvx.pydrives the existingnvx-rsbinary throughNVX_RS, and that its checks of the CLI assert behavior instead of the old output. Most of its Scope was already true onfeature/nvx-refactorb7350086, through these pull requests:scripts/nvx_tools/nvx_rs.pybuildsnvx-rsfromnvx-rs/Cargo.tomlintonvx-rs/target(--target-dir nvx-rs/target). It runs the executable thatNVX_RSnames, elsenvx-rs/target/release/nvx-rs[.exe], else that one after it builds it.microvm_tests.pyand its scenario drivers (managed_exec_tests.py,sandbox_lifecycle_tests.py,sandbox_proxy_tests.py,sandbox_ram_upper_tests.py) run everynvx-rscommand throughnvx_rs.command_line, and so through that selection.NVX_RSnaming the build that CI made atnvx-rs/target/release/. The microVM jobs put the same build there.test-microvmrun runs the public sandbox scenarios.sandbox-gpt-layer,snapshot-core,snapshot-tiersanduntiered-network-policyalso runnvx-rsthroughnvx_rs.command_line, the last three on the CLI's named snapshots.vm-lifecycleis a Cargo test of the library, which runs no CLI.nvx-rs's errors apart by their stable codes. The CLI's own tests replaced the transcripts that scripts recorded fromnvx.py.run-console-restore.What remained were two checks that compared the output of the
nvx-rsthatNVX_RSnames with wording that it inherited fromnvx.py. A reworded message or help failed them, while a refusal with another code, or a guest booted with another memory default, passed them. This PR makes them assert behavior:NvxRsTests.test_the_real_nvx_rs_prints_what_nvx_py_readsrequired the refusal of an egress policy that isn't an object to read exactlyegress policy must be an object, the message of the Python code thatnvx-rsreplaced in Make nvx-rs the backend of nvx.py sandbox, egress, and artifact lookup #597. It now requires the refusal's stable code,unsupported, and a message of one line without that code, asnvx_rs.queryreads it.NvxRsTests.test_run_help_states_each_guest_memory_defaultrequired the help ofnvx-rs runto statealpine 128and the other guests' defaults, as the help ofnvx.py rundid before nvx.py: retire the run and sandbox commands in favor of nvx-rs #902.test_run_boots_each_guest_with_its_default_memoryreplaces it. For each guest, it runsnvx-rs run --guest NAME --dry-runthroughnvx_rs.command_line, on placeholder artifacts. It then requires the--memoryof the OpenVMM command that a run would launch to be the memory thatguests.pygivestest-microvm.nvx_rs.queryno longer says thatnvx.pyprints the message "as it printed the message of the Python code that nvx-rs replaced".Nothing else needed a change. The scenario drivers match the CLI's error codes and fragments of its current messages, such as option, file and snapshot names, and none compares the old output. The outputs that the checks keep, the native rules of the egress policies that they compile, still hold, so none needed recording again. No scenario driver changes, so there is no scenario-driver change to flag.
The case matrix (
doc/acceptance-case-matrix.md) lists neither test, and itsvalidate-nvxrow, which runs them, stays kept.Size
Measured against
feature/nvx-refactorb7350086, as against14ca2671before the rebase:scripts/nvx_tools/nvx_rs.py, whose docstring changes.scripts/test_nvx_tools.pyholds tests.Commits
tests: check the CLI's behavior instead of its old output (SL3.11a)Not in this PR
scripts/nvx.py, or changingNVX_RS's precedence, the build intonvx-rs/target, or packaging.nvx-rs: no command, flag or output changes.test_usage_documents_every_option_of_nvx_rs, which checks thatdoc/usage.mddocuments each option that the help ofnvx-rs runandsandboxlists. It compares option names, which are stable, not wording.Validation
On this head,
7d143782, the same commit rebased ontob7350086(git range-diffshows no content change), withnvx-rsbuilt from it andNVX_RSnaming the build:python -m unittest scripts.test_nvx_tools.NvxRsTestsx86_64-unknown-linux-muslbuild that CI's NVX CLI job on Linux usespython -m unittest scripts/test_performance.py ... scripts/test_public_api.py)test_nvx_toolsandtest_microvm_tests, with a GNU build: 927 tests, OK (12 skipped)test_adversarial.py,test_hosts.py, and validate-nvx'snvx.py ... --helpcommandsruff checkandruff format --checkofscripts .github/specula;pyright --pythonplatform LinuxandWindowscheck_test_layout.py,check_markdown_links.py, and the case matrix's check (check_matrix.pyagainst99d2022085f)Before the rebase, on
5b5b3339, withnvx-rsbuilt from it (cargo build --release --locked --features cli --manifest-path nvx-rs/Cargo.toml --target-dir nvx-rs/target) andNVX_RSnaming the build:python -m unittest scripts.test_nvx_tools.NvxRsTestsnvx-rs, with a staticx86_64-unknown-linux-muslbuild, as CI's NVX CLI job on Linux usespython -m unittest scripts/test_performance.py ... scripts/test_public_api.py)test_nvx_toolsandtest_microvm_tests: 923 tests, OK (12 skipped)test_adversarial.py,test_hosts.py, and validate-nvx'snvx.py ... --helpcommandsruff checkandruff format --checkofscripts .github/specula;pyright --pythonplatform LinuxandWindowscheck_test_layout.py,check_markdown_links.pyThe rewritten checks test behavior. On Windows, I rebuilt
nvx-rstwice with temporary edits, which I then reverted:nvx-rsbuilt withhas to be a JSON objectand the help toalpine: 128 MiBio, and Alpine's default memory to 256 MiB, with the message and the help unchanged'io' != 'unsupported';['256M'] != ['128M'])No microVM ran: no scenario changes. CI's guest-and-sandbox jobs run the public sandbox scenarios with CI's build. On the base's push run, 43131339763 at
14ca2671, they passed on KVM, MSHV and WHP, and its NVX CLI jobs ran all 21NvxRsTestswithNVX_RSset, none skipped.Left to CI: shellcheck and Specula's tests (no shell or Specula change), the nvx-rs checks (no Rust change), and the microVM, platform and package lanes.
Changes to existing tests
python3 scripts/check_test_changes.py --base origin/feature/nvx-refactorlists 2 changes to existing tests and 1 added test, so this PR has thetests-modifiedlabel:NvxRsTests.test_the_real_nvx_rs_prints_what_nvx_py_reads, inscripts/test_nvx_tools.py, is rewritten: it checks the refusal's code and the message's form instead of the old message.NvxRsTests.test_run_help_states_each_guest_memory_defaultis removed and rewritten as the addedNvxRsTests.test_run_boots_each_guest_with_its_default_memory. It checks the memory with whichnvx-rs runwould boot each guest instead of the help's words.