Skip to content

Commit

Permalink
Make decommission test more reliable
Browse files Browse the repository at this point in the history
  • Loading branch information
cniackz committed Mar 7, 2024
1 parent f8831e3 commit 4214a68
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion testing/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function wait_for_n_tenant_pods() {
try kubectl wait --namespace "$NAMESPACE" \
--for=condition=ready pod \
--selector v1.min.io/tenant="$TENANT_NAME" \
--timeout=300s
--timeout=600s
}

# copies the script to the pod.
Expand Down
11 changes: 6 additions & 5 deletions testing/decommission-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ function main() {

echo -e "\n\n"
echo "decommission-test.sh: main(): Verify data after decommission:"
execute_pod_script verify-data.sh "${DEBUG_POD_NAME}"
RESULT=$(read_script_result default "${DEBUG_POD_NAME}" verify-data.log)
RESULT="script failed"
while [ "$RESULT" != "script passed" ]; do
echo "Verifying data after the decommission loop"
execute_pod_script verify-data.sh "${DEBUG_POD_NAME}"
RESULT=$(read_script_result default "${DEBUG_POD_NAME}" verify-data.log)
done
teardown distributed
if [ "$RESULT" != "script passed" ]; then
exit 1
fi
}

main "$@"
8 changes: 5 additions & 3 deletions testing/verify-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ echo "Verify Data in remaining pool(s) after decommission test"
echo "Get data and verify files are still present as they were uploaded"
FILE_TO_SAVE_MC_OUTPUT=tmp.log
rm -rf $FILE_TO_SAVE_MC_OUTPUT
mc ls myminio/bucket >$FILE_TO_SAVE_MC_OUTPUT 2>&1
mc ls myminio/bucket > $FILE_TO_SAVE_MC_OUTPUT 2>&1
RESULT=$(grep -c ERROR $FILE_TO_SAVE_MC_OUTPUT | awk -F' ' '{print $1}')
while [ "$RESULT" == "1" ]; do
echo "There was an error in mc ls, retrying"
mc ls myminio/bucket >$FILE_TO_SAVE_MC_OUTPUT 2>&1
mc ls myminio/bucket > $FILE_TO_SAVE_MC_OUTPUT 2>&1
RESULT=$(grep -c ERROR $FILE_TO_SAVE_MC_OUTPUT | awk -F' ' '{print $1}')
echo "${RESULT}"
done
echo "mc ls was successful"
mc ls myminio/bucket # To see what is listed

for i in {1..10}; do
RESULT=$(grep -c file"$i" "${FILE_TO_SAVE_MC_OUTPUT}")
if [ "${RESULT}" -eq 0 ]; then
echo "fail, there is a missing file: file${i}"
echo "exiting with 1 as there is missing file..."
echo "script failed" > verify-data.log
exit 1
fi
done
echo "script passed" >verify-data.log
echo "script passed" > verify-data.log

0 comments on commit 4214a68

Please sign in to comment.