From patchwork Mon Oct 30 19:51:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 33116 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAA5DC4167B for ; Mon, 30 Oct 2023 19:51:44 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.159185.1698695502289666212 for ; Mon, 30 Oct 2023 12:51:42 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=FdzH+4qu; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id A05F99C332F for ; Mon, 30 Oct 2023 15:51:41 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id mK6LKwhkWo4F; Mon, 30 Oct 2023 15:51:41 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 30F359C113C; Mon, 30 Oct 2023 15:51:41 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 30F359C113C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1698695501; bh=cubH3MRaAVO5vupGVR+sNvHO6ZC5u9ghm5HvtaTi7+I=; h=From:To:Date:Message-Id:MIME-Version; b=FdzH+4qu9Vyoga1q1gvqd0VGRtjriUQYj32DcVDIpeEpdDz9hzpFTOJrG0xCMJrEV ZJK8WF4qHkf9hKq+eAEG6iQO/Gq03IlIUXeqPU6maCxzUGAZXvI8DH6FMGBNBYuvje LUbm+qkAwD/+AeRQR4AoexNFPb4b3ufOXR8ClYgRqA9+1YVnUE0kpmSPularOpLE5D WS1xzAuNcx7QgpwZe1qFRL9eaSpD0/35PsJzenk+48G0pJlMer9q6zHWmPfNg56ako UEI1thy9UAQwuRnLkOd+Eb1j9rP5rcpsBGbKHgLHJN8xbLsGHa4PuCxgMTjDD/hb7A FynvtTybZ9waQ== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id sOxamjRillVg; Mon, 30 Oct 2023 15:51:41 -0400 (EDT) Received: from localhost.localdomain (unknown [192.168.51.254]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 490729C0C3C; Mon, 30 Oct 2023 15:51:40 -0400 (EDT) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH 1/8] Toaster: Update toaster-requirements.txt to add pytest and some plugin's Date: Mon, 30 Oct 2023 20:51:25 +0100 Message-Id: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 30 Oct 2023 19:51:44 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/5904 The pytest framework makes it easy to write small, readable tests, and can scale to support complex functional testing for applications and libraries. - Pytest-html is a plugin for pytest that generates a HTML report for test results. - Pytest-django allows us to test Django project/applications with the pytest testing tool. - Pytest-env is a pytest plugin that enables us to set environment variables in a pytest.ini or pyproject.toml file Signed-off-by: Alassane Yattara --- toaster-requirements.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/toaster-requirements.txt b/toaster-requirements.txt index d8e48b7f..19bf6fd2 100644 --- a/toaster-requirements.txt +++ b/toaster-requirements.txt @@ -2,3 +2,8 @@ Django>4.2,<4.3 beautifulsoup4>=4.4.0 pytz django-log-viewer==1.1.7 +pytest==7.4.2 +pytest-django==4.5.2 +pytest-env==1.1.0 +pytest-html==4.0.2 +pytest-metadata==3.0.0 From patchwork Mon Oct 30 19:51:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 33115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00B3CC00142 for ; Mon, 30 Oct 2023 19:51:45 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.159186.1698695503468368314 for ; Mon, 30 Oct 2023 12:51:43 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=pTuXBAh3; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id D281F9C334C for ; Mon, 30 Oct 2023 15:51:42 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id F1u-NuMkzOKG; Mon, 30 Oct 2023 15:51:42 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 5E6E19C2BF6; Mon, 30 Oct 2023 15:51:42 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 5E6E19C2BF6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1698695502; bh=BJJCHJagV8wWB7OftgGDU0y8IUJUDqTzkxwOyUfE7YE=; h=From:To:Date:Message-Id:MIME-Version; b=pTuXBAh3s9TqCwWkxtFwBOt/8B6nssMs3Vv11UWZpIlUgglCUA9cUj78dA8Sqzz5B HIXNzwD2hV0KdXz7ciYSBd+kA2BpWVoMrIF+Tc6i53DgXrfUrrI2McunswVO3aywQC NVfiwatPBm/6rI5hXxEyww6tnsouP2DavVlSVNHQz5FjIJAPfGtgeGqL4s4zvRFhxe 74zKfm2RV+0vglM13ylMLLrS2rXD9nbnij3lRAEuopalADv1Hlqu0wtW+K1WEZArNe ap55SnYyfbb+ZhMnzu+MOK/BkhtPwluGq71IhFN9BZIZJ2sk4T9WuLtwOVCm9JiAvo iMErwQs/TXJRw== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id QS8aNiERquUx; Mon, 30 Oct 2023 15:51:42 -0400 (EDT) Received: from localhost.localdomain (unknown [192.168.51.254]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 7EF239C0C3C; Mon, 30 Oct 2023 15:51:41 -0400 (EDT) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH 2/8] Toaster: Update orm.models to catch error ProcessLookupError Date: Mon, 30 Oct 2023 20:51:26 +0100 Message-Id: <20231030195132.235083-2-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> References: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 30 Oct 2023 19:51:44 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/5905 Signed-off-by: Alassane Yattara --- lib/toaster/orm/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py index 0d503a51..4f6d2147 100644 --- a/lib/toaster/orm/models.py +++ b/lib/toaster/orm/models.py @@ -1389,9 +1389,6 @@ class Machine(models.Model): return "Machine " + self.name + "(" + self.description + ")" - - - class BitbakeVersion(models.Model): name = models.CharField(max_length=32, unique = True) @@ -1838,6 +1835,7 @@ class LogMessage(models.Model): def __str__(self): return force_bytes('%s %s %s' % (self.get_level_display(), self.message, self.build)) + def invalidate_cache(**kwargs): from django.core.cache import cache try: @@ -1845,6 +1843,7 @@ def invalidate_cache(**kwargs): except Exception as e: logger.warning("Problem with cache backend: Failed to clear cache: %s" % e) + def signal_runbuilds(): """Send SIGUSR1 to runbuilds process""" try: @@ -1853,6 +1852,9 @@ def signal_runbuilds(): os.kill(int(pidf.read()), SIGUSR1) except FileNotFoundError: logger.info("Stopping existing runbuilds: no current process found") + except ProcessLookupError: + pass + class Distro(models.Model): search_allowed_fields = ["name", "description", "layer_version__layer__name"] From patchwork Mon Oct 30 19:51:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 33114 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E219FC4332F for ; Mon, 30 Oct 2023 19:51:44 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.159189.1698695504684547888 for ; Mon, 30 Oct 2023 12:51:44 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=o8buEtZZ; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 1322A9C2CC3 for ; Mon, 30 Oct 2023 15:51:44 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id fTLMIJd2cHJi; Mon, 30 Oct 2023 15:51:43 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 97C9F9C113C; Mon, 30 Oct 2023 15:51:43 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 97C9F9C113C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1698695503; bh=SN/3n4SflF+dxPR7+x95Wn5UYFxlw/gh2fXVVpRUu14=; h=From:To:Date:Message-Id:MIME-Version; b=o8buEtZZnJn29w/sSC4+YBlvtrlZHyOeUyv8SxHaY9BJOjgX1gVsVYPt2mvjIUwJa 1+a6L+Bg4de/AB1045UsOzh/R5ewJU/jHXSL8l5a+A7xe+ZHnD1HFn62qYkGfJhhoi 0twRToCYzQIkJpvqxip1Y2sZHZp6COR+ZFmYSlzei0TZcRe1gddukxYdCCyeTlm4b1 78Y83bZgPzkfnm6hhDU1ZiblADgM/j4pY4q1lASkQKIktgvEi1GMqOggNV4EFpCIn1 zDpzRz/NYmxsVWpXxeox6DUVyZDyInK0PAX0zxhz8XHzIgA0iTeOqse+N5czhYwKAm wCWu03F0zv6SQ== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id 2hnTx66b1U_8; Mon, 30 Oct 2023 15:51:43 -0400 (EDT) Received: from localhost.localdomain (unknown [192.168.51.254]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id B6E0C9C0C3C; Mon, 30 Oct 2023 15:51:42 -0400 (EDT) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH 3/8] Toaster: Bug-fix pytest and Failed: Database access not allowed Date: Mon, 30 Oct 2023 20:51:27 +0100 Message-Id: <20231030195132.235083-3-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> References: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 30 Oct 2023 19:51:44 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/5906 Remove load and create build environment from tests/functional/functional_helpers Signed-off-by: Alassane Yattara --- lib/toaster/tests/functional/functional_helpers.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/toaster/tests/functional/functional_helpers.py b/lib/toaster/tests/functional/functional_helpers.py index c3191f66..b80d403b 100644 --- a/lib/toaster/tests/functional/functional_helpers.py +++ b/lib/toaster/tests/functional/functional_helpers.py @@ -15,8 +15,6 @@ import time import re from tests.browser.selenium_helpers_base import SeleniumTestCaseBase -from tests.builds.buildtest import load_build_environment -from bldcontrol.models import BuildEnvironment from selenium.webdriver.common.by import By from selenium.common.exceptions import NoSuchElementException @@ -33,10 +31,6 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): raise RuntimeError("Please initialise django with the tests settings: " \ "DJANGO_SETTINGS_MODULE='toastermain.settings_test'") - if BuildEnvironment.objects.count() == 0: - BuildEnvironment.objects.create(betype=BuildEnvironment.TYPE_LOCAL) - load_build_environment() - # start toaster cmd = "bash -c 'source toaster start'" p = subprocess.Popen( From patchwork Mon Oct 30 19:51:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 33117 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7C12C4167B for ; Mon, 30 Oct 2023 19:51:54 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.159190.1698695505979666963 for ; Mon, 30 Oct 2023 12:51:46 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=LPy2FB4M; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 50A499C2BF2 for ; Mon, 30 Oct 2023 15:51:45 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id KKOtTd_XmdXl; Mon, 30 Oct 2023 15:51:44 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id D115F9C2CC2; Mon, 30 Oct 2023 15:51:44 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com D115F9C2CC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1698695504; bh=DRXCA7E2TGMUv0v25Wxw/oByR5RBeNsF5Xe+aiJyKEI=; h=From:To:Date:Message-Id:MIME-Version; b=LPy2FB4Mezx/MwG72UreCCO+DPGDYwQs+AG/5GOrg9LVdlRzq8RvIAe2ovgd0Eufn NwZ3v3Adai03NBpLxdfTi0aUg2jRxypnofPb8mFppV2RYf0xc4d0aOEEGigyehKUvK xPjcaX+rHH92oQhLVeIQYx5A5CmqyTuwntBqONjJOML16MjaX5lPmKgDHtHOlC5r4D Y39Ys3m9rp2wnMSFixaHWMKBypWLIsIMVVeP5VlcQPHZ63jaXhcPTVyJdqnerHe4WU E5yyAqpwZtYtMR4GTTZ484IZsTZAg0zFqIxvJdF4cjcBm6/DHLOoKr0pl0IyRreNAO ivpgsmyhv3D6g== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id oB3eya-PrySA; Mon, 30 Oct 2023 15:51:44 -0400 (EDT) Received: from localhost.localdomain (unknown [192.168.51.254]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id EE9BD9C0C3C; Mon, 30 Oct 2023 15:51:43 -0400 (EDT) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH 4/8] Toaster: fixed pytest error: Database access not allowed, use the "django_db" Date: Mon, 30 Oct 2023 20:51:28 +0100 Message-Id: <20231030195132.235083-4-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> References: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 30 Oct 2023 19:51:54 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/5907 Pytest failed on functional/test_functional_basic because database access not allowed - we should use "django_db" fixture to allowed db access Note: Pytest-django takes a conservative approach to enabling database access. By default your tests will fail if they try to access the database. Only if you explicitly request database access will this be allowed. Signed-off-by: Alassane Yattara --- lib/toaster/tests/functional/test_functional_basic.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/toaster/tests/functional/test_functional_basic.py b/lib/toaster/tests/functional/test_functional_basic.py index b0def544..7e9be91c 100644 --- a/lib/toaster/tests/functional/test_functional_basic.py +++ b/lib/toaster/tests/functional/test_functional_basic.py @@ -8,6 +8,7 @@ # import re, time +import pytest from django.urls import reverse from tests.functional.functional_helpers import SeleniumFunctionalTestCase from orm.models import Project @@ -16,6 +17,7 @@ from selenium.webdriver.common.by import By class FuntionalTestBasic(SeleniumFunctionalTestCase): # testcase (1514) + @pytest.mark.django_db def test_create_slenium_project(self): project_name = 'selenium-project' self.get(reverse('newproject')) From patchwork Mon Oct 30 19:51:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 33119 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17952C4167D for ; Mon, 30 Oct 2023 19:51:55 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.159191.1698695507235304877 for ; Mon, 30 Oct 2023 12:51:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=U/XFOqV2; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 7882C9C31BC for ; Mon, 30 Oct 2023 15:51:46 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id RNC2HQPPjs56; Mon, 30 Oct 2023 15:51:46 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 110F49C2BF6; Mon, 30 Oct 2023 15:51:46 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 110F49C2BF6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1698695506; bh=p2J+od2B1eMImjzJ6UqaVnL/r0kbwNU9wZ1YSW48g4U=; h=From:To:Date:Message-Id:MIME-Version; b=U/XFOqV26cUTQ15ntnrqhz8DJKQwjlCmm1vhPbrBfuFYOjUVO9l7PgnOwVrNm2bZp Qx06r2yVvWlXq2yycybbvP7N32ppDTbeeJN7nI3e5hqKuawTthyZf1gLhH86KHaIty MoLdkOn1mfz8jvQU85IKPnqGM7XTNd3BkXcLiRVay95V2kuZUjkZp/Kk4OBGsKV+cf owNNjxSP2/Hb7BRsNrTjphpSTZWu3zCyJjauxxQz9/OEkUHAka5kOPpUzWrDbb4no0 zo0KIQjfekjcnwxO7v3HTYYQ6foTM6c/nHaVZvGdupxUCSRASWMwsWE9JTCog+x1v5 1BEBdu0DAELew== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id 14rO9MLInPiu; Mon, 30 Oct 2023 15:51:46 -0400 (EDT) Received: from localhost.localdomain (unknown [192.168.51.254]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 326459C0C3C; Mon, 30 Oct 2023 15:51:45 -0400 (EDT) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH 5/8] Toaster: Bug-fix django.db.utils.IntegrityError: Problem installing fixture Date: Mon, 30 Oct 2023 20:51:29 +0100 Message-Id: <20231030195132.235083-5-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> References: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 30 Oct 2023 19:51:55 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/5908 toastergui-unittest-data.xml fixture contains a release objects with name="master" or an release with same name seem existing - Change release name and fix bitbakeversion instead of bitbake_version Signed-off-by: Alassane Yattara --- lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml b/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml index 1d522f88..df106934 100644 --- a/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml +++ b/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml @@ -19,9 +19,9 @@ poky_distro2 description - master + foo_master master project - 1 + 1 a test project From patchwork Mon Oct 30 19:51:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 33120 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CE6EC41535 for ; Mon, 30 Oct 2023 19:51:55 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.159380.1698695508679346560 for ; Mon, 30 Oct 2023 12:51:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=Q9FJdMPO; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 00FC89C2BF2 for ; Mon, 30 Oct 2023 15:51:48 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id n3rzZALocUeN; Mon, 30 Oct 2023 15:51:47 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 4DC319C3154; Mon, 30 Oct 2023 15:51:47 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 4DC319C3154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1698695507; bh=9ZmjA4jVXRKl7D0tU2mh3T4CRmbXyy0ig+56aOGFxaw=; h=From:To:Date:Message-Id:MIME-Version; b=Q9FJdMPOd9ngToFw1zYU8DjpOglqjrSPfdtj69fX3vQknMsGBylhEgi65T8pgFhhb lukGFIk/m2wNosozWQs7t8c5XkWcDAuWiEH1G2kFNPjVPXxRQZQBSwf0pn6bsqWGG2 ARFYt59EjYMMn8iZwRnIF+XxUrLMF9kHseXknNvy982hpxzmPKAgjo97Q8kmLNPW04 /nQBvTonZqPa1NSQ7zuoaoDXseAB6+MDpXJEamJ33jHHQMuP0fKtc1VxYl2VtTeovv O1frMC7Y0Gv3VVxcKt/vagqk2KiCOVKxczhRoeVggxgHIHtqhqt35v/mWUwLWv+j4P bgy4ZgmzPJ/Kw== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id l6ybFdRtBSWF; Mon, 30 Oct 2023 15:51:47 -0400 (EDT) Received: from localhost.localdomain (unknown [192.168.51.254]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 6A1C09C2D1C; Mon, 30 Oct 2023 15:51:46 -0400 (EDT) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH 6/8] Toaster: Move toaster tests requirements in bitbake/lib/toaster/toaster-tests-requirements Date: Mon, 30 Oct 2023 20:51:30 +0100 Message-Id: <20231030195132.235083-6-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> References: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 30 Oct 2023 19:51:55 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/5909 To make difference between bitbake and toaster python requirements, a dedicated requirements file is created for toaster in root of toaster dir. Signed-off-by: Alassane Yattara --- lib/toaster/tests/toaster-tests-requirements.txt | 5 +++++ toaster-requirements.txt | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/toaster/tests/toaster-tests-requirements.txt b/lib/toaster/tests/toaster-tests-requirements.txt index f30ac070..7109c625 100644 --- a/lib/toaster/tests/toaster-tests-requirements.txt +++ b/lib/toaster/tests/toaster-tests-requirements.txt @@ -1 +1,6 @@ selenium>=4.13.0 +pytest==7.4.2 +pytest-django==4.5.2 +pytest-env==1.1.0 +pytest-html==4.0.2 +pytest-metadata==3.0.0 diff --git a/toaster-requirements.txt b/toaster-requirements.txt index 19bf6fd2..d8e48b7f 100644 --- a/toaster-requirements.txt +++ b/toaster-requirements.txt @@ -2,8 +2,3 @@ Django>4.2,<4.3 beautifulsoup4>=4.4.0 pytz django-log-viewer==1.1.7 -pytest==7.4.2 -pytest-django==4.5.2 -pytest-env==1.1.0 -pytest-html==4.0.2 -pytest-metadata==3.0.0 From patchwork Mon Oct 30 19:51:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 33121 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02E2DC00142 for ; Mon, 30 Oct 2023 19:51:55 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.159381.1698695509810420909 for ; Mon, 30 Oct 2023 12:51:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=nAAYCELD; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 327EF9C2BF2 for ; Mon, 30 Oct 2023 15:51:49 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id tINl1AkTNTjK; Mon, 30 Oct 2023 15:51:48 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 80F959C3154; Mon, 30 Oct 2023 15:51:48 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 80F959C3154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1698695508; bh=+5uZZBBn17ErJhYtUSTuu9jVZ2vwwTzGT4O4Jw8pWWc=; h=From:To:Date:Message-Id:MIME-Version; b=nAAYCELDB2GzH+kOVFppuOMK402hrEEzpbr/NjAcIy0JsKDbwlXGJiZpRue2Y9TBm ht7RhT2dSAPfOmDDCtIjP4Bs6pBH2AXr6PCXb0A8+U93c3A1OlbsmAt3qDTqFmhe5S u+fFrvpn8x8hFfno9XUX8tTQ8GIvNZ9J+J5/dFeVtpztr3tylb5PpfegZx3S9HmAqs 3RPGAlZIgWQyqsyK6BvdpkzxoR0wtyDzEpY2zSDrNdK//2FI6a0ogKq/MPHVL01ZJI 9Ew2tGnhyHqMQhr43JAksTJ7PaSa8+/1BTYUrEwuw1EBwL5L4rWJwhZa+uHKResUKk vWfk0KMzzfaSg== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id FMY3uHkJ-0DJ; Mon, 30 Oct 2023 15:51:48 -0400 (EDT) Received: from localhost.localdomain (unknown [192.168.51.254]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id A22259C3398; Mon, 30 Oct 2023 15:51:47 -0400 (EDT) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH 7/8] Toaster: fixed: Tests fail when executed one after the other out of sequence Date: Mon, 30 Oct 2023 20:51:31 +0100 Message-Id: <20231030195132.235083-7-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> References: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 30 Oct 2023 19:51:54 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/5910 As mentionned in earlier commit, pytest-django takes a conservative approach to enabling database access. By default our tests will fail if they try to access the database, Only if we explicitly request database access will this be allowed, using pytest marks to tell pytest-django our test needs database access. A side effect of pytest mark, is test_case method marked is execute out of scope of its module class, which create an inconsistance sequence and make fails followings tests. The scope of the ordering is global per default, e.g. tests with lower ordinal numbers are always executed before tests with higher numbers in the same test session, regardless of the module and class they reside in. This can be changed by using the --order-scope option from module pytest-order. To fix that i added execution order to tests suite using pytest-order. Signed-off-by: Alassane Yattara --- lib/toaster/tests/functional/test_functional_basic.py | 4 +++- lib/toaster/tests/toaster-tests-requirements.txt | 1 + lib/toaster/tests/views/test_views.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/toaster/tests/functional/test_functional_basic.py b/lib/toaster/tests/functional/test_functional_basic.py index 7e9be91c..f558cce8 100644 --- a/lib/toaster/tests/functional/test_functional_basic.py +++ b/lib/toaster/tests/functional/test_functional_basic.py @@ -8,12 +8,14 @@ # import re, time -import pytest from django.urls import reverse +import pytest from tests.functional.functional_helpers import SeleniumFunctionalTestCase from orm.models import Project from selenium.webdriver.common.by import By + +@pytest.mark.order("last") class FuntionalTestBasic(SeleniumFunctionalTestCase): # testcase (1514) diff --git a/lib/toaster/tests/toaster-tests-requirements.txt b/lib/toaster/tests/toaster-tests-requirements.txt index 7109c625..71cc0834 100644 --- a/lib/toaster/tests/toaster-tests-requirements.txt +++ b/lib/toaster/tests/toaster-tests-requirements.txt @@ -4,3 +4,4 @@ pytest-django==4.5.2 pytest-env==1.1.0 pytest-html==4.0.2 pytest-metadata==3.0.0 +pytest-order==1.1.0 diff --git a/lib/toaster/tests/views/test_views.py b/lib/toaster/tests/views/test_views.py index 06bf6c20..349881eb 100644 --- a/lib/toaster/tests/views/test_views.py +++ b/lib/toaster/tests/views/test_views.py @@ -9,6 +9,7 @@ """Test cases for Toaster GUI and ReST.""" +import pytest from django.test import TestCase from django.test.client import RequestFactory from django.urls import reverse @@ -33,6 +34,7 @@ PROJECT_NAME2 = "test project 2" CLI_BUILDS_PROJECT_NAME = 'Command line builds' +@pytest.mark.order(1) class ViewTests(TestCase): """Tests to verify view APIs.""" From patchwork Mon Oct 30 19:51:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 33118 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0F6BC4332F for ; Mon, 30 Oct 2023 19:51:54 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.159194.1698695511024446501 for ; Mon, 30 Oct 2023 12:51:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=aX6zlQ7C; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 63ED79C2BF2 for ; Mon, 30 Oct 2023 15:51:50 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id oU38ha2ZkgTA; Mon, 30 Oct 2023 15:51:49 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id B9A989C2CD7; Mon, 30 Oct 2023 15:51:49 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com B9A989C2CD7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1698695509; bh=rBWAoJ0FniWSG44KVipEyg2HlVrTAi29swGjkkmqBuQ=; h=From:To:Date:Message-Id:MIME-Version; b=aX6zlQ7CT1wexwvOLk/GTy8tKCA6BeuP+/QKlomjQMMnBu3mwiQIFbYyYAOJ2ef/1 dyVaXjMSIlP4GcSw8ac7CCyx/8CaOsPBkau8RET5Y6pJmoo1BDrBwUVsXkovwra1yO I1mcNqbe5X2bRaK70l7/D0hvnWQ9Jx8VRAhFYn+gbb4m2e4El6B+kYFcQd9vCo4rue 3bNggaYoSPHwaEmI7m5pb2CPG3h1vPozaVA/yAjEDQyd4q2DHEi2D8IcxE5PWT1Qwn DWiz7Pi95goC103V9I4eNLX0sJ38GATWFIWX6Th3w2tdmRCrPcex3KfYoqcwQLvxJP VqGmpgMLdstfQ== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id aB21bEThEDhJ; Mon, 30 Oct 2023 15:51:49 -0400 (EDT) Received: from localhost.localdomain (unknown [192.168.51.254]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id D9F469C2BF6; Mon, 30 Oct 2023 15:51:48 -0400 (EDT) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH 8/8] Toaster: Added pytest.init file Date: Mon, 30 Oct 2023 20:51:32 +0100 Message-Id: <20231030195132.235083-8-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> References: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 30 Oct 2023 19:51:54 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/5911 Added pytest init file to configure pytest and generate test reports. Objective - We propose to integrate the plugin Pytest to generate test reports for Toaster application. - To keep configurations to a minimal, we propose to integrate Pytest with Tox(tox.ini). - Tox will automate the execution of the Pytest test cases. Pros - Generate test reports - Create a historical record of test results over time - Track Toasters stability and quality - Documentation and Transparency - Debugging, troubleshooting : identify regressions (input, output,) Cons - Limited predefined report options. Although Pytest provides different report formats, its default reports are rather straightforward, We might have to put extra effort into crafting them ourselves. Signed-off-by: Alassane Yattara --- lib/toaster/pytest.ini | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/toaster/pytest.ini diff --git a/lib/toaster/pytest.ini b/lib/toaster/pytest.ini new file mode 100644 index 00000000..f07076b7 --- /dev/null +++ b/lib/toaster/pytest.ini @@ -0,0 +1,19 @@ +# -- FILE: pytest.ini (or tox.ini) +[pytest] +DJANGO_SETTINGS_MODULE = toastermain.settings_test + +python_files = db/test_*.py commands/test_*.py views/test_*.py browser/test_*.py functional/test_*.py + +# --create-db - force re creation of the test database +# https://pytest-django.readthedocs.io/en/latest/database.html#create-db-force-re-creation-of-the-test-database + +# --html=report.html --self-contained-html +# https://docs.pytest.org/en/latest/usage.html#creating-html-reports +# https://pytest-html.readthedocs.io/en/latest/user_guide.html#creating-a-self-contained-report +addopts = --create-db --html="Toaster Tests Report.html" --self-contained-html + +# Define environment variables using pytest-env +# A pytest plugin that enables you to set environment variables in the pytest.ini file. +# https://pypi.org/project/pytest-env/ +env = + TOASTER_BUILDSERVER=1