From nobody Wed May 14 16:05:04 2025 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 1534581753557566.1051620544802; Sat, 18 Aug 2018 01:42:33 -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 42AE936883; Sat, 18 Aug 2018 08:42:32 +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 2F404951C9; Sat, 18 Aug 2018 08:42:32 +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 23C32181A12D; Sat, 18 Aug 2018 08:42:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7I8dqHP013203 for ; Sat, 18 Aug 2018 04:39:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4165A103BAB4; Sat, 18 Aug 2018 08:39:52 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3A0C9101F94C for ; Sat, 18 Aug 2018 08:39:50 +0000 (UTC) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 56FED81DF0 for ; Sat, 18 Aug 2018 08:39:49 +0000 (UTC) Received: by mail-wr1-f41.google.com with SMTP id a108-v6so6258249wrc.13 for ; Sat, 18 Aug 2018 01:39:49 -0700 (PDT) Received: from donizetti.lan (dynamic-adsl-78-12-184-244.clienti.tiscali.it. [78.12.184.244]) by smtp.gmail.com with ESMTPSA id j39-v6sm4830677wre.44.2018.08.18.01.39.46 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Aug 2018 01:39:47 -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=muV9CxZ15xdB0yZxVfiGz96Pe3EJeHIDadEUntujvzs=; b=Cbkat6EIMubETuIKNFH4SWAbXtGS7k8BPYV1mQ9F/d21v2U3NNQmOsYiuVkXdN8fN0 BLALr/4u23KTgzNC6KYbbbY/S85gsTPETJj1aoORLNrELFlWR2ty5LZyD1h8EfJFlQC4 nrCKzfoBkEVKuRYatTLGj4FwX4KiIHKh6Z4kbNC1ymUYjaBWuro9rsh2FHFa5Pdt9zqq rs7U3TWE9G6ob+7qHk6pMznQ9B/oD6bLGC1Fw5fcFwbw0JbzehIZZBwk3Iya/PuvWXIh F+msBh4F+h9kbttrI4pGBxoG8eywMzUDSDuKJSZhRUVpH1a3c2qWbN3Cj85+8AbEpzHW khvw== 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=muV9CxZ15xdB0yZxVfiGz96Pe3EJeHIDadEUntujvzs=; b=lT2EXU1/7FpEvKHg/9gFsUutRiqRP7Tns2VXdFdMtJqgJt2mxMIvha1nPxcMBB1afa BieH6IepgGQz7N+lpkFNzvE/RhODDhhos3YLcFxkjaW8h+SKs318WDkgireIFoTFYk3e BgNVX/EKGF6tO0f3xvWg1wV5WLanXAC6gDQ+SWzGCMDUzj26ECpH5pBNr2v/nN2Y4GYw IUqY28+Y1h5GgMBIqBR18x3nDKORnzPcg3ZlOY92IwP3xOkySD6Wphst/tQa0IacQCZB yP1NyeEL8BLXhsTNRwkxIw6QJK1+gvboHO+TtZKA3RmicmLrk1vNno0UIEtBhwwUrpY8 NyvQ== X-Gm-Message-State: AOUpUlEJcG0FhoJQI6ZiRNGDNa2F9+Zu4XYQqNChlRFd6lYcJFBcMCgI TwK/BNoHx/hvQfVvdClBOaG/sswg X-Google-Smtp-Source: AA+uWPxVc7nQs6SMOExtr7wkUnRRIYtptn+4Vp+raFii/rA4VRksUlaDrV+Fb2yJeJmLHJ/OJck94Q== X-Received: by 2002:adf:d08c:: with SMTP id y12-v6mr24610782wrh.152.1534581587767; Sat, 18 Aug 2018 01:39:47 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Sat, 18 Aug 2018 10:39:37 +0200 Message-Id: <20180818083944.19692-3-pbonzini@redhat.com> In-Reply-To: <20180818083944.19692-1-pbonzini@redhat.com> References: <20180818083944.19692-1-pbonzini@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 18 Aug 2018 08:39:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 18 Aug 2018 08:39:49 +0000 (UTC) for IP:'209.85.221.41' DOMAIN:'mail-wr1-f41.google.com' HELO:'mail-wr1-f41.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.009 (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.221.41 mail-wr1-f41.google.com 209.85.221.41 mail-wr1-f41.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 2/9] testing: use ResultUpdate hook to set global testing properties 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.30]); Sat, 18 Aug 2018 08:42:32 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_0 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This will ensure that a PUT of a result will also set the properties, and n= ot just the testing-report API. The HEAD that was used for testing is now stored in the result, which is a good idea anyway. This requires a small change in the tests. Signed-off-by: Paolo Bonzini --- mods/testing.py | 15 ++++++++++----- tests/test_testing.py | 7 ++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/mods/testing.py b/mods/testing.py index ccdd336..0266fb9 100644 --- a/mods/testing.py +++ b/mods/testing.py @@ -123,6 +123,15 @@ class TestingModule(PatchewModule): self.recalc_pending_tests(obj) =20 def on_result_update(self, evt, obj, old_status, result): + if result.name.startswith("testing.") and result.status !=3D old_s= tatus: + if 'tester' in result.data: + po =3D obj if isinstance(obj, Project) else obj.project + _instance.tester_check_in(po, result.data['tester']) + if not self.get_testing_results(obj, + status__in=3D(Result.PENDING, Result.RUNNING)).= exists(): + obj.set_property("testing.done", True) + obj.set_property("testing.tested-head", result.data["head"= ]) + if result.name !=3D "git": return if isinstance(obj, Message) \ @@ -230,14 +239,11 @@ class TestingModule(PatchewModule): r =3D self.get_testing_result(obj, test) r.data =3D {"is_timeout": is_timeout, "user": user.username, + "head": head, "tester": tester or user.username} r.log =3D log r.status =3D Result.SUCCESS if passed else Result.FAILURE r.save() - if not self.get_testing_results(obj, - status__in=3D(Result.PENDING, Result.RUNNING)).exis= ts(): - obj.set_property("testing.done", True) - obj.set_property("testing.tested-head", head) =20 log_url =3D self.reverse_testing_log(obj, test, request=3Drequest) html_log_url =3D self.reverse_testing_log(obj, test, request=3Dreq= uest, html=3DTrue) @@ -476,7 +482,6 @@ class TestingReportView(APILoginRequiredView): def handle(self, request, tester, project, test, head, base, passed, log, identity, is_timeout=3DFalse): - _instance.tester_check_in(project, tester or request.user.username) _instance.add_test_report(request, project, tester, test, head, base, identity, passed, log, is_timeout) diff --git a/tests/test_testing.py b/tests/test_testing.py index 93aaf8b..c9452a4 100755 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -38,9 +38,14 @@ class TestingTestCase(PatchewTestCase, metaclass=3Dabc.A= BCMeta): r =3D obj.results.get(name=3D'testing.a') except: r =3D obj.create_result(name=3D'testing.a') - if not 'status' in kwargs: + if 'status' not in kwargs: kwargs['status'] =3D Result.PENDING =20 + if kwargs['status'] =3D=3D Result.SUCCESS or kwargs['status'] =3D= =3D Result.FAILURE: + if 'data' not in kwargs: + kwargs['data'] =3D {} + if 'head' not in kwargs['data']: + kwargs['data']['head'] =3D '0123456789abcdef' if len(kwargs): for k, v in kwargs.items(): setattr(r, k, v) --=20 2.17.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel