From 177c7a69f7f920b1178b8c2f5b26259fa9df0b8b Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Thu, 16 Jan 2020 10:13:41 +0000 Subject: [PATCH] test_autopkgtest: Strip submit-time Testsuite regression from 4c27eadffa01bc1c084e947a7fa1e8a7509d1653. submit-time is the time the request was submitted to amqp. For tests it's the time the testcase was run. Many of our testcases test the exact parameters that were passed to amqp, so they now fail because submit-time is in there but it's not being checked for. It would be possible to either verify the submit-time too, or switch to fuzzy matching - but it's actually not very valuable to test submit-time, since it is only for human readers of autopkgtest-cloud log files or autopkgtest.ubuntu.com/running. Instead strip the field from the amqp parameters before any tests see them. --- tests/test_autopkgtest.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 3fbba9d..3152270 100755 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -171,7 +171,14 @@ class T(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