Skip to content

Commit

Permalink
test: docker compose wait until healthy
Browse files Browse the repository at this point in the history
  • Loading branch information
wzyboy committed Jul 9, 2023
1 parent 9862899 commit 1377058
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/pytest.yaml
Expand Up @@ -22,9 +22,7 @@ jobs:
- name: Setup Elasticsearch
run: |
pushd tests/elasticsearch
docker compose up -d
# wait until up
docker inspect --format '{{ .NetworkSettings.IPAddress }}:9200' es01 | xargs wget --retry-connrefused --tries=5 -q --wait=3 --spider
docker compose up -d --wait
popd
- name: Run pytest
Expand Down
8 changes: 7 additions & 1 deletion tests/elasticsearch/docker-compose.yaml
@@ -1,4 +1,4 @@
version: '2.2'
version: '3'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:8.1.3
Expand All @@ -9,3 +9,9 @@ services:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ports:
- 9200:9200
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9200"]
interval: 10s
timeout: 1s
retries: 6
start_period: 20s

0 comments on commit 1377058

Please sign in to comment.