Skip to content

Commit

Permalink
refactor(negative): rename check_pod_data to reflect function purpose
Browse files Browse the repository at this point in the history
Signed-off-by: Chin-Ya Huang <[email protected]>
  • Loading branch information
c3y1huang committed Nov 1, 2023
1 parent 8a27c2d commit 65092ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions e2e/keywords/workload.resource
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ Keep writing data to statefulset ${idx}
Check deployment ${idx} works
${pod_name} = get_workload_pod_name ${deployment_list}[${idx}]
${pod_data_checksum} = write_pod_random_data ${pod_name} 1024
check_pod_data ${pod_name} ${pod_data_checksum}
check_pod_data_checksum ${pod_name} ${pod_data_checksum}

Check statefulset ${idx} works
${pod_name} = get_workload_pod_name ${statefulset_list}[${idx}]
${pod_data_checksum} = write_pod_random_data ${pod_name} 1024
check_pod_data ${pod_name} ${pod_data_checksum}
check_pod_data_checksum ${pod_name} ${pod_data_checksum}

Wait for statefulset ${idx} stable
wait_for_workload_pod_stable ${statefulset_list}[${idx}]
4 changes: 2 additions & 2 deletions e2e/libs/keywords/workload_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def keep_writing_pod_data(self, pod_name):
def write_pod_random_data(self, pod, size_in_mb):
return write_pod_random_data(pod, size_in_mb)

def check_pod_data(self, pod_name, checksum):
check_pod_data(pod_name, checksum)
def check_pod_data_checksum(self, pod_name, checksum):
check_pod_data_checksum(pod_name, checksum)

def cleanup_deployments(self, deployment_names):
for name in deployment_names:
Expand Down
9 changes: 5 additions & 4 deletions e2e/libs/workload/workload.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ def keep_writing_pod_data(pod_name, size_in_mb=256, path="/data/overwritten-data
logging(f"Created process to keep writing pod {pod_name}")
return res

def check_pod_data(pod_name, checksum, path="/data/random-data"):
def check_pod_data_checksum(pod_name, checksum, path="/data/random-data"):
logging(f"Checking pod {pod_name} data checksum")
api = client.CoreV1Api()
cmd = [
'/bin/sh',
Expand All @@ -284,9 +285,9 @@ def check_pod_data(pod_name, checksum, path="/data/random-data"):
api.connect_get_namespaced_pod_exec, pod_name, 'default',
command=cmd, stderr=True, stdin=False, stdout=True,
tty=False)
logging(f"Got {path} checksum = {_checksum},\
expected checksum = {checksum}")
assert _checksum == checksum
assert _checksum == checksum, \
f"Got {path} checksum = {_checksum}\n" \
f"Expected checksum = {checksum}"

def wait_for_workload_pod_stable(workload_name):
stable_pod = None
Expand Down

0 comments on commit 65092ee

Please sign in to comment.