Skip to content
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
16 changes: 13 additions & 3 deletions .evergreen/mongodb-community-search/start-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,21 @@ docker compose up -d
# Wait for the healthcheck
URL="http://127.0.0.1:8080/healthcheck"

echo "Waiting for the server to be alive and respond with the expected status..."
MAX_ATTEMPTS=5
ATTEMPT=1
set +e
while true; do
echo "Waiting for the server to be alive and respond with the expected status..."
while [ "$ATTEMPT" -le "$MAX_ATTEMPTS" ]; do
echo "Attempt $ATTEMPT of $MAX_ATTEMPTS..."

# Make the request and capture response with detailed debugging
RESPONSE=$(curl --max-time 10 -s "$URL")
CURL_EXIT_CODE=$?

# Check for Curl exit code
if [ "$CURL_EXIT_CODE" -ne 0 ]; then
echo "Curl failed with exit code $CURL_EXIT_CODE, retrying in 2 seconds..."
ATTEMPT=$((ATTEMPT + 1))
sleep 2
continue
fi
Expand All @@ -80,8 +85,13 @@ while true; do
fi

echo "Server not ready yet. Retrying in 2 seconds..."
ATTEMPT=$((ATTEMPT + 1))
sleep 2
done
set -e

docker compose logs

if [ "$ATTEMPT" -gt "$MAX_ATTEMPTS" ]; then
echo "Server did not become ready after $MAX_ATTEMPTS attempts. Failing."
exit 1
fi
7 changes: 7 additions & 0 deletions .evergreen/mongodb-community-search/teardown.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -eu

pushd "$(dirname ${BASH_SOURCE:-$0})" > /dev/null
docker compose down || true
popd > /dev/null
6 changes: 4 additions & 2 deletions .evergreen/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ setup_local_atlas() {
git clone https://github.com/mongodb-labs/drivers-evergreen-tools || true
popd
if [ -z "${COMMUNITY_WITH_SEARCH:-}" ]; then
. $SCRIPT_DIR/../drivers-evergreen-tools/.evergreen/run-orchestration.sh --local-atlas -v
bash $SCRIPT_DIR/mongodb-community-search/teardown.sh
bash $SCRIPT_DIR/../drivers-evergreen-tools/.evergreen/run-orchestration.sh --local-atlas -v
else
if [ -n "${CI:-}" ]; then
bash $SCRIPT_DIR/../drivers-evergreen-tools/.evergreen/docker/setup.sh
fi
bash .evergreen/mongodb-community-search/start-services.sh
bash $SCRIPT_DIR/../drivers-evergreen-tools/.evergreen/stop-orchestration.sh
bash $SCRIPT_DIR/mongodb-community-search/start-services.sh
fi
export CONN_STRING"=mongodb://127.0.0.1:27017/?directConnection=true"
echo "CONN_STRING=$CONN_STRING" > $SCRIPT_DIR/.local_atlas_uri
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ drivers-evergreen-tools
atlas
.evergreen/.local_atlas_uri
pwfile
mo-expansion.*

# Secrets
secrets-export.sh
Expand Down