Skip to content

Commit

Permalink
Make toolbox cli tests run on other workers
Browse files Browse the repository at this point in the history
Mark all non-cli tests with a group, so they run sequentially.
Speed up from ~29min to ~24min for `make toolbox`.
  • Loading branch information
mdujava committed Sep 30, 2024
1 parent 9cbe126 commit cd49976
Show file tree
Hide file tree
Showing 19 changed files with 72 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_activedoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_app_plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
HTTP_METHODS = ["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "PATCH"]
# 'TRACE', 'CONNECT' are not supported by 3scale

pytestmark = [
pytest.mark.xdist_group(name="toolbox"),
]


@pytest.fixture(scope="module")
def my_backend(custom_backend):
Expand Down
4 changes: 3 additions & 1 deletion testsuite/tests/toolbox/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_policies_imp_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_product_backend_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
5 changes: 4 additions & 1 deletion testsuite/tests/toolbox/test_product_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
5 changes: 4 additions & 1 deletion testsuite/tests/toolbox/test_product_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_proxycfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

from testsuite.toolbox import toolbox

pytestmark = [
pytest.mark.xdist_group(name="toolbox"),
]


EMPTY_LIST = "Empty remote list.\n"

Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions testsuite/tests/toolbox/test_service_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
from testsuite.toolbox import toolbox
from testsuite.utils import blame

pytestmark = [
pytest.mark.xdist_group(name="toolbox"),
]


DATA = [
"service_name",
Expand Down

0 comments on commit cd49976

Please sign in to comment.