Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: update expeted error codes of qubes-vm-update #604

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions qubes/tests/integ/vm_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,8 @@ def update_via_proxy_qubes_vm_update_impl(
method="direct",
options=(),
expected_ret_codes=None,
break_repo=False
break_repo=False,
expect_updated=True,
):
"""
Test both whether updates proxy works and whether is actually used
Expand All @@ -502,6 +503,7 @@ def update_via_proxy_qubes_vm_update_impl(
:type options: tuple
:type expected_ret_codes: tuple
:type break_repo: bool
:type: expect_updated: bool
"""
if self.template.count("minimal"):
self.skipTest("Template {} not supported by this test".format(
Expand Down Expand Up @@ -545,7 +547,7 @@ def update_via_proxy_qubes_vm_update_impl(
self.assertRunCommandReturnCode(
self.testvm1,
self.upgrade_test_cmd.format('test-pkg'),
expected_ret_codes
(0,) if expect_updated else (1,)
)

def test_010_update_via_proxy(self):
Expand All @@ -570,13 +572,14 @@ def upgrade_status_notify(self):
))

def updates_available_notification_qubes_vm_update_impl(
self, method="direct", options=()):
self, method="direct", options=(), expect_updated=True):
"""
Test if updates-available flags is updated.

:type self: qubes.tests.SystemTestCase | VmUpdatesMixin
:type method: str
:type options: tuple
:type expect_updated: bool
"""
self.start_standalone_vm_with_repo()

Expand Down Expand Up @@ -608,7 +611,7 @@ def updates_available_notification_qubes_vm_update_impl(
self.assertRunCommandReturnCode(
self.testvm1,
self.upgrade_test_cmd.format('test-pkg'),
self.ret_code_ok
(0,) if expect_updated else (1,)
)

def test_020_updates_available_notification(self):
Expand Down Expand Up @@ -639,16 +642,18 @@ def test_130_no_network_qubes_vm_update(self):
self.update_via_proxy_qubes_vm_update_impl(
method="qubes-vm-update",
options=(),
expected_ret_codes=(1, 2, 5),
break_repo=True
expected_ret_codes=(23,),
break_repo=True,
expect_updated=False,
)

def test_131_no_network_qubes_vm_update_cli(self):
self.update_via_proxy_qubes_vm_update_impl(
method="qubes-vm-update",
options=("--no-progress",),
expected_ret_codes=(1, 2, 5),
break_repo=True
expected_ret_codes=(23,),
break_repo=True,
expect_updated=False,
)


Expand Down