Skip to content

Commit

Permalink
test(robot): ensure pod is running before executing commands
Browse files Browse the repository at this point in the history
Signed-off-by: Yang Chiu <[email protected]>
  • Loading branch information
yangchiu authored and khushboo-rancher committed Jul 16, 2024
1 parent ef8c92d commit afde370
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions e2e/libs/workload/workload.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from workload.constant import WAIT_FOR_POD_STABLE_MAX_RETRY
from workload.constant import WAIT_FOR_POD_KEPT_IN_STATE_TIME
from workload.pod import is_pod_terminated_by_kubelet
from workload.pod import wait_for_pod_status


def get_workload_pod_names(workload_name):
Expand Down Expand Up @@ -76,6 +77,9 @@ def get_workload_persistent_volume_claim_names(workload_name, namespace="default

def write_pod_random_data(pod_name, size_in_mb, file_name,
data_directory="/data", ):

wait_for_pod_status(pod_name, "Running")

data_path = f"{data_directory}/{file_name}"
api = client.CoreV1Api()
write_data_cmd = [
Expand All @@ -92,6 +96,9 @@ def write_pod_random_data(pod_name, size_in_mb, file_name,


def keep_writing_pod_data(pod_name, size_in_mb=256, path="/data/overwritten-data"):

wait_for_pod_status(pod_name, "Running")

api = client.CoreV1Api()
write_cmd = [
'/bin/sh',
Expand All @@ -108,6 +115,9 @@ def keep_writing_pod_data(pod_name, size_in_mb=256, path="/data/overwritten-data


def check_pod_data_checksum(expected_checksum, pod_name, file_name, data_directory="/data"):

wait_for_pod_status(pod_name, "Running")

file_path = f"{data_directory}/{file_name}"
api = client.CoreV1Api()
cmd_get_file_checksum = [
Expand Down

0 comments on commit afde370

Please sign in to comment.