Skip to content

Commit

Permalink
Update integration tests, failing early if no image is provided
Browse files Browse the repository at this point in the history
We'll ensure that the integration tests fail early if the rock
images are not specified.
  • Loading branch information
petrutlucian94 committed Jul 17, 2024
1 parent e4197a0 commit 2456b8d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
4 changes: 4 additions & 0 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
#
# Copyright 2024 Canonical, Ltd.
# See LICENSE file for licensing details
#
pytest_plugins = ["k8s_test_harness.conftest"]
11 changes: 4 additions & 7 deletions tests/integration/test_multus_v3_8.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@


def test_multus_deployment(tmp_path: pathlib.Path, module_instance: harness.Instance):
image_uri = os.getenv("ROCK_MULTUS_V3_8")
assert image_uri is not None, "ROCK_MULTUS_V3_8 is not set"
image_split = image_uri.split(":")

clone_path = tmp_path / "multus"
clone_path.mkdir()

Expand All @@ -34,13 +38,6 @@ def test_multus_deployment(tmp_path: pathlib.Path, module_instance: harness.Inst
str(chart_path.absolute()),
"--namespace",
"kube-system",
]

image_uri = os.getenv("ROCK_MULTUS_V3_8")
assert image_uri is not None, "ROCK_MULTUS_V3_8 is not set"
image_split = image_uri.split(":")

helm_command += [
"--set",
f"image.repository={image_split[0]}",
"--set",
Expand Down
37 changes: 23 additions & 14 deletions tests/integration/test_multus_v4_0_2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#
# Copyright 2024 Canonical, Ltd.
# See LICENSE file for licensing details
#
import os

Expand All @@ -8,19 +9,21 @@


def test_multus_deployment(module_instance: harness.Instance):
helm_command = [
"sudo", "k8s",
"helm", "install", "multus-cni",
"oci://registry-1.docker.io/bitnamicharts/multus-cni",
"--version", "2.1.7",
"--namespace", "kube-system",
]

image_uri = os.getenv("ROCK_MULTUS_V4_0_2")
assert image_uri is not None, "ROCK_MULTUS_V4_0_2 is not set"
image_split = image_uri.split(":")

helm_command += [
helm_command = [
"sudo",
"k8s",
"helm",
"install",
"multus-cni",
"oci://registry-1.docker.io/bitnamicharts/multus-cni",
"--version",
"2.1.7",
"--namespace",
"kube-system",
"--set",
f"image.repository={image_split[0]}",
"--set",
Expand All @@ -33,10 +36,16 @@ def test_multus_deployment(module_instance: harness.Instance):

exec_util.stubbornly(retries=3, delay_s=1).on(module_instance).exec(
[
"sudo", "k8s",
"kubectl", "rollout", "status",
"daemonset", "multus-cni",
"--namespace", "kube-system",
"--timeout", "180s",
"sudo",
"k8s",
"kubectl",
"rollout",
"status",
"daemonset",
"multus-cni",
"--namespace",
"kube-system",
"--timeout",
"180s",
]
)

0 comments on commit 2456b8d

Please sign in to comment.