Skip to content

Commit 36d888a

Browse files
committed
ReadWriteOnce and PVC Bound tested
Signed-off-by: Katharina Trentau <[email protected]>
1 parent 292fbd0 commit 36d888a

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

Tests/kaas/k8s-default-storage-class/k8s-default-storage-class-check.py

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
Return codes:
66
0: Default StorageClass is available, and setup to SCS standard
77
1: Not able to connect to k8s api
8+
2: Kubeconfig not set
9+
3: Conflicting Resources
810
911
31: Default storage class has no provisioner
1012
32: None or more then one default Storage Class is defined
@@ -97,7 +99,7 @@ def create_pvc_pod(k8s_api_instance, storage_class):
9799
requests={"storage": "1Gi"},
98100
)
99101
pvc_spec = client.V1PersistentVolumeClaimSpec(
100-
access_modes=["ReadWriteMany"],
102+
access_modes=["ReadWriteOnce"],
101103
storage_class_name=storage_class,
102104
resources=pvc_resources,
103105
)
@@ -203,10 +205,11 @@ def check_csi_provider(k8s_core_api):
203205
return_code=33,
204206
)
205207
else:
206-
raise SCSTestException(
207-
f"CSI-Provider: No CSI Provider found.",
208-
return_code=34,
209-
)
208+
logger.info("CSI-Provider: No CSI Provider found.")
209+
# raise SCSTestException(
210+
# "CSI-Provider: No CSI Provider found.",
211+
# return_code=34,
212+
# )
210213
return 0
211214

212215

@@ -359,33 +362,23 @@ def main(argv):
359362
except ApiException as api_exception:
360363
if api_exception.status == 409:
361364
logger.info(
362-
"(409) conflicting resources, "
365+
"conflicting resources, "
363366
"try to clean up left overs, then start again"
364367
)
365-
# return_code = create_pvc_pod(k8s_core_api, default_class_name)
366-
env.return_code = 1
368+
env.return_code = 3
367369
env.return_message = "(409) conflicting resources"
368370
return
369371
else:
370372
logger.info(f"An API error occurred: {api_exception}")
371373
env.return_code = 1
372374

373-
# Check if default_persistent volume has ReadWriteOnce defined (MANDATORY)
374-
try:
375-
logger.info("check_default_persistentvolume_readwriteonce()")
375+
logger.info(
376+
"Check if default_persistent volume has ReadWriteOnce defined (MANDATORY)"
377+
)
378+
env.return_code = check_default_persistentvolumeclaim_readwriteonce(
379+
k8s_core_api
380+
)
376381

377-
env.return_code = check_default_persistentvolumeclaim_readwriteonce(
378-
k8s_core_api
379-
)
380-
# this might be to much
381-
except SCSTestException as test_exception:
382-
logger.error(f"L{inspect.currentframe().f_lineno} {test_exception}")
383-
env.return_message = f"{test_exception}"
384-
env.return_code = test_exception.return_code
385-
except Exception as exception_message:
386-
logger.info(f"{exception_message}")
387-
env.return_message = f"{exception_message}"
388-
env.return_code = 1
389382
env.return_code = check_csi_provider(env.k8s_core_api)
390383
logger.debug(f"CSI Provider check: {env.return_code}")
391384
return env.return_code

0 commit comments

Comments
 (0)