diff --git a/test/s3-setup.sh b/test/s3-setup.sh index 558c615..ef17647 100755 --- a/test/s3-setup.sh +++ b/test/s3-setup.sh @@ -179,7 +179,23 @@ echo "minio logs are available at $BINARY_DIR/tests/$TEST_NAME/server.log" echo "Starting configuration of minio" +# Sometimes minio takes a bit to get listening on the socket -- add in some retries to the first command "$MC_BIN" --insecure --config-dir "$MINIO_CLIENTDIR" alias set adminminio "$MINIO_URL" "$MINIO_ROOT_USER" "$MINIO_ROOT_PASSWORD" +RC=$? +IDX=0 +while [ $RC -ne 0 ]; do + sleep 1 + "$MC_BIN" --insecure --config-dir "$MINIO_CLIENTDIR" alias set adminminio "$MINIO_URL" "$MINIO_ROOT_USER" "$MINIO_ROOT_PASSWORD" + RC=$? + IDX=$(($IDX+1)) + if [ $IDX -gt 1 ]; then + echo "Waiting for minio to start ($IDX seconds so far) ..." + fi + if [ $IDX -eq 10 ]; then + echo "minio failed to start - failing" + exit 1 + fi +done "$MC_BIN" --insecure --config-dir "$MINIO_CLIENTDIR" admin user add adminminio "$MINIO_USER" "$MINIO_PASSWORD" "$MC_BIN" --insecure --config-dir "$MINIO_CLIENTDIR" alias set userminio "$MINIO_URL" "$MINIO_USER" "$MINIO_PASSWORD" "$MC_BIN" --insecure --config-dir "$MINIO_CLIENTDIR" admin policy attach adminminio readwrite --user "$MINIO_USER"