From e2c051abdb688ae65ba17acc42bf31d109b2414f Mon Sep 17 00:00:00 2001 From: nehasangwai-ibm Date: Fri, 22 May 2026 18:28:20 +0530 Subject: [PATCH 1/4] [patch] kubernetes<36 fix applied --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 409770ca..1fa45e3c 100644 --- a/setup.py +++ b/setup.py @@ -53,7 +53,7 @@ def get_version(rel_path): install_requires=[ 'pyyaml', # MIT License 'openshift', # Apache Software License - 'kubernetes', # Apache Software License + 'kubernetes<36', # Apache Software License 'kubeconfig', # BSD License 'setuptools', # MIT License (required to install kubeconfig) 'jinja2', # BSD License From 7aef370dc98de3345223c9edf27fc369ee43f3c8 Mon Sep 17 00:00:00 2001 From: nehasangwai-ibm Date: Fri, 22 May 2026 21:10:03 +0530 Subject: [PATCH 2/4] [patch] reverted changes for temp disable ocp tests as workaround applied --- .github/workflows/python-package.yml | 2 +- test/src/test_mas.py | 27 ++++++++++----------------- test/src/test_olm.py | 27 ++++++++++----------------- 3 files changed, 21 insertions(+), 35 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e3104427..edb21ef4 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -46,7 +46,7 @@ jobs: cat ${GITHUB_WORKSPACE}/src/mas/devops/__init__.py python -m pip install --upgrade pip pip install .[dev] - python -m pytest -m "not openshift" + python -m pytest - name: Lint with flake8 run: | diff --git a/test/src/test_mas.py b/test/src/test_mas.py index 5a775e30..3902a1e7 100644 --- a/test/src/test_mas.py +++ b/test/src/test_mas.py @@ -8,7 +8,6 @@ # # ***************************************************************************** -import pytest from openshift import dynamic from kubernetes import config from kubernetes.client import api_client @@ -16,18 +15,12 @@ from mas.devops import mas -pytestmark = pytest.mark.openshift +dynClient = dynamic.DynamicClient( + api_client.ApiClient(configuration=config.load_kube_config()) +) -@pytest.fixture(scope="module") -def dynClient(): - """Create DynamicClient for OpenShift cluster access.""" - return dynamic.DynamicClient( - api_client.ApiClient(configuration=config.load_kube_config()) - ) - - -def test_entitlement(dynClient): +def test_entitlement(): icrUsername = "testing-i" icrPassword = "not-a-real-password-i" @@ -37,7 +30,7 @@ def test_entitlement(dynClient): assert secret.metadata.name == "ibm-entitlement" -def test_entitlement_with_artifactory(dynClient): +def test_entitlement_with_artifactory(): artifactoryUsername = "testing-a" artifactoryPassword = "not-a-real-password-a" @@ -50,7 +43,7 @@ def test_entitlement_with_artifactory(dynClient): assert secret.metadata.name == "ibm-entitlement" -def test_entitlement_alt_name(dynClient): +def test_entitlement_alt_name(): icrUsername = "testing-i" icrPassword = "not-a-real-password-i" @@ -60,23 +53,23 @@ def test_entitlement_alt_name(dynClient): assert secret.metadata.name == "ibm-entitlement-key" -def test_get_channel(dynClient): +def test_get_channel(): channel = mas.getMasChannel(dynClient, "doesnotexist") assert channel is None -def test_is_airgap_install(dynClient): +def test_is_airgap_install(): # The cluster we are using to test with does not have the MAS ICSP or IDMS installed assert mas.isAirgapInstall(dynClient) is False assert mas.isAirgapInstall(dynClient, checkICSP=False) is False -def test_get_mas_public_cluster_issuer(dynClient): +def test_get_mas_public_cluster_issuer(): # Test with non-existent instance - should return None issuer = mas.getMasPublicClusterIssuer(dynClient, "doesnotexist") assert issuer is None -# def test_is_app_ready(dynClient): +# def test_is_app_ready(): # mas.waitForAppReady(dynClient, "fvtcpd", "iot") # mas.waitForAppReady(dynClient, "fvtcpd", "iot", "masdev") diff --git a/test/src/test_olm.py b/test/src/test_olm.py index e0357356..354a9e2a 100644 --- a/test/src/test_olm.py +++ b/test/src/test_olm.py @@ -8,25 +8,18 @@ # # ***************************************************************************** -import pytest from openshift import dynamic from kubernetes import config from kubernetes.client import api_client from mas.devops import olm, ocp -pytestmark = pytest.mark.openshift +dynClient = dynamic.DynamicClient( + api_client.ApiClient(configuration=config.load_kube_config()) +) -@pytest.fixture(scope="module") -def dynClient(): - """Create DynamicClient for OpenShift cluster access.""" - return dynamic.DynamicClient( - api_client.ApiClient(configuration=config.load_kube_config()) - ) - - -def test_get_manifest(dynClient): +def test_get_manifest(): manifest = olm.getPackageManifest(dynClient, "ibm-sls") assert manifest is not None assert manifest.metadata.name == "ibm-sls" @@ -37,12 +30,12 @@ def test_get_manifest(dynClient): assert manifest.status.packageName == "ibm-sls" -def test_get_manifest_none(dynClient): +def test_get_manifest_none(): manifest = olm.getPackageManifest(dynClient, "ibm-sls2") assert manifest is None -def test_crud(dynClient): +def test_crud(): namespace = "cli-fvt-1" subscription = olm.applySubscription(dynClient, namespace, "ibm-sls", packageChannel="3.x") assert subscription.metadata.name == "ibm-sls" @@ -69,7 +62,7 @@ def test_crud(dynClient): assert failedSubscriptionLookup2 is None -def test_crud_with_config(dynClient): +def test_crud_with_config(): namespace = "cli-fvt-2" # We don't need this, just want to test that it works testConfig = { @@ -88,7 +81,7 @@ def test_crud_with_config(dynClient): ocp.deleteNamespace(dynClient, namespace) -def test_crud_with_manual_approval(dynClient): +def test_crud_with_manual_approval(): """ Test that when installPlanApproval is Manual without a startingCSV, an OLMException is raised. @@ -112,7 +105,7 @@ def test_crud_with_manual_approval(dynClient): # Test passed - exception was raised as expected -def test_crud_with_starting_csv(dynClient): +def test_crud_with_starting_csv(): namespace = "cli-fvt-4" # Note: This test assumes a specific CSV version exists in the catalog # You may need to adjust the version based on what's available @@ -134,7 +127,7 @@ def test_crud_with_starting_csv(dynClient): ocp.deleteNamespace(dynClient, namespace) -def test_crud_with_manual_approval_and_starting_csv(dynClient): +def test_crud_with_manual_approval_and_starting_csv(): """ Test that when installPlanApproval is Manual and startingCSV is specified, the first InstallPlan is automatically approved to reach the startingCSV. From a949d7c6b7cab23aae0358fb985f3654744c3d12 Mon Sep 17 00:00:00 2001 From: nehasangwai-ibm Date: Fri, 22 May 2026 21:13:19 +0530 Subject: [PATCH 3/4] [patch] updated secret baseline --- .secrets.baseline | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index 3f9e3a56..38ff60d5 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "^.secrets.baseline$", "lines": null }, - "generated_at": "2026-05-21T00:57:00Z", + "generated_at": "2026-05-22T15:42:35Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -178,7 +178,7 @@ "hashed_secret": "94f5ed592906089c107208b29e178ddf1f9f5143", "is_secret": false, "is_verified": false, - "line_number": 42, + "line_number": 35, "type": "Secret Keyword", "verified_result": null }, @@ -186,7 +186,7 @@ "hashed_secret": "a9410d9785f49750b9f8672794fc288558c1611c", "is_secret": false, "is_verified": false, - "line_number": 55, + "line_number": 48, "type": "Secret Keyword", "verified_result": null } From a334da28f1c8fb13577e38d7aa264973f2848f78 Mon Sep 17 00:00:00 2001 From: nehasangwai-ibm Date: Mon, 25 May 2026 18:31:48 +0530 Subject: [PATCH 4/4] [patch] .py files kept the same --- .secrets.baseline | 6 +++--- test/src/test_mas.py | 27 +++++++++++++++++---------- test/src/test_olm.py | 27 +++++++++++++++++---------- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index 38ff60d5..3f9e3a56 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "^.secrets.baseline$", "lines": null }, - "generated_at": "2026-05-22T15:42:35Z", + "generated_at": "2026-05-21T00:57:00Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -178,7 +178,7 @@ "hashed_secret": "94f5ed592906089c107208b29e178ddf1f9f5143", "is_secret": false, "is_verified": false, - "line_number": 35, + "line_number": 42, "type": "Secret Keyword", "verified_result": null }, @@ -186,7 +186,7 @@ "hashed_secret": "a9410d9785f49750b9f8672794fc288558c1611c", "is_secret": false, "is_verified": false, - "line_number": 48, + "line_number": 55, "type": "Secret Keyword", "verified_result": null } diff --git a/test/src/test_mas.py b/test/src/test_mas.py index 3902a1e7..5a775e30 100644 --- a/test/src/test_mas.py +++ b/test/src/test_mas.py @@ -8,6 +8,7 @@ # # ***************************************************************************** +import pytest from openshift import dynamic from kubernetes import config from kubernetes.client import api_client @@ -15,12 +16,18 @@ from mas.devops import mas -dynClient = dynamic.DynamicClient( - api_client.ApiClient(configuration=config.load_kube_config()) -) +pytestmark = pytest.mark.openshift -def test_entitlement(): +@pytest.fixture(scope="module") +def dynClient(): + """Create DynamicClient for OpenShift cluster access.""" + return dynamic.DynamicClient( + api_client.ApiClient(configuration=config.load_kube_config()) + ) + + +def test_entitlement(dynClient): icrUsername = "testing-i" icrPassword = "not-a-real-password-i" @@ -30,7 +37,7 @@ def test_entitlement(): assert secret.metadata.name == "ibm-entitlement" -def test_entitlement_with_artifactory(): +def test_entitlement_with_artifactory(dynClient): artifactoryUsername = "testing-a" artifactoryPassword = "not-a-real-password-a" @@ -43,7 +50,7 @@ def test_entitlement_with_artifactory(): assert secret.metadata.name == "ibm-entitlement" -def test_entitlement_alt_name(): +def test_entitlement_alt_name(dynClient): icrUsername = "testing-i" icrPassword = "not-a-real-password-i" @@ -53,23 +60,23 @@ def test_entitlement_alt_name(): assert secret.metadata.name == "ibm-entitlement-key" -def test_get_channel(): +def test_get_channel(dynClient): channel = mas.getMasChannel(dynClient, "doesnotexist") assert channel is None -def test_is_airgap_install(): +def test_is_airgap_install(dynClient): # The cluster we are using to test with does not have the MAS ICSP or IDMS installed assert mas.isAirgapInstall(dynClient) is False assert mas.isAirgapInstall(dynClient, checkICSP=False) is False -def test_get_mas_public_cluster_issuer(): +def test_get_mas_public_cluster_issuer(dynClient): # Test with non-existent instance - should return None issuer = mas.getMasPublicClusterIssuer(dynClient, "doesnotexist") assert issuer is None -# def test_is_app_ready(): +# def test_is_app_ready(dynClient): # mas.waitForAppReady(dynClient, "fvtcpd", "iot") # mas.waitForAppReady(dynClient, "fvtcpd", "iot", "masdev") diff --git a/test/src/test_olm.py b/test/src/test_olm.py index 354a9e2a..e0357356 100644 --- a/test/src/test_olm.py +++ b/test/src/test_olm.py @@ -8,18 +8,25 @@ # # ***************************************************************************** +import pytest from openshift import dynamic from kubernetes import config from kubernetes.client import api_client from mas.devops import olm, ocp -dynClient = dynamic.DynamicClient( - api_client.ApiClient(configuration=config.load_kube_config()) -) +pytestmark = pytest.mark.openshift -def test_get_manifest(): +@pytest.fixture(scope="module") +def dynClient(): + """Create DynamicClient for OpenShift cluster access.""" + return dynamic.DynamicClient( + api_client.ApiClient(configuration=config.load_kube_config()) + ) + + +def test_get_manifest(dynClient): manifest = olm.getPackageManifest(dynClient, "ibm-sls") assert manifest is not None assert manifest.metadata.name == "ibm-sls" @@ -30,12 +37,12 @@ def test_get_manifest(): assert manifest.status.packageName == "ibm-sls" -def test_get_manifest_none(): +def test_get_manifest_none(dynClient): manifest = olm.getPackageManifest(dynClient, "ibm-sls2") assert manifest is None -def test_crud(): +def test_crud(dynClient): namespace = "cli-fvt-1" subscription = olm.applySubscription(dynClient, namespace, "ibm-sls", packageChannel="3.x") assert subscription.metadata.name == "ibm-sls" @@ -62,7 +69,7 @@ def test_crud(): assert failedSubscriptionLookup2 is None -def test_crud_with_config(): +def test_crud_with_config(dynClient): namespace = "cli-fvt-2" # We don't need this, just want to test that it works testConfig = { @@ -81,7 +88,7 @@ def test_crud_with_config(): ocp.deleteNamespace(dynClient, namespace) -def test_crud_with_manual_approval(): +def test_crud_with_manual_approval(dynClient): """ Test that when installPlanApproval is Manual without a startingCSV, an OLMException is raised. @@ -105,7 +112,7 @@ def test_crud_with_manual_approval(): # Test passed - exception was raised as expected -def test_crud_with_starting_csv(): +def test_crud_with_starting_csv(dynClient): namespace = "cli-fvt-4" # Note: This test assumes a specific CSV version exists in the catalog # You may need to adjust the version based on what's available @@ -127,7 +134,7 @@ def test_crud_with_starting_csv(): ocp.deleteNamespace(dynClient, namespace) -def test_crud_with_manual_approval_and_starting_csv(): +def test_crud_with_manual_approval_and_starting_csv(dynClient): """ Test that when installPlanApproval is Manual and startingCSV is specified, the first InstallPlan is automatically approved to reach the startingCSV.