Skip to content

Commit

Permalink
updater: updaate dom0 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed Jun 24, 2024
1 parent 91bd5c4 commit ceec6a0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
14 changes: 9 additions & 5 deletions qui/updater/intro_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,15 @@ def _handle_cli_dom0(dom0, to_update, cliargs):
default_select = not any(
(getattr(cliargs, arg)
for arg in cliargs.non_default_select if arg != 'all'))
if (default_select or cliargs.all or cliargs.dom0) and (
cliargs.force_update
or bool(dom0.features.get('updates-available', False))
or is_stale(dom0, cliargs.update_if_stale)
):
if ((
default_select and cliargs.non_interactive
or cliargs.all
or cliargs.dom0
) and (
cliargs.force_update
or bool(dom0.features.get('updates-available', False))
or is_stale(dom0, cliargs.update_if_stale)
)):
to_update.add('dom0')

if cliargs.targets and "dom0" in cliargs.targets.split(","):
Expand Down
12 changes: 8 additions & 4 deletions qui/updater/tests/test_intro_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,18 @@ def test_on_checkbox_toggled(
# `qubes-update-gui --all`
# Target all updatable VMs (AdminVM, TemplateVMs and StandaloneVMs)
pytest.param(
('--all',), ",".join(_tmpls_and_stndas).encode(),
",".join(_derived_qubes).encode(), _non_derived_qubes, ('--all',),
('--all', '--force-update'),
",".join(_tmpls_and_stndas).encode(),
",".join(_derived_qubes).encode(), _non_derived_qubes,
('--all', '--force-update'),
id="all"),
# `qubes-update-gui --update-if-stale 10`
# Target all TemplateVMs and StandaloneVMs with known updates or for
# which last update check was more than <10> days ago.
pytest.param(
('--non-interactive', '--update-if-stale', '10'),
b'fedora-36', b'', {'fedora-36'}, ('--update-if-stale', '10'),
b'fedora-36', b'', {'fedora-36', 'dom0'},
('--update-if-stale', '10'),
id="if-stale"),
# `qubes-update-gui --targets dom0,fedora-36`
# Comma separated list of VMs to target
Expand All @@ -205,7 +208,8 @@ def test_on_checkbox_toggled(
id="standalones"),
# `qubes-update-gui --dom0`
# Target dom0
pytest.param(('--dom0',), b'', b'', {'dom0'}, None, id="dom0"),
pytest.param(('--dom0', '--force-update'), b'', b'', {'dom0'},
None, id="dom0"),
# `qubes-update-gui --dom0 --skip dom0`
# Comma separated list of VMs to be skipped,
# works with all other options.
Expand Down

0 comments on commit ceec6a0

Please sign in to comment.