From f740a6d40b2bd994554bc14d9c3d56d62d296d15 Mon Sep 17 00:00:00 2001 From: David Legrand <1110600+davlgd@users.noreply.github.com> Date: Sat, 30 Mar 2024 16:29:28 +0100 Subject: [PATCH] Functional tests: add a parameter for the full site cleaning test (#4877) fixes #4876 The latest `mc rb` test cleans all the site data, and on the demo site, there are sometimes WORM files put in by some users, which leads to a failure. This test should only be run on sites where the user knows he can clean everything without errors. --- functional-tests.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/functional-tests.sh b/functional-tests.sh index f655c153..00ccf2e7 100755 --- a/functional-tests.sh +++ b/functional-tests.sh @@ -64,6 +64,9 @@ if [ -z "${SERVER_ENDPOINT+x}" ]; then ENABLE_HTTPS=1 fi +# If you want to run the complete site cleaning test, set this variable to true +COMPLETE_RB_TEST=true + WORK_DIR="$PWD" DATA_DIR="$MINT_DATA_DIR" if [ -z "$MINT_MODE" ]; then @@ -275,13 +278,15 @@ function test_rb() assert_success "$start_time" "${FUNCNAME[0]}" mc_cmd rb --force "${SERVER_ALIAS}/${bucket1}" # Test rb with --force and --dangerous to remove a site content - assert_success "$start_time" "${FUNCNAME[0]}" mc_cmd mb "${SERVER_ALIAS}/${bucket1}" - assert_success "$start_time" "${FUNCNAME[0]}" mc_cmd mb "${SERVER_ALIAS}/${bucket2}" - assert_success "$start_time" "${FUNCNAME[0]}" mc_cmd cp "${FILE_1_MB}" "${SERVER_ALIAS}/${bucket1}/${object_name}" - assert_success "$start_time" "${FUNCNAME[0]}" mc_cmd cp "${FILE_1_MB}" "${SERVER_ALIAS}/${bucket2}/${object_name}" - assert_failure "$start_time" "${FUNCNAME[0]}" mc_cmd rb --force "${SERVER_ALIAS}/" - assert_success "$start_time" "${FUNCNAME[0]}" mc_cmd rb --force --dangerous "${SERVER_ALIAS}" - + if [ "${COMPLETE_RB_TEST}" == "true" ]; then + assert_success "$start_time" "${FUNCNAME[0]}" mc_cmd mb "${SERVER_ALIAS}/${bucket1}" + assert_success "$start_time" "${FUNCNAME[0]}" mc_cmd mb "${SERVER_ALIAS}/${bucket2}" + assert_success "$start_time" "${FUNCNAME[0]}" mc_cmd cp "${FILE_1_MB}" "${SERVER_ALIAS}/${bucket1}/${object_name}" + assert_success "$start_time" "${FUNCNAME[0]}" mc_cmd cp "${FILE_1_MB}" "${SERVER_ALIAS}/${bucket2}/${object_name}" + assert_failure "$start_time" "${FUNCNAME[0]}" mc_cmd rb --force "${SERVER_ALIAS}/" + assert_success "$start_time" "${FUNCNAME[0]}" mc_cmd rb --force --dangerous "${SERVER_ALIAS}" + fi + log_success "$start_time" "${FUNCNAME[0]}" }