mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-03-12 03:41:08 +00:00
feat(cloud): Add verdict info for passed tests
Additional verdict info is being provided by the CloudPolicy to improve clarity on the state of cloud tests. When tests pass this will be marked in the verdict. Also when a package is skipped because it is not in the cloud package set this will be made clear in the verdict.
This commit is contained in:
parent
19515cea13
commit
22f865d7ae
@ -97,7 +97,12 @@ class CloudPolicy(BasePolicy):
|
||||
def apply_src_policy_impl(self, policy_info, item, source_data_tdist, source_data_srcdist, excuse):
|
||||
self.logger.info("Cloud Policy: Looking at {}".format(item.package))
|
||||
if item.package not in self.package_set:
|
||||
return PolicyVerdict.PASS
|
||||
verdict = PolicyVerdict.PASS
|
||||
excuse.add_verdict_info(
|
||||
verdict,
|
||||
"Cloud tests not required because package is not in the cloud package set."
|
||||
)
|
||||
return verdict
|
||||
|
||||
if self.dry_run:
|
||||
self.logger.info(
|
||||
@ -123,7 +128,9 @@ class CloudPolicy(BasePolicy):
|
||||
return verdict
|
||||
else:
|
||||
self._cleanup_work_directory()
|
||||
return PolicyVerdict.PASS
|
||||
verdict = PolicyVerdict.PASS
|
||||
excuse.add_verdict_info(verdict, "Cloud tests passed.")
|
||||
return verdict
|
||||
|
||||
def _mark_tests_run(self, package, version, series, source_type, cloud):
|
||||
"""Mark the selected package version as already tested.
|
||||
|
@ -11,12 +11,13 @@ import json
|
||||
import sys
|
||||
from types import SimpleNamespace
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, PROJECT_DIR)
|
||||
|
||||
from britney2.policies import PolicyVerdict
|
||||
from britney2.policies.cloud import CloudPolicy, ERR_MESSAGE, MissingURNException
|
||||
|
||||
class FakeItem:
|
||||
@ -143,7 +144,7 @@ class T(unittest.TestCase):
|
||||
self.policy.options.series = "jammy"
|
||||
|
||||
self.policy.apply_src_policy_impl(
|
||||
None, FakeItem, None, FakeSourceData, None
|
||||
None, FakeItem, None, FakeSourceData, MagicMock()
|
||||
)
|
||||
|
||||
mock_run.assert_called_once_with(
|
||||
@ -157,11 +158,12 @@ class T(unittest.TestCase):
|
||||
self.policy.package_set = set(["vim"])
|
||||
self.policy.options.series = "jammy"
|
||||
|
||||
self.policy.apply_src_policy_impl(
|
||||
None, FakeItem, None, FakeSourceData, None
|
||||
verdict = self.policy.apply_src_policy_impl(
|
||||
None, FakeItem, None, FakeSourceData, MagicMock()
|
||||
)
|
||||
|
||||
mock_run.assert_not_called()
|
||||
self.assertEqual(verdict, PolicyVerdict.PASS)
|
||||
|
||||
@patch("britney2.policies.cloud.smtplib")
|
||||
@patch("britney2.policies.cloud.CloudPolicy._run_cloud_tests")
|
||||
|
Loading…
x
Reference in New Issue
Block a user