Skip to content

Commit

Permalink
Skip kubesonic test case for public branch (sonic-net#16684)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lixiaoyuner authored and mssonicbld committed Feb 5, 2025
1 parent 6cc9812 commit eba1f1f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/kubesonic/test_k8s_join_disjoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit eba1f1f

Please sign in to comment.