Skip to content

Commit

Permalink
feat: Enable tests/integration to be able to run 1.7, 1.8 and latest (#…
Browse files Browse the repository at this point in the history
…803)

* Parametrize tests/integration test_bundle_deployment.py in order to be
able to run for 1.7, 1.8 and latest.
* ci: Update deploy-eks.yaml tox command
Closes #800
  • Loading branch information
orfeas-k authored Feb 9, 2024
1 parent ed57498 commit 65d9cf5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-eks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Test bundle deployment
run: |
tox -vve test_bundle_deployment -- --model kubeflow --keep-models -vv -s
tox -vve test_bundle_deployment-1.7 -- --model kubeflow --keep-models -vv -s
# On failure, capture debugging resources
- name: Get juju status
Expand Down
10 changes: 7 additions & 3 deletions tests/integration/test_bundle_deployment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import subprocess
import json
import os

import aiohttp
import lightkube
Expand All @@ -8,18 +9,21 @@
from pytest_operator.plugin import OpsTest
from lightkube.resources.core_v1 import Service

BUNDLE_PATH = "./releases/1.7/edge/kubeflow/bundle.yaml"
BUNDLE_NAME = "kubeflow"

@pytest.fixture()
def lightkube_client() -> lightkube.Client:
client = lightkube.Client(field_manager=BUNDLE_NAME)
return client

@pytest.fixture
def bundle_path() -> str:
return os.environ.get("BUNDLE_PATH").replace("\"", "")

class TestCharm:
@pytest.mark.abort_on_fail
async def test_bundle_deployment_works(self, ops_test: OpsTest, lightkube_client):
subprocess.Popen(["juju", "deploy", f"{BUNDLE_PATH}", "--trust"])
async def test_bundle_deployment_works(self, ops_test: OpsTest, lightkube_client, bundle_path):
subprocess.Popen(["juju", "deploy", bundle_path, "--trust"])

await ops_test.model.wait_for_idle(
apps=["istio-ingressgateway"],
Expand Down
12 changes: 9 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
skipsdist = True
envlist = upgrade
envlist = lint, fmt, tests, full_bundle_tests, test_bundle_1.7, test_selenium_1.7, {test_bundle_deployment}-{1.7,1.8,latest}

[vars]
releases_test_path = {toxinidir}/tests-bundle/
Expand Down Expand Up @@ -80,14 +80,20 @@ deps =
-r {[vars]releases_test_path}/1.7/requirements.txt
description = Test bundles

[testenv:test_bundle_deployment]
[testenv:test_bundle_deployment-{1.7,1.8,latest}]
commands =
pytest -v --tb native --asyncio-mode=auto {[vars]test_path}/integration/test_bundle_deployment.py --keep-models --log-cli-level=INFO -s {posargs}
setenv =
1.7: BUNDLE_PATH = "./releases/1.7/stable/kubeflow/bundle.yaml"
1.8: BUNDLE_PATH = "./releases/1.8/stable/kubeflow/bundle.yaml"
latest: BUNDLE_PATH = "./releases/latest/edge/bundle.yaml"
deps =
aiohttp
lightkube
pytest-operator
tenacity
ops>=2.3.0
juju==2.9.43
1.7: juju<3.0.0
1.8: juju<4.0.0
latest: juju<4.0.0
description = Test bundle deployment

0 comments on commit 65d9cf5

Please sign in to comment.