From e944f23834ced2514eba535204954e820a0be7f0 Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Tue, 12 Nov 2019 23:46:30 +0000 Subject: [PATCH] autopkgtest: store the submission time when making requests This is so that we can see more easily see if requests are stuck --- britney2/policies/autopkgtest.py | 2 ++ tests/test_autopkgtest.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/britney2/policies/autopkgtest.py b/britney2/policies/autopkgtest.py index e248208..bf296cb 100644 --- a/britney2/policies/autopkgtest.py +++ b/britney2/policies/autopkgtest.py @@ -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: diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 780f402..b0eb247 100644 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -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