From nobody Fri Apr 26 12:23:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521110970289814.8257518976927; Thu, 15 Mar 2018 03:49:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C696C045114; Thu, 15 Mar 2018 10:49:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 112DA6313D; Thu, 15 Mar 2018 10:49:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 076A8181B9FB; Thu, 15 Mar 2018 10:49:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2FAm8aI032665 for ; Thu, 15 Mar 2018 06:48:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 58BAC2026E0E; Thu, 15 Mar 2018 10:48:08 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-246.ams2.redhat.com [10.36.117.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id DECB42026DFD for ; Thu, 15 Mar 2018 10:48:07 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Thu, 15 Mar 2018 11:48:07 +0100 Message-Id: <20180315104807.16030-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] fix test report event, and add test case X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 15 Mar 2018 10:49:29 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The newly added TesterTest found a problem. Fix it, and add a lower-level test case that is easier to debug. --- mods/testing.py | 2 ++ tests/test_testing.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/mods/testing.py b/mods/testing.py index 322ba37..24bd509 100644 --- a/mods/testing.py +++ b/mods/testing.py @@ -111,6 +111,8 @@ class TestingModule(PatchewModule): passed=3D"True if the test is passed", test=3D"test name", log=3D"test log", + log_url=3D"URL to test log (text)", + html_log_url=3D"URL to test log (HTML)", is_timeout=3D"whether the test has timeout") register_handler("SetProperty", self.on_set_property) =20 diff --git a/tests/test_testing.py b/tests/test_testing.py index a68e237..0d7e316 100755 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -53,6 +53,30 @@ class TestingTest(PatchewTestCase): self.msg.set_property("testing.done", True) self.msg.set_property("testing.ready", None) =20 + def msg_testing_report(self, **report): + self.api_login() + r =3D self.api_call("testing-get", + project=3D"QEMU", + tester=3D"dummy tester", + capabilities=3D[]) + self.assertEquals(r['identity']['type'], 'series') + + report['project'] =3D r["project"] + report['identity'] =3D r["identity"] + report['test'] =3D r["test"]["name"] + report['tester'] =3D 'dummy_tester' + report['head'] =3D r["head"] + report['base'] =3D r["base"] + if not 'passed' in report: + report['passed'] =3D True + if not 'log' in report: + report['log'] =3D None + if not 'is_timeout' in report: + report['is_timeout'] =3D False + + self.api_call("testing-report", **report) + return r['identity']['message-id'] + def test_basic(self): self.api_login() td =3D self.api_call("testing-get", @@ -90,6 +114,24 @@ class TestingTest(PatchewTestCase): self.assertEquals(log.status_code, 200) self.assertEquals(log.content, b'sorry no good') =20 + def test_api_report_success(self): + self.api_login() + msgid =3D self.msg_testing_report(log=3D'everything good!', passed= =3DTrue) + resp =3D self.api_client.get(self.PROJECT_BASE + 'series/' + self.= msg.message_id + '/') + self.assertEquals(resp.data['results']['testing.a']['status'], 'su= ccess') + log =3D self.client.get(resp.data['results']['testing.a']['log_url= ']) + self.assertEquals(log.status_code, 200) + self.assertEquals(log.content, b'everything good!') + + def test_api_report_failure(self): + self.api_login() + msgid =3D self.msg_testing_report(log=3D'sorry no good', passed=3D= False) + resp =3D self.api_client.get(self.PROJECT_BASE + 'series/' + self.= msg.message_id + '/') + self.assertEquals(resp.data['results']['testing.a']['status'], 'fa= ilure') + log =3D self.client.get(resp.data['results']['testing.a']['log_url= ']) + self.assertEquals(log.status_code, 200) + self.assertEquals(log.content, b'sorry no good') + class TesterTest(PatchewTestCase): =20 def setUp(self): --=20 2.14.3 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel