mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-23 00:11:32 +00:00
Merge remote-tracking branch 'origin/fix-tests'
This commit is contained in:
commit
356d9ceee4
@ -2,6 +2,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
|
from collections import defaultdict
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
import apt_pkg
|
import apt_pkg
|
||||||
@ -699,6 +700,7 @@ class LPBlockBugPolicy(BasePolicy):
|
|||||||
|
|
||||||
return PolicyVerdict.REJECTED_PERMANENTLY
|
return PolicyVerdict.REJECTED_PERMANENTLY
|
||||||
|
|
||||||
|
|
||||||
class LPExcuseBugsPolicy(BasePolicy):
|
class LPExcuseBugsPolicy(BasePolicy):
|
||||||
"""update-excuse Launchpad bug policy to link to a bug report, does not prevent migration
|
"""update-excuse Launchpad bug policy to link to a bug report, does not prevent migration
|
||||||
|
|
||||||
@ -716,26 +718,25 @@ class LPExcuseBugsPolicy(BasePolicy):
|
|||||||
|
|
||||||
def initialise(self, britney):
|
def initialise(self, britney):
|
||||||
super().initialise(britney)
|
super().initialise(britney)
|
||||||
self.excuse_bugs = {} # srcpkg -> [(bug, date), ...]
|
self.excuse_bugs = defaultdict(list) # srcpkg -> [(bug, date), ...]
|
||||||
|
|
||||||
filename = os.path.join(self.options.unstable, "ExcuseBugs")
|
filename = os.path.join(self.options.unstable, "ExcuseBugs")
|
||||||
self.log("Loading user-supplied excuse bug data from %s" % filename)
|
self.log("Loading user-supplied excuse bug data from %s" % filename)
|
||||||
for line in open(filename):
|
try:
|
||||||
l = line.split()
|
for line in open(filename):
|
||||||
if len(l) != 3:
|
l = line.split()
|
||||||
self.log("ExcuseBugs, ignoring malformed line %s" % line, type='W')
|
if len(l) != 3:
|
||||||
continue
|
self.log("ExcuseBugs, ignoring malformed line %s" % line, type='W')
|
||||||
try:
|
continue
|
||||||
self.excuse_bugs.setdefault(l[0], [])
|
try:
|
||||||
self.excuse_bugs[l[0]].append((l[1], int(l[2])))
|
self.excuse_bugs[l[0]].append((l[1], int(l[2])))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.log("ExcuseBugs, unable to parse \"%s\"" % line, type='E')
|
self.log("ExcuseBugs, unable to parse \"%s\"" % line, type='E')
|
||||||
|
except FileNotFoundError:
|
||||||
|
self.log("ExcuseBugs, data file not found, no bugs will be recorded" % filename)
|
||||||
|
|
||||||
def apply_policy_impl(self, excuse_bugs_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse):
|
def apply_policy_impl(self, excuse_bugs_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse):
|
||||||
try:
|
excuse_bug = self.excuse_bugs[source_name]
|
||||||
excuse_bug = self.excuse_bugs[source_name]
|
|
||||||
except KeyError:
|
|
||||||
return PolicyVerdict.PASS
|
|
||||||
|
|
||||||
for bug, date in excuse_bug:
|
for bug, date in excuse_bug:
|
||||||
excuse_bugs_info[bug] = date
|
excuse_bugs_info[bug] = date
|
||||||
|
@ -171,7 +171,14 @@ class T(TestBase):
|
|||||||
try:
|
try:
|
||||||
with open(self.fake_amqp) as f:
|
with open(self.fake_amqp) as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
self.amqp_requests.add(line.strip())
|
# debci-series-amd64:darkgreen {"triggers": ["darkgreen/2"], "submit-time": "2020-01-16 09:47:12"}
|
||||||
|
# strip the submit time from the requests we're testing; it
|
||||||
|
# is only for info for people reading the queue
|
||||||
|
(queuepkg, data) = line.split(' ', 1)
|
||||||
|
data_json = json.loads(data)
|
||||||
|
del data_json["submit-time"]
|
||||||
|
self.amqp_requests.add("{} {}".format(queuepkg,
|
||||||
|
json.dumps(data_json)))
|
||||||
os.unlink(self.fake_amqp)
|
os.unlink(self.fake_amqp)
|
||||||
except IOError:
|
except IOError:
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user