-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Replaced `docker-compose` with `docker compose` in Makefile Locking Gradle version to 8.9 Signed-off-by: Theo Truong <theotr@amazon.com> * # Use JDK 17 Signed-off-by: Theo Truong <theotr@amazon.com> * # Removed Opensearch 1.x Signed-off-by: Theo Truong <theotr@amazon.com> * # Restored 1.x test Signed-off-by: Theo Truong <theotr@amazon.com> # Active mechanism to check for cluster readiness * # fixed Makefile syntax Signed-off-by: Theo Truong <theotr@amazon.com> * # use temurin for JDK distribution and default to JDK 17 Signed-off-by: Theo Truong <theotr@amazon.com> * # Fixed Makefile syntax Signed-off-by: Theo Truong <theotr@amazon.com> * # Fixed Makefile syntax Signed-off-by: Theo Truong <theotr@amazon.com> * # Moved waiting logic to scripts Signed-off-by: Theo Truong <theotr@amazon.com> --------- Signed-off-by: Theo Truong <theotr@amazon.com>
- Loading branch information
Showing
4 changed files
with
36 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
cluster.opensearch.build: | ||
docker-compose --project-directory .ci/opensearch build; | ||
docker compose --project-directory .ci/opensearch build; | ||
|
||
cluster.opensearch.start: | ||
docker-compose --project-directory .ci/opensearch up -d ; | ||
sleep 60; | ||
docker compose --project-directory .ci/opensearch up -d; | ||
bash ./scripts/wait-cluster.sh; | ||
|
||
cluster.opensearch.stop: | ||
docker-compose --project-directory .ci/opensearch down ; | ||
docker compose --project-directory .ci/opensearch down; | ||
|
||
cluster.clean: ## Remove unused Docker volumes and networks | ||
@printf "\033[2m→ Cleaning up Docker assets...\033[0m\n" | ||
docker volume prune --force | ||
docker network prune --force | ||
docker system prune --volumes --force | ||
|
||
.PHONY: cluster.opensearch.build cluster.opensearch.start cluster.opensearch.stop cluster.clean | ||
.PHONY: cluster.opensearch.build cluster.opensearch.start cluster.opensearch.stop cluster.clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
#!/bin/bash | ||
|
||
TEST_OPENSEARCH_SERVER=${TEST_OPENSEARCH_SERVER:-"http://localhost:9200"} | ||
for attempt in {1..20}; do | ||
echo "----- Waiting... $attempt"; | ||
sleep 5; \ | ||
if [ "$SECURE_INTEGRATION" = "true" ]; then | ||
if curl -s -k https://localhost:9200; then | ||
echo '----- Secured cluster ready' && exit 0; | ||
fi; | ||
else | ||
if curl -s http://localhost:9200; then | ||
echo '----- Unsecured cluster ready' && exit 0; | ||
fi; | ||
fi; | ||
done; | ||
|
||
attempt_counter=0 | ||
max_attempts=5 | ||
url="${TEST_OPENSEARCH_SERVER}/_cluster/health?wait_for_status=green&timeout=50s" | ||
|
||
echo "Waiting for OpenSearch..." | ||
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' --max-time 55 "$url")" != "200" ]]; do | ||
if [ ${attempt_counter} -eq ${max_attempts} ];then | ||
echo "\nCouldn't connect to OpenSearch" | ||
exit 1 | ||
fi | ||
|
||
printf '.' | ||
attempt_counter=$(($attempt_counter+1)) | ||
sleep 5 | ||
done | ||
|
||
echo "\nReady" | ||
echo '----- Timeout waiting for cluster to be ready'; | ||
exit 1; |