From bcc81a27a03c61dcb92efe372de4d5abec9039ff Mon Sep 17 00:00:00 2001 From: Matej Dujava Date: Mon, 30 Sep 2024 15:59:34 +0200 Subject: [PATCH] Make toolbox cli tests run on other workers Mark all non-cli tests with a group, so they run sequentially. Speed up from ~29min to ~24min for `make toolbox`. --- Makefile | 2 +- testsuite/tests/toolbox/test_account.py | 4 ++++ testsuite/tests/toolbox/test_activedoc.py | 4 ++++ testsuite/tests/toolbox/test_app_plans.py | 4 ++++ testsuite/tests/toolbox/test_application.py | 4 ++++ testsuite/tests/toolbox/test_backend.py | 6 +++++- testsuite/tests/toolbox/test_cli.py | 4 +++- testsuite/tests/toolbox/test_method.py | 4 ++++ testsuite/tests/toolbox/test_metric.py | 4 ++++ testsuite/tests/toolbox/test_openapi.py | 4 ++++ testsuite/tests/toolbox/test_policies_imp_exp.py | 4 ++++ testsuite/tests/toolbox/test_product_backend_exp.py | 4 ++++ testsuite/tests/toolbox/test_product_copy.py | 5 ++++- testsuite/tests/toolbox/test_product_update.py | 5 ++++- testsuite/tests/toolbox/test_proxy.py | 4 ++++ testsuite/tests/toolbox/test_proxycfg.py | 4 ++++ testsuite/tests/toolbox/test_remote.py | 4 ++++ testsuite/tests/toolbox/test_service.py | 4 ++++ testsuite/tests/toolbox/test_service_csv.py | 4 ++++ 19 files changed, 73 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index b8224496b..d10521deb 100644 --- a/Makefile +++ b/Makefile @@ -104,7 +104,7 @@ ui: pipenv check-secrets.yaml $(PYTEST) --ui $(flags) testsuite/tests/ui toolbox: pipenv check-secrets.yaml - $(PYTEST) --toolbox $(flags) testsuite/tests/toolbox + $(PYTEST) -n4 --dist loadgroup --toolbox $(flags) testsuite/tests/toolbox test-images: $(PYTEST) --images $(flags) testsuite/tests/images diff --git a/testsuite/tests/toolbox/test_account.py b/testsuite/tests/toolbox/test_account.py index 432683c63..4b041120f 100644 --- a/testsuite/tests/toolbox/test_account.py +++ b/testsuite/tests/toolbox/test_account.py @@ -6,6 +6,10 @@ from testsuite.toolbox import toolbox +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + @pytest.fixture(scope="module") def create_cmd(threescale_src1): diff --git a/testsuite/tests/toolbox/test_activedoc.py b/testsuite/tests/toolbox/test_activedoc.py index 0adc2fde3..ec43beb81 100644 --- a/testsuite/tests/toolbox/test_activedoc.py +++ b/testsuite/tests/toolbox/test_activedoc.py @@ -11,6 +11,10 @@ SWAGGER_LINK = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/json/petstore.json" +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + @pytest.fixture(scope="module") def my_app_plan(request, custom_app_plan, service): diff --git a/testsuite/tests/toolbox/test_app_plans.py b/testsuite/tests/toolbox/test_app_plans.py index 14a79de4b..bae66d682 100644 --- a/testsuite/tests/toolbox/test_app_plans.py +++ b/testsuite/tests/toolbox/test_app_plans.py @@ -14,6 +14,10 @@ from testsuite.utils import blame from testsuite import rawobj +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + @pytest.fixture(scope="module") def service(request, custom_service): diff --git a/testsuite/tests/toolbox/test_application.py b/testsuite/tests/toolbox/test_application.py index 396306d25..a49fe03c7 100644 --- a/testsuite/tests/toolbox/test_application.py +++ b/testsuite/tests/toolbox/test_application.py @@ -9,6 +9,10 @@ from testsuite.utils import blame from testsuite import rawobj +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + @pytest.fixture(scope="module") def my_services(custom_service, service, request): diff --git a/testsuite/tests/toolbox/test_backend.py b/testsuite/tests/toolbox/test_backend.py index e79f3ba36..3f41f832c 100644 --- a/testsuite/tests/toolbox/test_backend.py +++ b/testsuite/tests/toolbox/test_backend.py @@ -12,7 +12,11 @@ import testsuite.utils from testsuite import TESTED_VERSION # noqa # pylint: disable=unused-import -pytestmark = pytest.mark.skipif("TESTED_VERSION < Version('2.7')") +pytestmark = [ + pytest.mark.skipif("TESTED_VERSION < Version('2.7')"), + pytest.mark.xdist_group(name="toolbox"), +] + HTTP_METHODS = ["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "PATCH"] # 'TRACE', 'CONNECT' are not supported by 3scale diff --git a/testsuite/tests/toolbox/test_cli.py b/testsuite/tests/toolbox/test_cli.py index b9ce73bef..a664e00ae 100644 --- a/testsuite/tests/toolbox/test_cli.py +++ b/testsuite/tests/toolbox/test_cli.py @@ -9,7 +9,9 @@ from testsuite.toolbox import toolbox from testsuite import TESTED_VERSION # noqa # pylint: disable=unused-import -pytestmark = pytest.mark.skipif("TESTED_VERSION < Version('2.7')") +pytestmark = [ + pytest.mark.skipif("TESTED_VERSION < Version('2.7')"), +] # removed 'update' as unsupported command diff --git a/testsuite/tests/toolbox/test_method.py b/testsuite/tests/toolbox/test_method.py index 525fd9fa7..a6011e1a4 100644 --- a/testsuite/tests/toolbox/test_method.py +++ b/testsuite/tests/toolbox/test_method.py @@ -11,6 +11,10 @@ from testsuite.toolbox import constants from testsuite.toolbox import toolbox +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + @pytest.fixture(scope="module") def hits(request, service): diff --git a/testsuite/tests/toolbox/test_metric.py b/testsuite/tests/toolbox/test_metric.py index e19fc8aea..54d239902 100644 --- a/testsuite/tests/toolbox/test_metric.py +++ b/testsuite/tests/toolbox/test_metric.py @@ -11,6 +11,10 @@ from testsuite.toolbox import constants from testsuite.toolbox import toolbox +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + @pytest.fixture(scope="module") def metric_obj(request, service): diff --git a/testsuite/tests/toolbox/test_openapi.py b/testsuite/tests/toolbox/test_openapi.py index 3599a59a5..9164a9d99 100644 --- a/testsuite/tests/toolbox/test_openapi.py +++ b/testsuite/tests/toolbox/test_openapi.py @@ -16,6 +16,10 @@ from testsuite.toolbox import toolbox from testsuite.utils import blame +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + # authentization in 3scale and mapping to OAS(http://spec.openapis.org/oas/v3.0.3#security-scheme-object): # # - 1 token -> see uber.json diff --git a/testsuite/tests/toolbox/test_policies_imp_exp.py b/testsuite/tests/toolbox/test_policies_imp_exp.py index 08d6a5115..636f90d54 100644 --- a/testsuite/tests/toolbox/test_policies_imp_exp.py +++ b/testsuite/tests/toolbox/test_policies_imp_exp.py @@ -8,6 +8,10 @@ from testsuite.config import settings from testsuite.toolbox import toolbox +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + @pytest.fixture(scope="module") def policy_file(policy_configs): diff --git a/testsuite/tests/toolbox/test_product_backend_exp.py b/testsuite/tests/toolbox/test_product_backend_exp.py index d608f84f8..91176d810 100644 --- a/testsuite/tests/toolbox/test_product_backend_exp.py +++ b/testsuite/tests/toolbox/test_product_backend_exp.py @@ -10,6 +10,10 @@ from testsuite.utils import blame from testsuite import rawobj +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + @pytest.fixture(scope="module") def export_import_file(): diff --git a/testsuite/tests/toolbox/test_product_copy.py b/testsuite/tests/toolbox/test_product_copy.py index dfc809d8a..472b067d1 100644 --- a/testsuite/tests/toolbox/test_product_copy.py +++ b/testsuite/tests/toolbox/test_product_copy.py @@ -9,7 +9,10 @@ from testsuite.utils import blame, blame_desc from testsuite import rawobj, TESTED_VERSION # noqa # pylint: disable=unused-import -pytestmark = pytest.mark.skipif("TESTED_VERSION < Version('2.7')") +pytestmark = [ + pytest.mark.skipif("TESTED_VERSION < Version('2.7')"), + pytest.mark.xdist_group(name="toolbox"), +] @pytest.fixture(scope="module", params=["copy_service", "product_copy", "service_copy"]) diff --git a/testsuite/tests/toolbox/test_product_update.py b/testsuite/tests/toolbox/test_product_update.py index 9e86e2615..9ad7e88ab 100644 --- a/testsuite/tests/toolbox/test_product_update.py +++ b/testsuite/tests/toolbox/test_product_update.py @@ -9,7 +9,10 @@ from testsuite.utils import blame, blame_desc from testsuite import rawobj, TESTED_VERSION # noqa # pylint: disable=unused-import -pytestmark = pytest.mark.skipif("TESTED_VERSION < Version('2.7')") +pytestmark = [ + pytest.mark.skipif("TESTED_VERSION < Version('2.7')"), + pytest.mark.xdist_group(name="toolbox"), +] @pytest.fixture(scope="module", params=["product_copy", "service_copy"]) diff --git a/testsuite/tests/toolbox/test_proxy.py b/testsuite/tests/toolbox/test_proxy.py index a5d61b595..5b51a1f70 100644 --- a/testsuite/tests/toolbox/test_proxy.py +++ b/testsuite/tests/toolbox/test_proxy.py @@ -5,6 +5,10 @@ from testsuite.toolbox import toolbox +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + @pytest.fixture(scope="module") def create_cmd(threescale_src1): diff --git a/testsuite/tests/toolbox/test_proxycfg.py b/testsuite/tests/toolbox/test_proxycfg.py index c439bae83..cab1e63a1 100644 --- a/testsuite/tests/toolbox/test_proxycfg.py +++ b/testsuite/tests/toolbox/test_proxycfg.py @@ -7,6 +7,10 @@ from testsuite import rawobj from testsuite.toolbox import toolbox +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + @pytest.fixture(scope="module") def create_cmd(threescale_src1): diff --git a/testsuite/tests/toolbox/test_remote.py b/testsuite/tests/toolbox/test_remote.py index 325043a99..2f45d78c3 100644 --- a/testsuite/tests/toolbox/test_remote.py +++ b/testsuite/tests/toolbox/test_remote.py @@ -8,6 +8,10 @@ from testsuite.toolbox import toolbox +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + EMPTY_LIST = "Empty remote list.\n" diff --git a/testsuite/tests/toolbox/test_service.py b/testsuite/tests/toolbox/test_service.py index 759691a90..1031ddaf5 100644 --- a/testsuite/tests/toolbox/test_service.py +++ b/testsuite/tests/toolbox/test_service.py @@ -8,6 +8,10 @@ from testsuite.toolbox import toolbox from testsuite.utils import randomize +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + @pytest.fixture(scope="module") def empty_list(service, create_cmd): diff --git a/testsuite/tests/toolbox/test_service_csv.py b/testsuite/tests/toolbox/test_service_csv.py index ecd43da12..400ffdca5 100644 --- a/testsuite/tests/toolbox/test_service_csv.py +++ b/testsuite/tests/toolbox/test_service_csv.py @@ -10,6 +10,10 @@ from testsuite.toolbox import toolbox from testsuite.utils import blame +pytestmark = [ + pytest.mark.xdist_group(name="toolbox"), +] + DATA = [ "service_name",