autopkgtest: store the submission time when making requests

This is so that we can see more easily see if requests are stuck
wip/linux-policy
Iain Lane 5 years ago
parent 77ee66fcb3
commit e944f23834

@ -19,6 +19,7 @@
import calendar
import collections
from copy import deepcopy
from datetime import datetime
from enum import Enum
import os
import json
@ -961,6 +962,7 @@ class AutopkgtestPolicy(BasePolicy):
qname = 'debci-huge-%s-%s' % (self.options.series, arch)
else:
qname = 'debci-%s-%s' % (self.options.series, arch)
params['submit-time'] = datetime.strftime(datetime.utcnow(), '%Y-%m-%d %H:%M:%S%z')
params = json.dumps(params)
if self.amqp_channel:

@ -153,7 +153,14 @@ class TestAutopkgtestBase(TestBase):
try:
with open(self.fake_amqp) as 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)
except IOError:
pass

Loading…
Cancel
Save