Skip to content

Commit

Permalink
Bootstrap job for zapper-enabled test plan (New) (#1352)
Browse files Browse the repository at this point in the history
* Add: zapper reset bootstrap job

* Fix: removed deprecated zapper-enabled job
  • Loading branch information
p-gentili committed Jul 25, 2024
1 parent 69a4b09 commit 9a1afd7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
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

0 comments on commit 9a1afd7

Please sign in to comment.