Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] More relevant approach to solving the non-responsive server problem #315

Closed
Closed
Show file tree
Hide file tree
Changes from 4 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
6 changes: 6 additions & 0 deletions .ci/opensearch/Dockerfile.opensearch
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@ FROM opensearchproject/opensearch:${OPENSEARCH_VERSION}

ARG opensearch_path=/usr/share/opensearch
ARG SECURE_INTEGRATION
ENV SECURE_INTEGRATION=$SECURE_INTEGRATION

RUN if [ "$SECURE_INTEGRATION" != "true" ] ; then $opensearch_path/bin/opensearch-plugin remove opensearch-security; fi

HEALTHCHECK --start-period=20s --interval=5s --retries=5 --timeout=1s \
CMD if [ "$SECURE_INTEGRATION" != "true" ]; \
then curl -f http://localhost:9200/_cat/health || exit 1; \
else curl -fk https://localhost:9200/_cat/health -u admin:admin || exit 1; fi
9 changes: 6 additions & 3 deletions .github/workflows/test-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ jobs:
export OPENSEARCH_VERSION=${{ matrix.entry.opensearch_version }}
export SECURE_INTEGRATION=${{ matrix.secured }}
make cluster.clean cluster.build cluster.start
- name: Check Opensearch cluster health
run: |
make cluster.check SECURE_INTEGRATION=${{ matrix.secured }} NUM_CHECKS=30 CHECK_INTERVAL=1

- uses: zethuman/[email protected]
with:
name: opensearch_opensearch_1
timeout: 300
interval: 5

- name: Integration test without security
if: ${{ matrix.secured == 'false'}}
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Adds `advanced_index_actions` guide ([#288](https://github.com/opensearch-project/opensearch-go/pull/288))
- Adds testcases to check UpdateByQuery functionality ([#304](https://github.com/opensearch-project/opensearch-go/pull/304))
- Adds additional timeout after cluster start ([##303](https://github.com/opensearch-project/opensearch-go/pull/303))
- Adds more relevant healthchecker ([#315](https://github.com/opensearch-project/opensearch-go/pull/315))
zethuman marked this conversation as resolved.
Show resolved Hide resolved

### Changed

Expand Down
31 changes: 0 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -205,37 +205,6 @@ cluster.clean: ## Remove unused Docker volumes and networks
docker network prune --force
docker system prune --volumes --force

cluster.check:
@printf "\033[2m→ Checking up cluster health...\033[0m\n"
SECURE_INTEGRATION=$(SECURE_INTEGRATION) \
NUM_CHECKS=$(NUM_CHECKS) \
CHECK_INTERVAL=$(CHECK_INTERVAL) \
echo "SECURE_INTEGRATION: $$SECURE_INTEGRATION"; \
for ((i=1; i<=NUM_CHECKS; i++)); do \
if [[ $$SECURE_INTEGRATION == "true" ]]; \
then response=$$(curl --insecure -sS "https://localhost:9200/_cluster/health" -u admin:admin); \
else response=$$(curl -sS "http://localhost:9200/_cluster/health"); \
fi; \
if [[ $$response == *"green"* || $$response == *"yellow"* ]]; then \
echo "Cluster is healthy."; \
exit 0; \
fi; \
echo "Check #$$i: Cluster is not healthy. Status: $$response"; \
if [[ $$i == $$((NUM_CHECKS / 5)) ]]; then \
echo "Restarting OpenSearch Container..."; \
docker-compose --project-directory .ci/opensearch restart; \
fi; \
sleep $$CHECK_INTERVAL; \
done; \
echo "Cluster is still not healthy after $$NUM_CHECKS checks."; \
exit 1;

cluster.kek:
if [[ "$$SECURE_INTEGRATION" == "false" ]] \
then HEALTH_CHECK_URL="https://localhost:9200/_cluster/health" \
else HEALTH_CHECK_URL="http://localhost:9200/_cluster/health" \
fi; \

linters:
./bin/golangci-lint run ./... --timeout=5m

Expand Down