Skip to content

Commit

Permalink
Add a few retries to the first MC command
Browse files Browse the repository at this point in the history
  • Loading branch information
bbockelm committed Oct 21, 2024
1 parent 9126c73 commit 3e8ff1e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/s3-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 3e8ff1e

Please sign in to comment.