Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/smoke-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ runs:
--network=kind \
-v ${{ github.workspace }}/tests:/workspace/tests \
-v ${{ github.workspace }}/deployments:/workspace/deployments \
-v ${{ github.workspace }}/charts:/workspace/charts \
-v ${{ github.workspace }}/config:/workspace/config \
-v ${{ github.workspace }}/pyproject.toml:/workspace/pyproject.toml \
-v ${{ steps.k8s.outputs.test_output_path }}:${{ steps.k8s.outputs.test_output_path }} \
Expand Down
1 change: 1 addition & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEPLOYMENTS = f"{BASEDIR}/deployments"
HELM_CHARTS = f"{BASEDIR}/charts/nginx-ingress"
CRDS = f"{BASEDIR}/config/crd/bases"
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
TEST_DATA = f"{PROJECT_ROOT}/data"
Expand Down
16 changes: 12 additions & 4 deletions tests/suite/test_build_info.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
import io
import logging
import time

import pytest
from suite.utils.resources_utils import get_first_pod_name, wait_until_all_pods_are_ready
import yaml
from settings import HELM_CHARTS
from suite.utils.resources_utils import get_first_pod_name, wait_before_test, wait_until_all_pods_are_ready


@pytest.mark.ingresses
@pytest.mark.smoke
class TestBuildVersion:
def test_build_version(self, ingress_controller, kube_apis, ingress_controller_prerequisites):
"""
Test Version tag of build i.e. 'Version=<VERSION>'
Test Version tag of build i.e. 'Version=<VERSION>' is same as the version in the chart.yaml file
"""
with open(f"{HELM_CHARTS}/Chart.yaml") as f:
chart = yaml.safe_load(f)
ic_ver = chart["appVersion"]
print(f"NIC version from chart: {ic_ver}")

_info = self.send_build_info(kube_apis, ingress_controller_prerequisites)
_version = _info[_info.find("Version=") + len("Version=") : _info.rfind("GitCommit=")]
logging.info(_version)
assert _version != " "
assert ic_ver in _version

def send_build_info(self, kube_apis, ingress_controller_prerequisites) -> str:
"""
Expand All @@ -27,7 +34,7 @@ def send_build_info(self, kube_apis, ingress_controller_prerequisites) -> str:
pod_name = get_first_pod_name(kube_apis.v1, ingress_controller_prerequisites.namespace)
wait_until_all_pods_are_ready(kube_apis.v1, ingress_controller_prerequisites.namespace)
while not ready:
time.sleep(1)
wait_before_test()
try:
api_response = kube_apis.v1.read_namespaced_pod_log(
name=pod_name,
Expand All @@ -49,6 +56,7 @@ def send_build_info(self, kube_apis, ingress_controller_prerequisites) -> str:
_log = br.readline().strip()
try:
_info = _log[_log.find("Version") :].strip()
print(f"Version and GitCommit info: {_info}")
logging.info(f"Version and GitCommit info: {_info}")
except Exception:
logging.exception(f"Tag labels not found")
Expand Down