From nobody Fri Apr 19 13:55:29 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 1532698748481548.9356952179979; Fri, 27 Jul 2018 06:39:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 387DF3086275; Fri, 27 Jul 2018 13:39:07 +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 2AB73600C8; Fri, 27 Jul 2018 13:39:07 +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 1C03118037EC; Fri, 27 Jul 2018 13:39:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6RDd5Ac014121 for ; Fri, 27 Jul 2018 09:39:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9F1F17C49; Fri, 27 Jul 2018 13:39:05 +0000 (UTC) Received: from lemon.usersys.redhat.com (ovpn-12-22.pek2.redhat.com [10.72.12.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A9531C5B0; Fri, 27 Jul 2018 13:39:03 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Fri, 27 Jul 2018 21:38:50 +0800 Message-Id: <20180727133851.4181-2-famz@redhat.com> In-Reply-To: <20180727133851.4181-1-famz@redhat.com> References: <20180727133851.4181-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 1/2] testing: Fix resetting one test 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 27 Jul 2018 13:39:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The testing-reset link was broken. All results will be cleared because we forgot to match the test name parameter. Suggested-by: Paolo Bonzini Signed-off-by: Fam Zheng --- mods/testing.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mods/testing.py b/mods/testing.py index 82b8c80..ccdd336 100644 --- a/mods/testing.py +++ b/mods/testing.py @@ -164,8 +164,13 @@ class TestingModule(PatchewModule): if k =3D=3D "testing.done" or \ k =3D=3D "testing.tested-head": obj.set_property(k, None) - for r in self.get_testing_results(obj): - r.delete() + if test: + r =3D self.get_testing_result(obj, test) + if r: + r.delete() + else: + for r in self.get_testing_results(obj): + r.delete() self.recalc_pending_tests(obj) =20 def www_view_testing_reset(self, request, project_or_series): --=20 2.17.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel From nobody Fri Apr 19 13:55:29 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 1532698750266450.40570425474516; Fri, 27 Jul 2018 06:39:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 115D781DF0; Fri, 27 Jul 2018 13:39:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 01D5CCE920; Fri, 27 Jul 2018 13:39:09 +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 E99484A460; Fri, 27 Jul 2018 13:39:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6RDd79X014133 for ; Fri, 27 Jul 2018 09:39:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id BBB641C5B0; Fri, 27 Jul 2018 13:39:07 +0000 (UTC) Received: from lemon.usersys.redhat.com (ovpn-12-22.pek2.redhat.com [10.72.12.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A99F7C49; Fri, 27 Jul 2018 13:39:06 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Fri, 27 Jul 2018 21:38:51 +0800 Message-Id: <20180727133851.4181-3-famz@redhat.com> In-Reply-To: <20180727133851.4181-1-famz@redhat.com> References: <20180727133851.4181-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 2/2] tests: Test testing-reset 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 27 Jul 2018 13:39:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" WARNING: too many "tests" in the subject. Signed-off-by: Fam Zheng --- tests/test_testing.py | 54 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/tests/test_testing.py b/tests/test_testing.py index 7a40ec3..1284498 100755 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -16,11 +16,11 @@ sys.path.append(os.path.dirname(__file__)) from tests.patchewtest import PatchewTestCase, main from api.models import Message, Result =20 -def create_test(project, name, requirements=3D""): +def create_test(project, name, requirements=3D"", script=3D"#!/bin/bash\nt= rue"): prefix =3D "testing.tests." + name + "." project.set_property(prefix + "timeout", 3600) project.set_property(prefix + "enabled", True) - project.set_property(prefix + "script", "#!/bin/bash\ntrue") + project.set_property(prefix + "script", script) project.set_property(prefix + "requirements", requirements) =20 class TestingTestCase(PatchewTestCase, metaclass=3Dabc.ABCMeta): @@ -285,6 +285,56 @@ class TesterTest(PatchewTestCase): self.assertIn("Nothing to test", out) self.cli_logout() =20 +class TestingResetTest(PatchewTestCase): + + def setUp(self): + self.create_superuser() + + self.repo =3D self.create_git_repo("repo") + + self.p1 =3D self.add_project("QEMU", "qemu-devel@nongnu.org") + create_test(self.p1, "a") + create_test(self.p1, "b") + create_test(self.p1, "c", script=3D"#!/bin/bash\nfalse") + + def verify_results(self, m, results): + for r in m.results.filter(): + self.assertEqual(r.status, results[r.name]) + + def test_reset_one(self): + self.cli_login() + self.cli_import('0013-foo-patch.mbox.gz') + self.do_apply() + out, err =3D self.check_cli(["tester", "-p", "QEMU", "--no-wait"]) + self.assertIn("Project: QEMU\n", out) + self.cli_logout() + + msg =3D Message.objects.all()[0] + self.verify_results(msg, {"git": Result.SUCCESS, + "testing.a": Result.SUCCESS, + "testing.b": Result.SUCCESS, + "testing.c": Result.FAILURE}) + self.assertTrue(msg.get_property("testing.done")) + + self.api_login() + self.client.post('/login/', {'username': self.user, 'password': se= lf.password}) + self.client.get('/testing-reset/%s/?type=3Dmessage&test=3Da' % msg= .message_id) + + msg =3D Message.objects.all()[0] + self.verify_results(msg, {"git": Result.SUCCESS, + "testing.a": Result.PENDING, + "testing.b": Result.SUCCESS, + "testing.c": Result.FAILURE}) + self.assertFalse(msg.get_property("testing.done")) + + self.client.get('/testing-reset/%s/?type=3Dmessage&test=3Db' % msg= .message_id) + self.client.get('/testing-reset/%s/?type=3Dmessage&test=3Dc' % msg= .message_id) + self.verify_results(msg, {"git": Result.SUCCESS, + "testing.a": Result.PENDING, + "testing.b": Result.PENDING, + "testing.c": Result.PENDING}) + self.assertFalse(msg.get_property("testing.done")) + # do not run tests on the abstract class del TestingTestCase =20 --=20 2.17.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel