Enable no-penalties urgencies; to exempt urgency >= high from penalties

ubuntu/rebased
Paul Gevers 7 years ago
parent be5a378da5
commit 77ea1cc8d5
No known key found for this signature in database
GPG Key ID: 9C5C99EB05BD750A

@ -51,6 +51,7 @@ MINDAYS_HIGH = 2
MINDAYS_CRITICAL = 0
MINDAYS_EMERGENCY = 0
DEFAULT_URGENCY = medium
NO_PENALTIES = high critical emergency
HINTSDIR = /srv/release.debian.org/britney/hints

@ -285,10 +285,12 @@ class AgePolicy(BasePolicy):
self.log('Applying bounty for %s granted by %s: %d days' %
(source_name, bounty, excuse.bounty[bounty]))
min_days -= excuse.bounty[bounty]
for penalty in excuse.penalty:
self.log('Applying penalty for %s given by %s: %d days' %
(source_name, penalty, excuse.penalty[penalty]))
min_days += excuse.penalty[penalty]
if not hasattr(self.options, 'no_penalties') or \
urgency not in self.options.no_penalties:
for penalty in excuse.penalty:
self.log('Applying penalty for %s given by %s: %d days' %
(source_name, penalty, excuse.penalty[penalty]))
min_days += excuse.penalty[penalty]
age_info['age-requirement'] = min_days
age_info['current-age'] = days_old

@ -367,6 +367,7 @@ MINDAYS_HIGH = 0
MINDAYS_CRITICAL = 0
MINDAYS_EMERGENCY = 0
DEFAULT_URGENCY = medium
NO_PENALTIES = high critical emergency
HINTSDIR = data/hints

@ -2528,6 +2528,43 @@ class T(TestBase):
# instead, it should cause the age to sky-rocket
self.assertEqual(exc['green']['policy_info']['age']['age-requirement'], 40)
def test_multi_rdepends_with_tests_no_penalty(self):
'''Check that penalties are not applied for "urgency >= high"'''
# Don't use policy verdics, but age packages appropriate
for line in fileinput.input(self.britney_conf, inplace=True):
if line.startswith('MINDAYS_MEDIUM'):
print('MINDAYS_MEDIUM = 13')
elif line.startswith('ADT_SUCCESS_BOUNTY'):
print('ADT_SUCCESS_BOUNTY = 6')
elif line.startswith('ADT_REGRESSION_PENALTY'):
print('ADT_REGRESSION_PENALTY = 27')
elif line.startswith('NO_PENALTIES'):
print('NO_PENALTIES = medium')
else:
sys.stdout.write(line)
self.data.add_default_packages(green=False)
self.swift.set_results({'autopkgtest-testing': {
'testing/i386/d/darkgreen/20150101_100000@': (0, 'darkgreen 1', tr('green/2')),
'testing/amd64/l/lightgreen/20150101_100100@': (0, 'lightgreen 1', tr('green/1')),
'testing/amd64/l/lightgreen/20150101_100101@': (4, 'lightgreen 1', tr('green/2')),
'testing/i386/g/green/20150101_100200@': (0, 'green 2', tr('green/2')),
'testing/amd64/g/green/20150101_100201@': (4, 'green 2', tr('green/2')),
}})
exc = self.do_test(
[('libgreen1', {'Version': '2', 'Source': 'green', 'Depends': 'libc6'}, 'autopkgtest')],
{'green': (False, {'green/2': {'amd64': 'ALWAYSFAIL', 'i386': 'PASS'},
'lightgreen/1': {'amd64': 'REGRESSION', 'i386': 'RUNNING-ALWAYSFAIL'},
'darkgreen/1': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'PASS'},
})
})[1]
# age-requirement should remain the same despite regression
self.assertEqual(exc['green']['policy_info']['age']['age-requirement'], 13)
def test_passing_package_receives_bounty(self):
'''Does not request a test for an uninstallable package'''

Loading…
Cancel
Save