nvx-rs: replace the golden CLI scenarios with structured scenario tests
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- cli, testing-qa
Research direction
Start with tests/cli.rs, tests/fixtures/cli.json, and the replay in nvx_rs_reproduces_the_recorded_scenarios; inspect the shared setup and scenario records before designing the harness under tests/cli/. Map all 281 scenarios and listed regressions to the requested tests, then run the Linux and Windows suites and the specified mutation checks. Done means every scenario is covered and the behavior preserving pull request passes its gate; retirement is a later pull request.
Written by the indexing model from the issue text.
Description
Part of #722. Step 2. Its gate needs #726.
Goal
Replace tests/fixtures/cli.json and its replay, nvx_rs_reproduces_the_recorded_scenarios in tests/cli.rs, with scenario tests that check what callers rely on: exit statuses, error codes and stable fragments, the state directory and its parsed JSON files, file modes, and the arguments that OpenVMM receives, rather than transcripts recorded from Python.
Background
cli.jsonholds 141 POSIX and 140 Windows scenarios, in 426 steps, recorded fromnvx.py sandbox,egress compile, andartifacts, withnvx-fake-openvmmas OpenVMM. Each step compares the exit status, standard output and error, and state files byte for byte, after replacing the root, process IDs, and random identifiers with placeholders.- On Windows, only the replay reaches 533 lines and 130 branches, mostly in
src/host/cli/sandbox/andsrc/testing/fake_openvmm.rs, and all ofegress compile. nvx.py sandboxpasses the streams and status ofnvx-rsthrough, and the hypervisor suites match message fragments and parseruntime.jsonand outcome reports.
Tasks
Replacement tests, in a pull request that doesn't change behavior:
- A harness in
tests/cli/that reuses the root and fake-OpenVMM setup oftests/cli.rs, and checks exit statuses, error codes (#724) or stable fragments, the entries of the state directory, its parsed JSON files, POSIX file modes, and the arguments that the fake OpenVMM received. - Table-driven tests:
usage_errors_exit_2_and_name_the_optionvalidation_errors_exit_1_before_any_side_effect: the state directory is unchanged, and OpenVMM didn't run.dry_runs_print_the_openvmm_command_and_launch_nothing: the>>line, split into arguments, holds the sandbox blocks, workload identity, shares, egress rules, and kernel command line.one_shot_runs_exit_with_the_workload_or_openvmm_status: statuses such as 0, 3, 7, 124, 127, and 137, the workload's output byte for byte, and the schema of the outcome report.lifecycles_of_every_configuration: the state after each ofprovision,start,exec,stop, anddeprovision.refusals_of_lifecycle_operationsconfigurations_of_every_format_start_and_exec, from hand-writtenconfig.jsonfiles of formats 1 to 6 intests/fixtures/state/.egress_compile_prints_the_library_loweringartifacts_list_every_guest_in_order- A property that the
>>line splits back into the arguments, withCommandLineToArgvWon Windows and a shell-word splitter on POSIX.
- A temporary table that maps each of the 281 scenarios, and the regressions of #369, #373, #464, and #513, to tests, and a test that fails on a scenario that maps to none.
- Keep the other tests of
tests/cli.rs, including the Ctrl-C tests.
Retirement, in the next pull request:
- Delete
cli.json, the replay and its normalization helpers, and the mapping test. - Write only the newest
config.jsonformat, and keep reading formats 1 to 6. Drop the README's promise that an oldernvx.pycan operate a sandbox thatnvx-rsprovisioned. - Docs: replace the README's "Golden scenarios" section, and update its Testing section and
doc/project-structure.md.
Gate
- The lines and branches that only the replay reaches, on Windows and Linux (#726), are reached by the new tests or deleted.
-
cargo mutantsonsrc/host/cli/sandbox/mod.rs,lifecycle.rs, andstate.rsmisses no mutant with the new tests that the replay catches. - Every scenario maps to a test.
Coordination
nvx-rs run(#638) gets its scenarios as tests of this harness, not as records from Python.- Until
cli.jsonis deleted, changes such as those of #620 and #622 may edit its records by hand, but add no recorded scenarios.
Acceptance criteria
-
cli.jsonis gone, and the scenario tests pass on Linux and Windows.
- Dominant language
- Python
- Stars
- 408
- Forks
- 28
- Avg merge
- 15h 15m
- Merged PRs (30d)
- 322
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/nvx
-
bug-hunt confirmed good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 32/100
Maintainers usually reply within 1 day
Similar issues
-
comp/tools P2 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NousResearch/hermes-agent#142908 · 1 comment ·
-
[oblt-aw][autodoc] Fix malformed headings in new Buildkite docs pagesPossibly taken @github-actions claimed this today. Opendocumentation
Difficulty 1/5 Under an hour Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
[Bug]: fileUploadMatrix.test.ts URL case does a real DNS lookup and fails offlinePossibly taken @r2jaff claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ComposioHQ/composio#5054 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
pytorch/tensordict#3286 ·
Maintainers usually reply within 1 day