autopkgtest: store the submission time when making requests

This is so that we can see more easily see if requests are stuck
This commit is contained in:
Iain Lane 2019-11-12 23:46:30 +00:00
parent 06e8f598ba
commit 55b5dd4aab
No known key found for this signature in database
GPG Key ID: E352D5C51C5041D4
2 changed files with 10 additions and 1 deletions

View File

@ -19,6 +19,7 @@
import calendar import calendar
import collections import collections
from copy import deepcopy from copy import deepcopy
from datetime import datetime
from enum import Enum from enum import Enum
import os import os
import json import json
@ -961,6 +962,7 @@ class AutopkgtestPolicy(BasePolicy):
qname = 'debci-huge-%s-%s' % (self.options.series, arch) qname = 'debci-huge-%s-%s' % (self.options.series, arch)
else: else:
qname = 'debci-%s-%s' % (self.options.series, arch) 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) params = json.dumps(params)
if self.amqp_channel: if self.amqp_channel:

View File

@ -153,7 +153,14 @@ class TestAutopkgtestBase(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