From d62e0b915403e32cd0317ac5c760f2cdbe54a9bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Gull=C3=B3n?= Date: Wed, 13 Apr 2022 08:45:39 +0200 Subject: [PATCH] Improve check to validate if the file is created for PVC scenario (#224) * improve check to validate if the file is created * fixing style --- kraken/pvc/pvc_scenario.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kraken/pvc/pvc_scenario.py b/kraken/pvc/pvc_scenario.py index ad2e8352..d9e687e7 100644 --- a/kraken/pvc/pvc_scenario.py +++ b/kraken/pvc/pvc_scenario.py @@ -142,7 +142,13 @@ pvc_name: '%s'\npod_name: '%s'\nnamespace: '%s'\ntarget_fill_percentage: '%s%%'\ logging.debug("Create temp file in the PVC command:\n %s" % command) response = kubecli.exec_cmd_in_pod(command, pod_name, namespace, container_name, "sh") logging.info("\n" + str(response)) - if "copied" in str(response).lower(): + + # Check if file is created + command = "ls %s" % (str(mount_path)) + logging.debug("Check file is created command:\n %s" % command) + response = kubecli.exec_cmd_in_pod(command, pod_name, namespace, container_name, "sh") + logging.info("\n" + str(response)) + if str(file_name).lower() in str(response).lower(): logging.info("%s file successfully created" % (str(full_path))) else: logging.error("Failed to create tmp file with %s size" % (str(file_size))) @@ -161,7 +167,7 @@ pvc_name: '%s'\npod_name: '%s'\nnamespace: '%s'\ntarget_fill_percentage: '%s%%'\ logging.debug("Check temp file is removed command:\n %s" % command) response = kubecli.exec_cmd_in_pod(command, pod_name, namespace, container_name, "sh") logging.info("\n" + str(response)) - if not (file_name in str(response).lower()): + if not (str(file_name).lower() in str(response).lower()): logging.info("Temp file successfully removed") else: logging.error("Failed to delete tmp file with %s size" % (str(file_size)))