1717
1818pytestmark = pytest .mark .openshift
1919
20- dynClient = dynamic .DynamicClient (
21- api_client .ApiClient (configuration = config .load_kube_config ())
22- )
20+
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+ )
2327
2428
25- def test_get_manifest ():
29+ def test_get_manifest (dynClient ):
2630 manifest = olm .getPackageManifest (dynClient , "ibm-sls" )
2731 assert manifest is not None
2832 assert manifest .metadata .name == "ibm-sls"
@@ -33,12 +37,12 @@ def test_get_manifest():
3337 assert manifest .status .packageName == "ibm-sls"
3438
3539
36- def test_get_manifest_none ():
40+ def test_get_manifest_none (dynClient ):
3741 manifest = olm .getPackageManifest (dynClient , "ibm-sls2" )
3842 assert manifest is None
3943
4044
41- def test_crud ():
45+ def test_crud (dynClient ):
4246 namespace = "cli-fvt-1"
4347 subscription = olm .applySubscription (dynClient , namespace , "ibm-sls" , packageChannel = "3.x" )
4448 assert subscription .metadata .name == "ibm-sls"
@@ -65,7 +69,7 @@ def test_crud():
6569 assert failedSubscriptionLookup2 is None
6670
6771
68- def test_crud_with_config ():
72+ def test_crud_with_config (dynClient ):
6973 namespace = "cli-fvt-2"
7074 # We don't need this, just want to test that it works
7175 testConfig = {
@@ -84,7 +88,7 @@ def test_crud_with_config():
8488 ocp .deleteNamespace (dynClient , namespace )
8589
8690
87- def test_crud_with_manual_approval ():
91+ def test_crud_with_manual_approval (dynClient ):
8892 """
8993 Test that when installPlanApproval is Manual without a startingCSV,
9094 an OLMException is raised.
@@ -108,7 +112,7 @@ def test_crud_with_manual_approval():
108112 # Test passed - exception was raised as expected
109113
110114
111- def test_crud_with_starting_csv ():
115+ def test_crud_with_starting_csv (dynClient ):
112116 namespace = "cli-fvt-4"
113117 # Note: This test assumes a specific CSV version exists in the catalog
114118 # You may need to adjust the version based on what's available
@@ -130,7 +134,7 @@ def test_crud_with_starting_csv():
130134 ocp .deleteNamespace (dynClient , namespace )
131135
132136
133- def test_crud_with_manual_approval_and_starting_csv ():
137+ def test_crud_with_manual_approval_and_starting_csv (dynClient ):
134138 """
135139 Test that when installPlanApproval is Manual and startingCSV is specified,
136140 the first InstallPlan is automatically approved to reach the startingCSV.
0 commit comments