Skip to content

Commit

Permalink
Add pytest option for specifying e2e test Kubernetes version
Browse files Browse the repository at this point in the history
To run e2e tests with a specific Kubernetes version, use
`--e2e-k8s-version VERSION`.

`tox -e integration_test` will now only e2e tests against the most
recent Kubernetes version, like with `-m e2e_latest` previously.
  • Loading branch information
oyvindio committed Apr 21, 2022
1 parent 6b6d36e commit 3ce36c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
9 changes: 9 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from xdist.scheduler import LoadScopeScheduling

DOCKER_FOR_E2E_OPTION = "--use-docker-for-e2e"
E2E_K8S_VERSION_OPTION = "--e2e-k8s-version"

pytest_plugins = ['helpers_namespace']

Expand Down Expand Up @@ -156,6 +157,14 @@ def pytest_xdist_make_scheduler(config, log):
def pytest_addoption(parser):
parser.addoption(DOCKER_FOR_E2E_OPTION, action="store_true",
help="Run FDD using the latest docker container when executing E2E tests")
parser.addoption(E2E_K8S_VERSION_OPTION, action="store",
default="v1.22.4",
help="Run e2e tests against a kind cluster using this Kubernetes version")


@pytest.fixture(scope="session")
def k8s_version(request):
return request.config.getoption(E2E_K8S_VERSION_OPTION)


@pytest.fixture(scope="session")
Expand Down
13 changes: 0 additions & 13 deletions tests/fiaas_deploy_daemon/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,3 @@ def _mock_namespace_file_open(name, *args, **kwargs):
with mock.patch("__builtin__.open") as mock_open:
mock_open.side_effect = _mock_namespace_file_open
yield mock_open


@pytest.fixture(scope="session", params=(
"v1.15.12",
"v1.16.15",
"v1.18.19",
"v1.19.11",
"v1.20.7",
"v1.21.2",
pytest.param("v1.22.4", marks=pytest.mark.e2e_latest)
))
def k8s_version(request):
yield request.param

0 comments on commit 3ce36c5

Please sign in to comment.