Skip to content

Commit

Permalink
Tests all the whereabouts versions (#14)
Browse files Browse the repository at this point in the history
Adds integration tests for all the currently supported whereabouts
versions.
  • Loading branch information
claudiubelu authored Jul 24, 2024
1 parent a8db765 commit ba6399e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions tests/integration/test_whereabouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
from pathlib import Path

import pytest
from k8s_test_harness import harness
from k8s_test_harness.util import env_util, k8s_util

Expand All @@ -14,9 +15,9 @@
MANIFESTS_DIR = DIR / ".." / "templates"


def _get_whereabouts_helm_cmd():
def _get_whereabouts_helm_cmd(whereabouts_version):
whereabouts_rock = env_util.get_build_meta_info_for_rock_version(
"whereabouts", "0.6.3", "amd64"
"whereabouts", whereabouts_version, "amd64"
)
rock_image = whereabouts_rock.image

Expand All @@ -40,24 +41,27 @@ def _get_whereabouts_helm_cmd():
)


def test_integration_whereabouts(module_instance: harness.Instance):
@pytest.mark.parametrize("whereabouts_version", ("0.6.3", "0.6.1", "0.5.4"))
def test_integration_whereabouts(
function_instance: harness.Instance, whereabouts_version: str
):
# We also need multus in order to test out whereabouts.
# It should become Available if everything is fine with it.
helm_cmd = k8s_util.get_helm_install_command(
"multus", "oci://registry-1.docker.io/bitnamicharts/multus-cni"
)
module_instance.exec(helm_cmd)
k8s_util.wait_for_daemonset(module_instance, "multus-multus-cni", "kube-system")
function_instance.exec(helm_cmd)
k8s_util.wait_for_daemonset(function_instance, "multus-multus-cni", "kube-system")

module_instance.exec(_get_whereabouts_helm_cmd())
k8s_util.wait_for_daemonset(module_instance, "whereabouts", "whereabouts")
function_instance.exec(_get_whereabouts_helm_cmd(whereabouts_version))
k8s_util.wait_for_daemonset(function_instance, "whereabouts", "whereabouts")

# Create a NetworkAttachmentDefinition and a deployment requiring it.
for filename in ["whereabouts-net-definition.yaml", "deployment.yaml"]:
manifest = MANIFESTS_DIR / filename
module_instance.exec(
function_instance.exec(
["k8s", "kubectl", "apply", "-f", "-"],
input=Path(manifest).read_bytes(),
)

k8s_util.wait_for_deployment(module_instance, "netshoot-deployment")
k8s_util.wait_for_deployment(function_instance, "netshoot-deployment")

0 comments on commit ba6399e

Please sign in to comment.