Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make decommission test more reliable #2018

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 16 additions & 2 deletions testing/decommission-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,26 @@ 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" # The initial state is failure.
counter=0
while [ $counter -lt 60 ]; do
echo "Decommission Check Attempt: $counter"
((counter++))
execute_pod_script verify-data.sh "${DEBUG_POD_NAME}"
RESULT=$(read_script_result default "${DEBUG_POD_NAME}" verify-data.log)
if [ "$RESULT" == "script passed" ]; then
break
fi
sleep 1
done
teardown distributed
if [ "$RESULT" != "script passed" ]; then
echo "Decommission Test Failed"
exit 1
fi
echo "Decomission Test Passed"
exit 0

}

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
Loading