[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
pull Bot
pushed a commit
to joshyorko/testsuite
that referenced
this pull request
Sep 6, 2026
…h_argv (projectbluefin#773) tests/shared/ssh_config.py documents itself as the one source of truth for SSH connection details, resolving them via context attrs -> behave userdata -> environment -> defaults. Eight modules in the smoke suite and tests/shared/gnome_shell_steps.py bypassed it, each rebuilding the ssh argv inline from direct os.environ reads. tests/smoke/features/environment.py already calls populate_ssh_context(), so a run driven by behave userdata sent the shared steps to one host and the smoke-local steps to another. Add ssh_config.ssh_argv() as the single place the transport policy lives and migrate those nine modules onto it. The emitted argv is byte-identical to what each module built before, so behaviour is unchanged; the modules now inherit the documented precedence chain instead of reading env vars directly. resolve_ssh_details() now tolerates a missing/None context, which suite-local helpers need since they have no behave context to hand. tests/unit/test_ssh_transport_contract.py pins ssh_argv() and fails if any migrated module regrows a private copy of the argv. offline_boot_steps.py is left alone: PR projectbluefin#772 territory is disjoint from PR projectbluefin#768, which is adding unit coverage for that module. Refs projectbluefin#772 Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com> Co-authored-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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>
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