From nobody Fri Oct 25 19:29:37 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; dkim=fail; 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 1521898658242527.6057008076398; Sat, 24 Mar 2018 06:37:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3FABF13AA9; Sat, 24 Mar 2018 13:37:37 +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 314CA18123; Sat, 24 Mar 2018 13:37:37 +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 22EEC181BA02; Sat, 24 Mar 2018 13:37:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2ODba5I031735 for ; Sat, 24 Mar 2018 09:37:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 357F79D9A3; Sat, 24 Mar 2018 13:37:36 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F6C15C261 for ; Sat, 24 Mar 2018 13:37:35 +0000 (UTC) Received: from mail-wr0-f175.google.com (mail-wr0-f175.google.com [209.85.128.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47D3587633 for ; Sat, 24 Mar 2018 13:37:34 +0000 (UTC) Received: by mail-wr0-f175.google.com with SMTP id m13so1357080wrj.5 for ; Sat, 24 Mar 2018 06:37:34 -0700 (PDT) Received: from donizetti.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id i78sm3854257wmc.32.2018.03.24.06.37.30 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 24 Mar 2018 06:37:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=Oav9YUaiH4j1c1gMLxcOi9gQ93ivsXrxEqOWQEBt/2U=; b=KaQyVBchrsqLNNZ3B2MhmqiO9r4DQA3s0/9CmJ2wgwXfUrJUde6WpD2eM9qHhWu3t9 1ch7fkEweANc2i3rbSS2E7WasiZQXV6evk3RhTAaUfZ2hnxEyrgiIPAqFz2kUSUBaNDi qYyPn1KKWUl5XtZ/AQNFrJ8zhK0KEfyGRxuSN+59AeY+crfyGzGyOgtqqtc5m6i6jM08 KGp6pf14nZNc7ejC0K0GDnAitQmx9FB4j3fHNl3yFdC4ttyzgkcl3wS7NpWh3IOdhCkZ gZkR7GxloSEOk1oMd3YVZd9h5N5d4xtgXGStyq3wgwiWvz6tcuwMSWxhCMbzMIzHjkN+ JPxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=Oav9YUaiH4j1c1gMLxcOi9gQ93ivsXrxEqOWQEBt/2U=; b=LPwVjpZMU+K1WzV5xqcMPJ+z1dCqOEXnpcsQGF5pHdYSKXip0B+Zm5ZQ8wq3pQf9dF Elg9k50v1yC36Emu5t/AAlrowj4yiCDdYks30TMoECWkxPY27bSF5xwruZ0eEtEep15v wC9xQD6kJOA6OKKX5Mi35I/Wy1TOobW4ehfYCtfmkxg19yB13BXT8L0OWlJRX0o2IjnM tnFCjRNHOMBchPBTAY+3Ep0HIiPkculRLgUP6MTQss0wtnk+HBOxLo8qE9wc8a4Ls8ko FTuRffRQFWK8WKOaulvzgRQ2IohUa2kYFC3RFLgEc4JTx5N5p5zjazMHpp9wFieaDU6r XAbg== X-Gm-Message-State: AElRT7Fc8qsaw50PsO9dvwZoJhGlbT4U0830g2nBmLJKl5uYFimwDXk1 FJHM+Gm+aIwqY9pSsxeL3NH6F6gE X-Google-Smtp-Source: AG47ELtAGtjYS7vGHmPFdwPIQMHp25WuPpt99XgHK36hnACPakshM2USyWaDjFmsKCY/QanU8YrGjg== X-Received: by 10.223.160.182 with SMTP id m51mr23902725wrm.187.1521898652369; Sat, 24 Mar 2018 06:37:32 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Sat, 24 Mar 2018 14:37:19 +0100 Message-Id: <20180324133719.6030-9-pbonzini@redhat.com> In-Reply-To: <20180324133719.6030-1-pbonzini@redhat.com> References: <20180324133719.6030-1-pbonzini@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 24 Mar 2018 13:37:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 24 Mar 2018 13:37:34 +0000 (UTC) for IP:'209.85.128.175' DOMAIN:'mail-wr0-f175.google.com' HELO:'mail-wr0-f175.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.488 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.128.175 mail-wr0-f175.google.com 209.85.128.175 mail-wr0-f175.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 8/8] testing: cover project tests 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 24 Mar 2018 13:37:37 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- tests/test_testing.py | 69 +++++++++++++++++++++++++++++++++++++++++++++--= ---- 1 file changed, 61 insertions(+), 8 deletions(-) diff --git a/tests/test_testing.py b/tests/test_testing.py index e525e1d..827d971 100755 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -30,6 +30,9 @@ class TestingTestCase(PatchewTestCase, metaclass=3Dabc.AB= CMeta): def setUp(self): self.create_superuser() self.p =3D self.add_project("QEMU", "qemu-devel@nongnu.org") + self.p.git =3D "dummy repo" + self.p.save() + self.PROJECT_BASE =3D '%sprojects/%d/' % (self.REST_BASE, self.p.i= d) =20 create_test(self.p, "a") @@ -158,15 +161,35 @@ class MessageTestingTest(TestingTestCase): return self.api_client.get('%sseries/%s/results/testing.%s/' % ( self.PROJECT_BASE, self.msg.message= _id, test_name)) =20 +class ProjectTestingTest(TestingTestCase): + + def setUp(self): + super(ProjectTestingTest, self).setUp() + self.p.set_property("git.head", "5678") + self.p.set_property("testing.tested-head", "1234") + self.p.set_property("testing.ready", 1) + + def do_testing_done(self, log=3DNone, **report): + self._do_testing_done(self.p, log, report) + + def do_testing_report(self, **report): + r =3D super(ProjectTestingTest, self).do_testing_report(**report) + self.assertEquals(r['type'], 'project') + return r + + def get_test_result(self, test_name): + return self.api_client.get('%sresults/testing.%s/' % ( + self.PROJECT_BASE, test_name)) + class TesterTest(PatchewTestCase): =20 def setUp(self): self.create_superuser() =20 - p1 =3D self.add_project("QEMU", "qemu-devel@nongnu.org") - create_test(p1, "a") - p2 =3D self.add_project("UMEQ", "qemu-devel@nongnu.org") - create_test(p2, "b") + self.p1 =3D self.add_project("QEMU", "qemu-devel@nongnu.org") + create_test(self.p1, "a") + self.p2 =3D self.add_project("UMEQ", "qemu-devel@nongnu.org") + create_test(self.p2, "b") =20 self.cli_login() self.cli_import('0001-simple-patch.mbox.gz') @@ -176,10 +199,9 @@ class TesterTest(PatchewTestCase): os.mkdir(self.repo) subprocess.check_output(["git", "init"], cwd=3Dself.repo) for f in ["foo", "bar"]: - subprocess.check_output(["touch", f], cwd=3Dself.repo) - subprocess.check_output(["git", "add", f], cwd=3Dself.repo) - subprocess.check_output(["git", "commit", "-m", "add " + f], - cwd=3Dself.repo) + self.add_file_and_commit(f) + self.update_head(self.p1) + self.update_head(self.p2) base =3D subprocess.check_output(["git", "rev-parse", "HEAD~1"], cwd=3Dself.repo).decode() subprocess.check_output(["git", "tag", "test"], cwd=3Dself.repo) @@ -189,6 +211,17 @@ class TesterTest(PatchewTestCase): msg.set_property("git.tag", "test") msg.set_property("git.base", base) =20 + def add_file_and_commit(self, f): + subprocess.check_output(["touch", f], cwd=3Dself.repo) + subprocess.check_output(["git", "add", f], cwd=3Dself.repo) + subprocess.check_output(["git", "commit", "-m", "add " + f], + cwd=3Dself.repo) + + def update_head(self, p): + head =3D subprocess.check_output(["git", "rev-parse", "HEAD"], + cwd=3Dself.repo).decode() + p.set_property("git.head", head) + def test_tester(self): self.cli_login() out, err =3D self.check_cli(["tester", "-p", "QEMU,UMEQ", @@ -210,6 +243,26 @@ class TesterTest(PatchewTestCase): self.assertIn("Nothing to test", out) self.cli_logout() =20 + def test_tester_project(self): + self.cli_login() + out, err =3D self.check_cli(["tester", "-p", "QEMU,UMEQ", + "--no-wait"]) + self.assertIn("Project: QEMU\n", out) + self.assertIn("Project: UMEQ\n", out) + + self.p1.git =3D self.repo + self.p1.save() + self.add_file_and_commit("baz") + self.update_head(self.p1) + out, err =3D self.check_cli(["tester", "-p", "QEMU,UMEQ", + "--no-wait", "-N", "1"]) + self.assertIn("Project: QEMU\n", out) + self.assertIn("'type': 'project'", out) + out, err =3D self.check_cli(["tester", "-p", "QEMU,UMEQ", + "--no-wait", "-N", "1"]) + self.assertIn("Nothing to test", out) + self.cli_logout() + # do not run tests on the abstract class del TestingTestCase =20 --=20 2.16.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel