Harden Python NVMe tests to fail gracefully on malformed JSON#27
Draft
Copilot wants to merge 12 commits into
Draft
Harden Python NVMe tests to fail gracefully on malformed JSON#27Copilot wants to merge 12 commits into
Copilot wants to merge 12 commits into
Conversation
Add two mechanisms to run end-to-end tests against a binary other than
the one built from the current source tree:
1. NVME_BIN environment variable (highest priority):
NVME_BIN=/usr/bin/nvme python3 tests/tap_runner.py ...
2. -Dnvme-bin meson option (for meson-driven runs):
meson setup .build -Dnvme-bin=/usr/bin/nvme
meson test -C .build
The NVME_BIN env var is also explicitly set by meson when running tests,
pointing to the build-tree binary by default (or the -Dnvme-bin value
when specified). This makes the binary selection deterministic regardless
of PATH.
Priority order: NVME_BIN env var > config.json nvme_bin > build-tree binary
Update the README to document all three selection mechanisms.
Copilot
AI
changed the title
tests: support NVME_BIN env var and nvme-bin meson option for e2e tests
tests: support external nvme binary via NVME_BIN env var and -Dnvme-bin meson option
Jun 2, 2026
Copilot
AI
changed the title
tests: support external nvme binary via NVME_BIN env var and -Dnvme-bin meson option
tests: tolerate legacy Jun 2, 2026
create-ns output across nvme-cli versions
Copilot
AI
changed the title
tests: tolerate legacy
Harden Python NVMe tests to fail gracefully on malformed JSON
Jun 2, 2026
create-ns output across nvme-cli versions
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.
Several tests assumed valid JSON command output and directly indexed nested fields. When output was malformed or schema-shifted, failures were noisy (
JSONDecodeError/KeyError/AttributeError) instead of actionable test failures.Centralized JSON parsing + access guards (base test class)
parse_json_output(...)intests/nvme_test.pyto convert decode/type problems into explicitself.fail(...)messages with command context.json_get(..., required=True)to enforce required keys and report missing-field failures clearly.Replaced fragile direct JSON access in common helpers
tests/nvme_test.py(get_ctrl_id,get_nsid_list,get_max_ns,get_lba_format_size,get_id_*_field_value, namespace list checks) to use guarded parsing/access.Hardened JSON shape checks in format/copy test paths
tests/nvme_format_test.pyto validatelbafspresence/type and per-entry structure before use.tests/nvme_copy_test.pyto validateelbafspresence/type and entry shape before readingpif/iterating.Backward-compatible create-ns output handling
_get_created_nsid(...), with clearer failure text when neither format yieldsnsid.