SRU ADT regression: use the right policy_info to determine if tests have regressed.

master
Łukasz 'sil2100' Zemczak 5 years ago
parent 879e7e1088
commit 32467742bd

@ -74,16 +74,16 @@ class SRUADTRegressionPolicy(BasePolicy, Rest):
return PolicyVerdict.PASS
# Check the policy_info to see if all tests finished and, if yes, if we
# have any failures to report on.
if not policy_info or 'autopkgtest' not in policy_info:
if 'autopkgtest' not in excuse.policy_info:
return PolicyVerdict.PASS
regressions = defaultdict(list)
for pkg in policy_info['autopkgtest']:
for arch in policy_info['autopkgtest'][pkg]:
if policy_info['autopkgtest'][pkg][arch][0] == 'RUNNING':
for pkg in excuse.policy_info['autopkgtest']:
for arch in excuse.policy_info['autopkgtest'][pkg]:
if excuse.policy_info['autopkgtest'][pkg][arch][0] == 'RUNNING':
# If there's at least one test still running, we just stop
# and not proceed any further.
return PolicyVerdict.PASS
elif policy_info['autopkgtest'][pkg][arch][0] == 'REGRESSION':
elif excuse.policy_info['autopkgtest'][pkg][arch][0] == 'REGRESSION':
regressions[pkg].append(arch)
if not regressions:
return PolicyVerdict.PASS

@ -236,7 +236,7 @@ class T(unittest.TestCase):
pol = SRUADTRegressionPolicy(options, {})
# Set a base state
pol.state = previous_state
status = pol.apply_policy_impl(excuse.policy_info, None, 'testpackage', None, FakeSourceData, excuse)
status = pol.apply_policy_impl(None, None, 'testpackage', None, FakeSourceData, excuse)
self.assertEqual(status, PolicyVerdict.PASS)
# Assert that we were looking for the right package as per
# FakeSourceData contents
@ -307,7 +307,7 @@ class T(unittest.TestCase):
excuse = FakeExcuseRunning
pol = SRUADTRegressionPolicy(options, {})
status = pol.apply_policy_impl(excuse.policy_info, None, 'testpackage', None, FakeSourceData, excuse)
status = pol.apply_policy_impl(None, None, 'testpackage', None, FakeSourceData, excuse)
self.assertEqual(status, PolicyVerdict.PASS)
bugs_from_changes.assert_not_called()
lp.assert_not_called()
@ -328,7 +328,7 @@ class T(unittest.TestCase):
excuse = FakeExcusePass
pol = SRUADTRegressionPolicy(options, {})
status = pol.apply_policy_impl(excuse.policy_info, None, 'testpackage', None, FakeSourceData, excuse)
status = pol.apply_policy_impl(None, None, 'testpackage', None, FakeSourceData, excuse)
self.assertEqual(status, PolicyVerdict.PASS)
bugs_from_changes.assert_not_called()
lp.assert_not_called()
@ -348,7 +348,7 @@ class T(unittest.TestCase):
excuse = FakeExcuseHinted
pol = SRUADTRegressionPolicy(options, {})
status = pol.apply_policy_impl(excuse.policy_info, None, 'testpackage', None, FakeSourceData, excuse)
status = pol.apply_policy_impl(None, None, 'testpackage', None, FakeSourceData, excuse)
self.assertEqual(status, PolicyVerdict.PASS)
bugs_from_changes.assert_not_called()
lp.assert_not_called()
@ -378,7 +378,7 @@ class T(unittest.TestCase):
pol = SRUADTRegressionPolicy(options, {})
# Set a base state
pol.state = previous_state
status = pol.apply_policy_impl(excuse.policy_info, None, 'testpackage', None, FakeSourceData, excuse)
status = pol.apply_policy_impl(None, None, 'testpackage', None, FakeSourceData, excuse)
self.assertEqual(status, PolicyVerdict.PASS)
bugs_from_changes.assert_not_called()
lp.assert_not_called()
@ -405,7 +405,7 @@ class T(unittest.TestCase):
# - better to have an explicit test case for it.
excuse = FakeExcuseVerdictOverriden
pol = SRUADTRegressionPolicy(options, {})
status = pol.apply_policy_impl(excuse.policy_info, None, 'testpackage', None, FakeSourceData, excuse)
status = pol.apply_policy_impl(None, None, 'testpackage', None, FakeSourceData, excuse)
self.assertEqual(status, PolicyVerdict.PASS)
bugs_from_changes.assert_not_called()
lp.assert_not_called()
@ -493,7 +493,7 @@ class T(unittest.TestCase):
pol = SRUADTRegressionPolicy(options, {}, dry_run=True)
# Set a base state
pol.state = previous_state
status = pol.apply_policy_impl(excuse.policy_info, None, 'testpackage', None, FakeSourceData, excuse)
status = pol.apply_policy_impl(None, None, 'testpackage', None, FakeSourceData, excuse)
self.assertEqual(status, PolicyVerdict.PASS)
# Assert that we were looking for the right package as per
# FakeSourceData contents

Loading…
Cancel
Save