Repository navigation
[quality] test: unit coverage for offline_boot_steps.py, sudo_rs_steps.py, bctl_steps.py, update_failure_steps.py - #768
Merged
Conversation
Adds pytest unit coverage for the four behave step modules in this repo that had no corresponding tests/unit/ file: - tests/smoke/features/steps/offline_boot_steps.py - tests/smoke/features/steps/sudo_rs_steps.py - tests/developer/features/steps/bctl_steps.py - tests/lifecycle/features/steps/update_failure_steps.py Each new test file stubs behave, dogtail, qecore and the SSH transport in sys.modules so no VM or desktop session is required, following the existing tests/unit/test_xwayland_steps.py and test_lifecycle_steps.py pattern. Line coverage for the four modules goes from 0% to 99%. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Aug 29, 2026
hanthor
approved these changes
Sep 2, 2026
hanthor
left a comment
Member
There was a problem hiding this comment.
83 tests across 4 new files for previously-uncovered step modules; spot-checked against real assertion text, exercises real branches. CI green (1407 passed).
Generated by Claude Code
mrbobbytables
added a commit
to mrbobbytables/testsuite
that referenced
this pull request
Sep 15, 2026
… image_cache, screenshot, and run_ssh onto ssh_config.ssh_argv() Phase 2 of projectbluefin#772: extract the remaining raw ssh argv builders onto the single transport policy in tests/shared/ssh_config.py. - Add ssh_argv(quiet=...) so callers that need LogLevel=ERROR (previously hand-rolled at each site) opt in explicitly instead of restating it. - Fold ssh_steps.run_ssh onto ssh_argv(quiet=True); it now always resolves the port through the shared precedence chain (context > userdata > env > default), so unset ssh_port emits an explicit '-p 22' instead of silently relying on ssh's own default. - Migrate tests/dx and tests/flatcar's raw ssh argv (both gain the -p flag, fixing silent port loss under port-forwarded lanes). - Fix tests/kde-smoke/features/steps/steps.py:_run_host, which read a context.kde['ssh'] dict that before_all never populated — it always fell through to raw os.environ reads and silently ignored userdata-driven runs. It now resolves through ssh_argv(context), honouring the context attributes before_all does set. - Migrate tests/software's _flatpak/_run_in_session/_has_bazaar, which already used resolve_ssh_details, onto ssh_argv() for a single argv builder instead of two. - Migrate tests/shared/image_cache.py and tests/shared/screenshot.py. screenshot._ssh_run previously read only os.environ; it now resolves via the behave context bound by configure_screenshot_context. - Fix tests/vanilla-gnome/features/steps/steps.py, which passed the command's own timeout as ssh's ConnectTimeout, conflating the connect deadline with the command deadline (a 900s long-command timeout became a 900s connect timeout). It now uses ssh_argv()'s fixed 10s connect timeout and threads context through so future context-based resolution works. - Widen tests/unit/test_ssh_transport_contract.py's MIGRATED_MODULES to cover all of the above, so any of them re-growing a private ssh argv copy fails CI. tests/smoke/features/steps/offline_boot_steps.py remains unmigrated per the issue's Phase 1 exclusion (PR projectbluefin#768 covers its unit tests). Fixes projectbluefin#772 Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
castrojo
pushed a commit
to mrbobbytables/testsuite
that referenced
this pull request
Sep 18, 2026
… image_cache, screenshot, and run_ssh onto ssh_config.ssh_argv() Phase 2 of projectbluefin#772: extract the remaining raw ssh argv builders onto the single transport policy in tests/shared/ssh_config.py. - Add ssh_argv(quiet=...) so callers that need LogLevel=ERROR (previously hand-rolled at each site) opt in explicitly instead of restating it. - Fold ssh_steps.run_ssh onto ssh_argv(quiet=True); it now always resolves the port through the shared precedence chain (context > userdata > env > default), so unset ssh_port emits an explicit '-p 22' instead of silently relying on ssh's own default. - Migrate tests/dx and tests/flatcar's raw ssh argv (both gain the -p flag, fixing silent port loss under port-forwarded lanes). - Fix tests/kde-smoke/features/steps/steps.py:_run_host, which read a context.kde['ssh'] dict that before_all never populated — it always fell through to raw os.environ reads and silently ignored userdata-driven runs. It now resolves through ssh_argv(context), honouring the context attributes before_all does set. - Migrate tests/software's _flatpak/_run_in_session/_has_bazaar, which already used resolve_ssh_details, onto ssh_argv() for a single argv builder instead of two. - Migrate tests/shared/image_cache.py and tests/shared/screenshot.py. screenshot._ssh_run previously read only os.environ; it now resolves via the behave context bound by configure_screenshot_context. - Fix tests/vanilla-gnome/features/steps/steps.py, which passed the command's own timeout as ssh's ConnectTimeout, conflating the connect deadline with the command deadline (a 900s long-command timeout became a 900s connect timeout). It now uses ssh_argv()'s fixed 10s connect timeout and threads context through so future context-based resolution works. - Widen tests/unit/test_ssh_transport_contract.py's MIGRATED_MODULES to cover all of the above, so any of them re-growing a private ssh argv copy fails CI. tests/smoke/features/steps/offline_boot_steps.py remains unmigrated per the issue's Phase 1 exclusion (PR projectbluefin#768 covers its unit tests). Fixes projectbluefin#772 Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
castrojo
added a commit
that referenced
this pull request
Sep 22, 2026
…gnome onto ssh_config.ssh_argv() (#790) * refactor(ssh): route dx, flatcar, kde-smoke, software, vanilla-gnome, image_cache, screenshot, and run_ssh onto ssh_config.ssh_argv() Phase 2 of #772: extract the remaining raw ssh argv builders onto the single transport policy in tests/shared/ssh_config.py. - Add ssh_argv(quiet=...) so callers that need LogLevel=ERROR (previously hand-rolled at each site) opt in explicitly instead of restating it. - Fold ssh_steps.run_ssh onto ssh_argv(quiet=True); it now always resolves the port through the shared precedence chain (context > userdata > env > default), so unset ssh_port emits an explicit '-p 22' instead of silently relying on ssh's own default. - Migrate tests/dx and tests/flatcar's raw ssh argv (both gain the -p flag, fixing silent port loss under port-forwarded lanes). - Fix tests/kde-smoke/features/steps/steps.py:_run_host, which read a context.kde['ssh'] dict that before_all never populated — it always fell through to raw os.environ reads and silently ignored userdata-driven runs. It now resolves through ssh_argv(context), honouring the context attributes before_all does set. - Migrate tests/software's _flatpak/_run_in_session/_has_bazaar, which already used resolve_ssh_details, onto ssh_argv() for a single argv builder instead of two. - Migrate tests/shared/image_cache.py and tests/shared/screenshot.py. screenshot._ssh_run previously read only os.environ; it now resolves via the behave context bound by configure_screenshot_context. - Fix tests/vanilla-gnome/features/steps/steps.py, which passed the command's own timeout as ssh's ConnectTimeout, conflating the connect deadline with the command deadline (a 900s long-command timeout became a 900s connect timeout). It now uses ssh_argv()'s fixed 10s connect timeout and threads context through so future context-based resolution works. - Widen tests/unit/test_ssh_transport_contract.py's MIGRATED_MODULES to cover all of the above, so any of them re-growing a private ssh argv copy fails CI. tests/smoke/features/steps/offline_boot_steps.py remains unmigrated per the issue's Phase 1 exclusion (PR #768 covers its unit tests). Fixes #772 Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com> * docs(skills): record the ssh_argv transport contract AGENTS.md:146 wants a matching docs/skills/** update when a change alters a contract. This PR changes one across five suites - `-p` is now always emitted and `quiet` is opt-in per call site - with no note. Records both properties and the MIGRATED_MODULES guard in the shared-ssh reference. Assisted-by: Claude Opus 4.5 via pi Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(ssh): preserve kde-smoke default key, read TMT_SSH_PORT, refresh contract docs Review follow-ups for the Phase 2 ssh_argv() routing: - kde-smoke before_all no longer hardcodes an always-truthy TMT_SSH_KEY default. With no key env var set, _default_ssh_key() prefers the tmt-provisioned /etc/ssh/test-key/id_ed25519 when it exists and otherwise falls back to the runner key /home/bluefin-test/.ssh/id_ed25519 — the path _run_host used before it moved onto ssh_argv(), so env-default local runs keep authenticating. - resolve_ssh_details() now reads TMT_SSH_PORT after SSH_PORT/VM_PORT, so tmt-provisioned lanes (dx, flatcar) on a forwarded port no longer connect to 22. Those suites resolve host/user/key from TMT_SSH_* and never set context.ssh_port. - populate_ssh_context() docstring and the behave SSH docs now describe the real post-refactor contract: skipping the call no longer raises AttributeError, it silently falls back to default credentials. Unit tests cover both new behaviours. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(ssh): log resolved SSH target and restore 20s flatpak connect window Address review findings on the ssh_argv() routing work: - resolve_ssh_details() can no longer fail loudly when a suite never populates context: it falls back to the built-in runner defaults. Add resolve_ssh_details_with_sources() which reports where each field came from, and have ssh_argv() print the resolved destination once per distinct target, plus a warning when every field fell back to a built-in default (pointing at populate_ssh_context). A misconfigured suite now says which target it dialled instead of producing an opaque rc-255 against the wrong host. - vanilla-gnome _ssh_run() takes an explicit connect_timeout, and the Flatpak probe passes connect_timeout=20 so its connect budget stays at the pre-refactor 20s instead of halving to ssh_argv's 10s default. Docs and unit tests updated for both. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(ssh): retain _first_value helper in ssh_config for environment callers Assisted-by: Gemini via pi Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com> Co-authored-by: mrbobbytables <mrbobbytables@users.noreply.github.com> Co-authored-by: v <a@l> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jorge O. Castro <jorge.castro@gmail.com> Co-authored-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
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.
Test Improvement
Adds pytest unit coverage for the four behave step modules in this repo that had no
tests/unit/counterpart. Claimed ground, exactly:tests/unit/test_offline_boot_steps.pytests/smoke/features/steps/offline_boot_steps.py_run_host,nm_wait_online_not_before_graphical,uupd_timer_enabled_or_absent,no_uupd_error_journal_entries,drop_default_route,restore_default_route,boot_with_interfaces_downtests/unit/test_sudo_rs_steps.pytests/smoke/features/steps/sudo_rs_steps.pysudo_is_setuid_root_4755,sudo_n_id_u_returns_0,sudo_preserve_env_check,sudo_pam_includes_system_auth,sudoedit_binary_checktests/unit/test_bctl_steps.pytests/developer/features/steps/bctl_steps.py_terminal_widget,_terminal_delta,_wait_for_command_result,run_bctl_command_in_ptyxis,bctl_command_output_includes,bctl_command_exits_with_status_zero,bctl_update_check_exits_with_status_zero_or_onetests/unit/test_update_failure_steps.pytests/lifecycle/features/steps/update_failure_steps.py_parse_bootc_status,_skip,bootc_rollback_matches_original,force_bootc_rollback_and_reboot, and the four @pending greenboot/corrupted-digest stubs83 new tests. Line coverage for those four modules: 0% -> 99% (only the reboot-disconnect
exceptbody is unreached).Each test file stubs
behave,dogtail.rawinput,qecore.common_stepsandtests.shared.ssh_stepsinsys.modules, following the existingtests/unit/test_xwayland_steps.pyandtests/unit/test_lifecycle_steps.pyimport-helper pattern. No VM, SSH transport or desktop session is required.Scope / disjointness
Test-only change. Adds four new files, modifies nothing. No
Justfile, workflow or production-code edits — pytest already auto-discoverstests/unit/.Verified disjoint from every open testsuite PR:
tests/unit/test_generate_skill_index.py,tests/unit/test_update_coverage_snapshot.py— different files, different modules.tests/unit/test_screenshot_steps.py(tests/shared/screenshot_steps.py) — different module.tests/unit/test_suite_environment_contract.py— different module.Verification
Full existing suite still green — the
sys.modulesstubbing does not leak into other unit tests.Related Issue
Refs #767 (CI gate script coverage tracker) — this PR covers behave step modules, not the CI gate scripts, so the tracker stays open.
Filed by quality agent (hold-gated mode). Human review required. Do not merge without review;
holdlabel must stay.— hive: agent=quality backend=copilot model=claude-opus-5