Skip to content

Commit

Permalink
successfully tested csi-provider function
Browse files Browse the repository at this point in the history
Signed-off-by: Katharina Trentau <katharina.trentau@cloudandheat.com>
  • Loading branch information
fraugabel committed Nov 11, 2024
1 parent 78872c5 commit 5ff4bda
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,16 @@ def check_csi_provider(k8s_core_api, allowed_csi_prov=ALLOWED_CSI_PROV):
csi_list = []
for pod in pods.items:
if "csi" in pod.metadata.name:
if pod.metadata.name in allowed_csi_prov:
if any(provider in pod.metadata.name for provider in allowed_csi_prov):
csi_list.append(pod.metadata.name)
logger.info(f"CSI-Provider: {pod.metadata.name}")
else:
raise SCSTestException(
f"CSI-Provider: {pod.metadata.name} not recommended",
return_code=33,
)
else:
logger.info("CSI-Provider: No CSI Provider found.")
if not csi_list:
logger.info("CSI-Provider: No CSI Provider found.")
return 0


Expand Down Expand Up @@ -297,26 +297,24 @@ def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, traceback):
logger.debug("exiting")
if self.cleanup:
self.clean()
if self.return_code == 0:
self.return_message = "all tests passed"
if isinstance(exc_value, SCSTestException):
self.return_message = exc_value.args[0]
self.return_code = exc_value.return_code
logger.debug(
logger.info(
f"SCSTestException occurred with return_code: {self.return_code}"
)
else:
# No specific exception, handle normally returnmessage aus exception übernehmen, dann kann return_code
logger.debug(f"Exiting the context with return_code: {self.return_code}")
logger.debug(f"{self.return_message}")
logger.info(f"Exiting the context with return_code: {self.return_code}")
logger.info(f"{self.return_message}")

gen_sonobuoy_result_file(
self.return_code, self.return_message, os.path.basename(__file__)
)
logger.debug(f"Exiting the context {self.k8s_core_api}")
if exc_type:
logger.error(f"An exception occurred: {exc_value}")
# Return True if the exception should be suppressed, otherwise False
Expand Down Expand Up @@ -382,7 +380,6 @@ def main(argv):
)

env.return_code = check_csi_provider(env.k8s_core_api)
logger.debug(f"CSI Provider check: {env.return_code}")
return env.return_code


Expand Down

0 comments on commit 5ff4bda

Please sign in to comment.