From e947a844c9c55c4965c68032f9f5c8961f761be8 Mon Sep 17 00:00:00 2001 From: Poorna Date: Sat, 18 May 2024 11:19:01 -0700 Subject: [PATCH] Fix test scripts to use mc ready (#19768) --- buildscripts/disable-root.sh | 1 + buildscripts/minio-iam-ldap-upgrade-import-test.sh | 2 ++ docs/bucket/replication/delete-replication.sh | 3 +++ .../setup_2site_existing_replication.sh | 5 +++-- docs/bucket/replication/setup_3site_replication.sh | 6 ++++-- .../replication/setup_ilm_expiry_replication.sh | 6 +++++- docs/bucket/replication/sio-error.sh | 2 ++ docs/bucket/versioning/versioning-tests.sh | 2 -- docs/distributed/decom-compressed-sse-s3.sh | 7 ++++--- docs/distributed/decom-encrypted-kes.sh | 6 ++++-- docs/distributed/decom-encrypted-sse-s3.sh | 8 ++++---- docs/distributed/decom-encrypted.sh | 10 +++++----- docs/distributed/decom.sh | 14 ++++++++------ docs/distributed/distributed-from-config-file.sh | 2 -- docs/iam/policies/pbac-tests.sh | 2 +- docs/site-replication/run-multi-site-ldap.sh | 6 ++++-- docs/site-replication/run-multi-site-minio-idp.sh | 9 +++++++-- docs/site-replication/run-multi-site-oidc.sh | 6 ++++-- .../run-sse-kms-object-replication.sh | 5 +++-- ...run-ssec-object-replication-with-compression.sh | 5 +++-- .../run-ssec-object-replication.sh | 5 +++-- 21 files changed, 70 insertions(+), 42 deletions(-) diff --git a/buildscripts/disable-root.sh b/buildscripts/disable-root.sh index 8387a7c43..bbd13836f 100755 --- a/buildscripts/disable-root.sh +++ b/buildscripts/disable-root.sh @@ -32,6 +32,7 @@ fi set +e export MC_HOST_minioadm=http://minioadmin:minioadmin@localhost:9100/ +./mc ready minioadm ./mc ls minioadm/ diff --git a/buildscripts/minio-iam-ldap-upgrade-import-test.sh b/buildscripts/minio-iam-ldap-upgrade-import-test.sh index a8f3a6cf3..92bab6252 100755 --- a/buildscripts/minio-iam-ldap-upgrade-import-test.sh +++ b/buildscripts/minio-iam-ldap-upgrade-import-test.sh @@ -56,6 +56,7 @@ create_iam_content_in_old_minio() { set -x mc alias set old-minio http://localhost:9000 minioadmin minioadmin + mc ready old-minio mc idp ldap add old-minio \ server_addr=localhost:1389 \ server_insecure=on \ @@ -87,6 +88,7 @@ import_iam_content_in_new_minio() { set -x mc alias set new-minio http://localhost:9000 minioadmin minioadmin echo "BEFORE IMPORT mappings:" + mc ready new-minio mc idp ldap policy entities new-minio mc admin cluster iam import new-minio ./old-minio-iam-info.zip echo "AFTER IMPORT mappings:" diff --git a/docs/bucket/replication/delete-replication.sh b/docs/bucket/replication/delete-replication.sh index 2eadf52f7..a2d0241ea 100755 --- a/docs/bucket/replication/delete-replication.sh +++ b/docs/bucket/replication/delete-replication.sh @@ -59,6 +59,9 @@ sleep 3 export MC_HOST_myminio1=http://minioadmin:minioadmin@localhost:9001 export MC_HOST_myminio2=http://minioadmin:minioadmin@localhost:9002 +./mc ready myminio1 +./mc ready myminio2 + ./mc mb myminio1/testbucket/ ./mc version enable myminio1/testbucket/ ./mc mb myminio2/testbucket/ diff --git a/docs/bucket/replication/setup_2site_existing_replication.sh b/docs/bucket/replication/setup_2site_existing_replication.sh index 5a5e026c0..bf68a306d 100755 --- a/docs/bucket/replication/setup_2site_existing_replication.sh +++ b/docs/bucket/replication/setup_2site_existing_replication.sh @@ -56,11 +56,12 @@ minio server --address 127.0.0.1:9003 "http://127.0.0.1:9003/tmp/multisiteb/data minio server --address 127.0.0.1:9004 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \ "http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_2.log 2>&1 & -sleep 10s - export MC_HOST_sitea=http://minio:minio123@127.0.0.1:9001 export MC_HOST_siteb=http://minio:minio123@127.0.0.1:9004 +./mc ready sitea +./mc ready siteb + ./mc mb sitea/bucket ## Create 100 files diff --git a/docs/bucket/replication/setup_3site_replication.sh b/docs/bucket/replication/setup_3site_replication.sh index c348a63ad..58da4315c 100755 --- a/docs/bucket/replication/setup_3site_replication.sh +++ b/docs/bucket/replication/setup_3site_replication.sh @@ -68,12 +68,14 @@ minio server --address 127.0.0.1:9005 "http://127.0.0.1:9005/tmp/multisitec/data minio server --address 127.0.0.1:9006 "http://127.0.0.1:9005/tmp/multisitec/data/disterasure/xl{1...4}" \ "http://127.0.0.1:9006/tmp/multisitec/data/disterasure/xl{5...8}" >/tmp/sitec_2.log 2>&1 & -sleep 30 - export MC_HOST_sitea=http://minio:minio123@127.0.0.1:9001 export MC_HOST_siteb=http://minio:minio123@127.0.0.1:9004 export MC_HOST_sitec=http://minio:minio123@127.0.0.1:9006 +./mc ready sitea +./mc ready siteb +./mc ready sitec + ./mc mb sitea/bucket ./mc version enable sitea/bucket ./mc mb -l sitea/olockbucket diff --git a/docs/bucket/replication/setup_ilm_expiry_replication.sh b/docs/bucket/replication/setup_ilm_expiry_replication.sh index eca69d55f..eba35e9e7 100755 --- a/docs/bucket/replication/setup_ilm_expiry_replication.sh +++ b/docs/bucket/replication/setup_ilm_expiry_replication.sh @@ -67,13 +67,17 @@ minio server --address 127.0.0.1:9008 "http://127.0.0.1:9007/tmp/multisited/data "http://127.0.0.1:9008/tmp/multisited/data/disterasure/xl{5...8}" >/tmp/sited_2.log 2>&1 & # Wait to make sure all MinIO instances are up -sleep 30s export MC_HOST_sitea=http://minio:minio123@127.0.0.1:9001 export MC_HOST_siteb=http://minio:minio123@127.0.0.1:9004 export MC_HOST_sitec=http://minio:minio123@127.0.0.1:9006 export MC_HOST_sited=http://minio:minio123@127.0.0.1:9008 +./mc ready sitea +./mc ready siteb +./mc ready sitec +./mc ready sited + ./mc mb sitea/bucket ./mc mb sitec/bucket diff --git a/docs/bucket/replication/sio-error.sh b/docs/bucket/replication/sio-error.sh index f7ebe323e..280710495 100755 --- a/docs/bucket/replication/sio-error.sh +++ b/docs/bucket/replication/sio-error.sh @@ -35,6 +35,8 @@ sleep 10 ./mc alias set myminio1 http://localhost:9001 minioadmin minioadmin ./mc alias set myminio2 http://localhost:9101 minioadmin minioadmin +./mc ready myminio1 +./mc ready myminio2 sleep 1 ./mc mb myminio1/testbucket/ --with-lock diff --git a/docs/bucket/versioning/versioning-tests.sh b/docs/bucket/versioning/versioning-tests.sh index e42694bb6..47caced31 100755 --- a/docs/bucket/versioning/versioning-tests.sh +++ b/docs/bucket/versioning/versioning-tests.sh @@ -46,8 +46,6 @@ minio server -S /tmp/no-certs --address ":9001" "http://localhost:9001/tmp/multi minio server -S /tmp/no-certs --address ":9002" "http://localhost:9001/tmp/multisitea/data/disterasure/xl{1...4}" \ "http://localhost:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_2.log 2>&1 & -sleep 5 - export MC_HOST_sitea=http://minioadmin:minioadmin@localhost:9002 ./mc ready sitea diff --git a/docs/distributed/decom-compressed-sse-s3.sh b/docs/distributed/decom-compressed-sse-s3.sh index 48191980f..b1b5ce744 100755 --- a/docs/distributed/decom-compressed-sse-s3.sh +++ b/docs/distributed/decom-compressed-sse-s3.sh @@ -24,7 +24,7 @@ export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9000/" (minio server http://localhost:9000/tmp/xl/{1...10}/disk{0...1} 2>&1 >/dev/null) & pid=$! -sleep 30 +./mc ready myminio ./mc admin user add myminio/ minio123 minio123 ./mc admin user add myminio/ minio12345 minio12345 @@ -59,6 +59,7 @@ pid_1=$! pid_2=$! sleep 30 +./mc ready myminio expanded_user_count=$(./mc admin user list myminio/ | wc -l) expanded_policy_count=$(./mc admin policy list myminio/ | wc -l) @@ -100,10 +101,10 @@ sleep 5 (minio server --address ":9001" http://localhost:9001/tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/removed.log) & pid=$! -sleep 30 - export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9001/" +./mc ready myminio + decom_user_count=$(./mc admin user list myminio/ | wc -l) decom_policy_count=$(./mc admin policy list myminio/ | wc -l) diff --git a/docs/distributed/decom-encrypted-kes.sh b/docs/distributed/decom-encrypted-kes.sh index 59ba4f58c..fb519b8ac 100755 --- a/docs/distributed/decom-encrypted-kes.sh +++ b/docs/distributed/decom-encrypted-kes.sh @@ -39,7 +39,7 @@ export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9000/" (minio server http://localhost:9000/tmp/xl/{1...10}/disk{0...1} 2>&1 >/dev/null) & pid=$! -sleep 30s +./mc ready myminio ./mc admin user add myminio/ minio123 minio123 ./mc admin user add myminio/ minio12345 minio12345 @@ -80,7 +80,7 @@ pid_1=$! (minio server --address ":9001" http://localhost:9000/tmp/xl/{1...10}/disk{0...1} http://localhost:9001/tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/expanded_2.log) & pid_2=$! -sleep 30s +./mc ready myminio expanded_user_count=$(./mc admin user list myminio/ | wc -l) expanded_policy_count=$(./mc admin policy list myminio/ | wc -l) @@ -150,6 +150,8 @@ sleep 30s export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9001/" +./mc ready myminio + decom_user_count=$(./mc admin user list myminio/ | wc -l) decom_policy_count=$(./mc admin policy list myminio/ | wc -l) diff --git a/docs/distributed/decom-encrypted-sse-s3.sh b/docs/distributed/decom-encrypted-sse-s3.sh index 272278255..80ab72c5c 100755 --- a/docs/distributed/decom-encrypted-sse-s3.sh +++ b/docs/distributed/decom-encrypted-sse-s3.sh @@ -19,7 +19,7 @@ export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9000/" (minio server http://localhost:9000/tmp/xl/{1...10}/disk{0...1} 2>&1 >/dev/null) & pid=$! -sleep 30 +./mc ready myminio ./mc admin user add myminio/ minio123 minio123 ./mc admin user add myminio/ minio12345 minio12345 @@ -55,7 +55,7 @@ pid_1=$! (minio server --address ":9001" http://localhost:9000/tmp/xl/{1...10}/disk{0...1} http://localhost:9001/tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/expanded_2.log) & pid_2=$! -sleep 30 +./mc ready myminio expanded_user_count=$(./mc admin user list myminio/ | wc -l) expanded_policy_count=$(./mc admin policy list myminio/ | wc -l) @@ -104,10 +104,10 @@ sleep 5 (minio server --address ":9001" http://localhost:9001/tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/removed.log) & pid=$! -sleep 30 - export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9001/" +./mc ready myminio + decom_user_count=$(./mc admin user list myminio/ | wc -l) decom_policy_count=$(./mc admin policy list myminio/ | wc -l) diff --git a/docs/distributed/decom-encrypted.sh b/docs/distributed/decom-encrypted.sh index b1169ceea..32004675e 100755 --- a/docs/distributed/decom-encrypted.sh +++ b/docs/distributed/decom-encrypted.sh @@ -19,10 +19,10 @@ export MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl (minio server http://localhost:9000/tmp/xl/{1...10}/disk{0...1} 2>&1 >/dev/null) & pid=$! -sleep 30 - export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9000/" +./mc ready myminio + ./mc admin user add myminio/ minio123 minio123 ./mc admin user add myminio/ minio12345 minio12345 @@ -55,7 +55,7 @@ pid_1=$! (minio server --address ":9001" http://localhost:9000/tmp/xl/{1...10}/disk{0...1} http://localhost:9001/tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/expanded_2.log) & pid_2=$! -sleep 30 +./mc ready myminio expanded_user_count=$(./mc admin user list myminio/ | wc -l) expanded_policy_count=$(./mc admin policy list myminio/ | wc -l) @@ -97,10 +97,10 @@ sleep 5 (minio server --address ":9001" http://localhost:9001/tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/removed.log) & pid=$! -sleep 30 - export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9001/" +./mc ready myminio + decom_user_count=$(./mc admin user list myminio/ | wc -l) decom_policy_count=$(./mc admin policy list myminio/ | wc -l) diff --git a/docs/distributed/decom.sh b/docs/distributed/decom.sh index ee3182ee5..3d347cced 100755 --- a/docs/distributed/decom.sh +++ b/docs/distributed/decom.sh @@ -19,10 +19,10 @@ export MINIO_SCANNER_SPEED=fastest (minio server http://localhost:9000/tmp/xl/{1...10}/disk{0...1} 2>&1 >/tmp/decom.log) & pid=$! -sleep 30 - export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9000/" +./mc ready myminio + ./mc admin user add myminio/ minio123 minio123 ./mc admin user add myminio/ minio12345 minio12345 @@ -49,10 +49,11 @@ policy_count=$(./mc admin policy list myminio/ | wc -l) ## create a warm tier instance (minio server /tmp/xltier/{1...4}/disk{0...1} --address :9002 2>&1 >/dev/null) & -sleep 30 export MC_HOST_mytier="http://minioadmin:minioadmin@localhost:9002/" +./mc ready myminio + ./mc mb -l myminio/bucket2 ./mc mb -l mytier/tiered @@ -77,7 +78,7 @@ pid_1=$! (minio server --address ":9001" http://localhost:9000/tmp/xl/{1...10}/disk{0...1} http://localhost:9001/tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/expanded_2.log) & pid_2=$! -sleep 30 +./mc ready myminio expanded_user_count=$(./mc admin user list myminio/ | wc -l) expanded_policy_count=$(./mc admin policy list myminio/ | wc -l) @@ -124,10 +125,11 @@ sleep 5 (minio server --address ":9001" http://localhost:9001/tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/removed.log) & pid=$! -sleep 30 - +sleep 5 export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9001/" +./mc ready myminio + decom_user_count=$(./mc admin user list myminio/ | wc -l) decom_policy_count=$(./mc admin policy list myminio/ | wc -l) diff --git a/docs/distributed/distributed-from-config-file.sh b/docs/distributed/distributed-from-config-file.sh index 68e68ae0c..a60e98b46 100755 --- a/docs/distributed/distributed-from-config-file.sh +++ b/docs/distributed/distributed-from-config-file.sh @@ -58,8 +58,6 @@ site3_pid=$! minio server --config /tmp/minio.configfile.4 >/tmp/minio4_1.log 2>&1 & site4_pid=$! -sleep 30 - export MC_HOST_minio1=http://minr0otUS2r:pBU94AGAY85e@localhost:9001 export MC_HOST_minio3=http://minr0otUS2r:pBU94AGAY85e@localhost:9003 diff --git a/docs/iam/policies/pbac-tests.sh b/docs/iam/policies/pbac-tests.sh index 13543ca8c..c645db281 100755 --- a/docs/iam/policies/pbac-tests.sh +++ b/docs/iam/policies/pbac-tests.sh @@ -39,7 +39,7 @@ export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9000/" (minio server http://localhost:9000/tmp/xl/{1...10}/disk{0...1} 2>&1 >/dev/null) & pid=$! -sleep 30s +./mc ready myminio ./mc admin user add myminio/ minio123 minio123 diff --git a/docs/site-replication/run-multi-site-ldap.sh b/docs/site-replication/run-multi-site-ldap.sh index 5bb108288..46f41503b 100755 --- a/docs/site-replication/run-multi-site-ldap.sh +++ b/docs/site-replication/run-multi-site-ldap.sh @@ -59,12 +59,14 @@ site2_pid=$! minio server --config-dir /tmp/minio-ldap --address ":9003" /tmp/minio-ldap-idp3/{1...4} >/tmp/minio3_1.log 2>&1 & site3_pid=$! -sleep 10 - export MC_HOST_minio1=http://minio:minio123@localhost:9001 export MC_HOST_minio2=http://minio:minio123@localhost:9002 export MC_HOST_minio3=http://minio:minio123@localhost:9003 +./mc ready minio1 +./mc ready minio2 +./mc ready minio3 + ./mc admin replicate add minio1 minio2 minio3 ./mc idp ldap policy attach minio1 consoleAdmin --user="uid=dillon,ou=people,ou=swengg,dc=min,dc=io" diff --git a/docs/site-replication/run-multi-site-minio-idp.sh b/docs/site-replication/run-multi-site-minio-idp.sh index 7ea34001c..408dd3f10 100755 --- a/docs/site-replication/run-multi-site-minio-idp.sh +++ b/docs/site-replication/run-multi-site-minio-idp.sh @@ -59,8 +59,6 @@ site3_pid1=$! minio server --config-dir /tmp/minio-internal --address ":9030" http://localhost:9003/tmp/minio-internal-idp3/{1...4} http://localhost:9030/tmp/minio-internal-idp3/{5...8} >/tmp/minio3_2.log 2>&1 & site3_pid2=$! -sleep 10 - export MC_HOST_minio1=http://minio:minio123@localhost:9001 export MC_HOST_minio2=http://minio:minio123@localhost:9002 export MC_HOST_minio3=http://minio:minio123@localhost:9003 @@ -69,6 +67,13 @@ export MC_HOST_minio10=http://minio:minio123@localhost:9010 export MC_HOST_minio20=http://minio:minio123@localhost:9020 export MC_HOST_minio30=http://minio:minio123@localhost:9030 +./mc ready minio1 +./mc ready minio2 +./mc ready minio3 +./mc ready minio10 +./mc ready minio20 +./mc ready minio30 + ./mc admin replicate add minio1 minio2 site_enabled=$(./mc admin replicate info minio1) diff --git a/docs/site-replication/run-multi-site-oidc.sh b/docs/site-replication/run-multi-site-oidc.sh index 2add4695b..68c6ab937 100755 --- a/docs/site-replication/run-multi-site-oidc.sh +++ b/docs/site-replication/run-multi-site-oidc.sh @@ -57,12 +57,14 @@ if [ ! -f ./mc ]; then chmod +x mc fi -sleep 10 - export MC_HOST_minio1=http://minio:minio123@localhost:9001 export MC_HOST_minio2=http://minio:minio123@localhost:9002 export MC_HOST_minio3=http://minio:minio123@localhost:9003 +./mc ready minio1 +./mc ready minio2 +./mc ready minio3 + ./mc admin replicate add minio1 minio2 minio3 ./mc admin policy create minio1 projecta ./docs/site-replication/rw.json diff --git a/docs/site-replication/run-sse-kms-object-replication.sh b/docs/site-replication/run-sse-kms-object-replication.sh index 032a39083..74879b39f 100755 --- a/docs/site-replication/run-sse-kms-object-replication.sh +++ b/docs/site-replication/run-sse-kms-object-replication.sh @@ -51,11 +51,12 @@ if [ ! -f ./mc ]; then echo "done" fi -sleep 10 - export MC_HOST_minio1=https://minio:minio123@localhost:9001 export MC_HOST_minio2=https://minio:minio123@localhost:9002 +./mc ready minio1 --insecure +./mc ready minio2 --insecure + # Prepare data for tests echo -n "Preparing test data ..." mkdir -p /tmp/data diff --git a/docs/site-replication/run-ssec-object-replication-with-compression.sh b/docs/site-replication/run-ssec-object-replication-with-compression.sh index 81ced9612..dacbd7af5 100755 --- a/docs/site-replication/run-ssec-object-replication-with-compression.sh +++ b/docs/site-replication/run-ssec-object-replication-with-compression.sh @@ -50,11 +50,12 @@ if [ ! -f ./mc ]; then echo "done" fi -sleep 10 - export MC_HOST_minio1=https://minio:minio123@localhost:9001 export MC_HOST_minio2=https://minio:minio123@localhost:9002 +./mc ready minio1 --insecure +./mc ready minio2 --insecure + # Prepare data for tests echo -n "Preparing test data ..." mkdir -p /tmp/data diff --git a/docs/site-replication/run-ssec-object-replication.sh b/docs/site-replication/run-ssec-object-replication.sh index 4507935e9..4fdc786e9 100755 --- a/docs/site-replication/run-ssec-object-replication.sh +++ b/docs/site-replication/run-ssec-object-replication.sh @@ -50,11 +50,12 @@ if [ ! -f ./mc ]; then echo "done" fi -sleep 10 - export MC_HOST_minio1=https://minio:minio123@localhost:9001 export MC_HOST_minio2=https://minio:minio123@localhost:9002 +./mc ready minio1 --insecure +./mc ready minio2 --insecure + # Prepare data for tests echo -n "Preparing test data ..." mkdir -p /tmp/data