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

Bootstrap job for zapper-enabled test plan (New) #1352

Merged
merged 3 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_get_capabilities_one_cap(self, import_mock):

with patch("builtins.print") as mocked_print:
get_capabilities("0.0.0.0")
mocked_print.assert_called_once_with("foo: bar")
mocked_print.assert_called_once_with("foo: bar\n\navailable: True")

@patch("checkbox_support.scripts.zapper_proxy.import_module")
def test_get_capabilities_error(self, import_mock):
Expand All @@ -126,7 +126,7 @@ def test_get_capabilities_error(self, import_mock):

with patch("builtins.print") as mocked_print:
get_capabilities("0.0.0.0")
mocked_print.assert_called_once_with("")
mocked_print.assert_called_once_with("available: False")

@patch("checkbox_support.scripts.zapper_proxy.import_module")
def test_get_capabilities_empty(self, import_mock):
Expand All @@ -137,7 +137,7 @@ def test_get_capabilities_empty(self, import_mock):
self._mocked_conn.root.get_capabilities = Mock(return_value=ret_val)
with patch("builtins.print") as mocked_print:
get_capabilities("0.0.0.0")
mocked_print.assert_called_once_with("")
mocked_print.assert_called_once_with("available: True")

@patch("checkbox_support.scripts.zapper_proxy.import_module")
def test_get_capabilities_multiple_caps(self, import_mock):
Expand All @@ -154,7 +154,9 @@ def test_get_capabilities_multiple_caps(self, import_mock):

with patch("builtins.print") as mocked_print:
get_capabilities("0.0.0.0")
mocked_print.assert_called_once_with("foo: bar\n\nbaz: biz")
mocked_print.assert_called_once_with(
"foo: bar\n\nbaz: biz\n\navailable: True"
)

@patch("checkbox_support.scripts.zapper_proxy.import_module")
def test_get_capabilities_one_cap_multi_rows(self, import_mock):
Expand All @@ -171,7 +173,9 @@ def test_get_capabilities_one_cap_multi_rows(self, import_mock):

with patch("builtins.print") as mocked_print:
get_capabilities("0.0.0.0")
mocked_print.assert_called_once_with("foo: bar\nfoo2: bar2")
mocked_print.assert_called_once_with(
"foo: bar\nfoo2: bar2\n\navailable: True"
)

@patch("checkbox_support.scripts.zapper_proxy.zapper_run")
def test_main_run(self, mock_run):
Expand Down
3 changes: 2 additions & 1 deletion checkbox-support/checkbox_support/scripts/zapper_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ def get_capabilities(host):
"""Get Zapper capabilities."""
try:
capabilities = zapper_run(host, "get_capabilities")
capabilities.append({"available": True})
except SystemExit:
capabilities = []
capabilities = [{"available": False}]

def stringify_cap(cap):
return "\n".join(
Expand Down
9 changes: 9 additions & 0 deletions providers/base/units/zapper/resource.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ _description:
capable off.
environ: ZAPPER_HOST
command: checkbox-support-zapper-proxy get_capabilities

id: zapper_reset_setup
plugin: shell
requires: zapper_capabilities.available == 'True'
category_id: com.canonical.plainbox::info
_summary: Reset the Zapper environment to prevent it interfering with other test cases.
environ: ZAPPER_HOST
command: checkbox-support-zapper-proxy reset_testing_setup || { echo "Some jobs might be affected..."; true; }

2 changes: 1 addition & 1 deletion providers/base/units/zapper/test-plan.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ include:
bluetooth/zapper-a2dp
input/zapper-keyboard
monitor/zapper-edid
monitor/1_zapper_hdmi_.*
usb/zapper-usb-insert-.*
usb/zapper-usb-remove-.*
usb3/zapper-usb-insert-.*
usb3/zapper-usb-remove-.*
bootstrap_include:
zapper_capabilities
zapper_reset_setup
graphics_card
Loading