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

fix-tests
Łukasz 'sil2100' Zemczak 5 years ago
parent 879e7e1088
commit 32467742bd

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

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

Loading…
Cancel
Save