88#
99# *****************************************************************************
1010
11+ import pytest
1112from openshift import dynamic
1213from kubernetes import config
1314from kubernetes .client import api_client
1415
1516from mas .devops import olm , ocp
1617
17- dynClient = dynamic .DynamicClient (
18- api_client .ApiClient (configuration = config .load_kube_config ())
19- )
18+ pytestmark = pytest .mark .openshift
2019
2120
22- def test_get_manifest ():
21+ @pytest .fixture (scope = "module" )
22+ def dynClient ():
23+ """Create DynamicClient for OpenShift cluster access."""
24+ return dynamic .DynamicClient (
25+ api_client .ApiClient (configuration = config .load_kube_config ())
26+ )
27+
28+
29+ def test_get_manifest (dynClient ):
2330 manifest = olm .getPackageManifest (dynClient , "ibm-sls" )
2431 assert manifest is not None
2532 assert manifest .metadata .name == "ibm-sls"
@@ -30,12 +37,12 @@ def test_get_manifest():
3037 assert manifest .status .packageName == "ibm-sls"
3138
3239
33- def test_get_manifest_none ():
40+ def test_get_manifest_none (dynClient ):
3441 manifest = olm .getPackageManifest (dynClient , "ibm-sls2" )
3542 assert manifest is None
3643
3744
38- def test_crud ():
45+ def test_crud (dynClient ):
3946 namespace = "cli-fvt-1"
4047 subscription = olm .applySubscription (dynClient , namespace , "ibm-sls" , packageChannel = "3.x" )
4148 assert subscription .metadata .name == "ibm-sls"
@@ -62,7 +69,7 @@ def test_crud():
6269 assert failedSubscriptionLookup2 is None
6370
6471
65- def test_crud_with_config ():
72+ def test_crud_with_config (dynClient ):
6673 namespace = "cli-fvt-2"
6774 # We don't need this, just want to test that it works
6875 testConfig = {
@@ -81,7 +88,7 @@ def test_crud_with_config():
8188 ocp .deleteNamespace (dynClient , namespace )
8289
8390
84- def test_crud_with_manual_approval ():
91+ def test_crud_with_manual_approval (dynClient ):
8592 """
8693 Test that when installPlanApproval is Manual without a startingCSV,
8794 an OLMException is raised.
@@ -105,7 +112,7 @@ def test_crud_with_manual_approval():
105112 # Test passed - exception was raised as expected
106113
107114
108- def test_crud_with_starting_csv ():
115+ def test_crud_with_starting_csv (dynClient ):
109116 namespace = "cli-fvt-4"
110117 # Note: This test assumes a specific CSV version exists in the catalog
111118 # You may need to adjust the version based on what's available
@@ -127,7 +134,7 @@ def test_crud_with_starting_csv():
127134 ocp .deleteNamespace (dynClient , namespace )
128135
129136
130- def test_crud_with_manual_approval_and_starting_csv ():
137+ def test_crud_with_manual_approval_and_starting_csv (dynClient ):
131138 """
132139 Test that when installPlanApproval is Manual and startingCSV is specified,
133140 the first InstallPlan is automatically approved to reach the startingCSV.
0 commit comments