From 63fe07bcbe9eb750d3783c462c7278a8917cd8ca Mon Sep 17 00:00:00 2001 From: lixiaoyuner <35456895+lixiaoyuner@users.noreply.github.com> Date: Wed, 5 Feb 2025 15:39:07 +0800 Subject: [PATCH] Skip kubesonic test case for public branch (#16684) What is the motivation for this PR? The k8s feature in not enabled for public branches. So the test case should be skipped for public branches How did you do it? Check the image type and skip the test case if it is public branch How did you verify/test it? Yes Any platform specific information? No Supported testbed topology if it's a new test case? Not new case --- tests/kubesonic/test_k8s_join_disjoin.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/kubesonic/test_k8s_join_disjoin.py b/tests/kubesonic/test_k8s_join_disjoin.py index 4076bce8439..b94b78232b3 100644 --- a/tests/kubesonic/test_k8s_join_disjoin.py +++ b/tests/kubesonic/test_k8s_join_disjoin.py @@ -4,6 +4,7 @@ from datetime import datetime from tests.common.helpers.assertions import pytest_assert +from tests.common.utilities import get_image_type logger = logging.getLogger(__name__) @@ -41,6 +42,14 @@ def check_dut_k8s_version_supported(duthost): logger.info(f"K8s version {k8s_version} is supported") +def check_image_type_supported(duthost): + logger.info("Check if the image type is supported") + image_type = get_image_type(duthost) + if image_type == "public": + pytest.skip("Kubesonic test cases are not supported on public image") + logger.info(f"Image type {image_type} is supported") + + def download_minikube(vmhost, creds): logger.info("Start to download minikube") minikube_url = f"https://github.com/kubernetes/minikube/releases/download/{MINIKUBE_VERSION}/minikube-linux-amd64" @@ -268,6 +277,7 @@ def clean_configdb_k8s_table(duthost): @pytest.fixture() def setup_and_teardown(duthost, vmhost, creds): + check_image_type_supported(duthost) check_dut_k8s_version_supported(duthost) logger.info("Start to setup test environment")