Skip to content

Commit f4ce7ea

Browse files
committed
PMM-12153 Add a healthcheck and wait for container
1 parent a0b0b09 commit f4ce7ea

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.github/workflows/go.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ jobs:
4646
4747
- name: Run Tests
4848
run: |
49-
docker compose up -d
50-
make all
49+
docker compose up -d --wait --wait-timeout 20
50+
make format
51+
make build
5152
make test
5253
env:
5354
MYSQL_IMAGE: ${{ matrix.mysql-image }}

docker-compose.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,21 @@ services:
66
container_name: mysqld_exporter_db
77
environment:
88
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
9-
- MYSQL_ROOT_HOST=%
109
- MYSQL_ROOT_PASSWORD=
10+
- MYSQL_ROOT_HOST=%
1111
- INIT_ROCKSDB=1
1212
ports:
1313
- "3306:3306"
14+
healthcheck:
15+
test: [
16+
"CMD-SHELL",
17+
"if command -v mariadb >/dev/null; then \
18+
mariadb -uroot -e 'SELECT 1;'; \
19+
else \
20+
mysql -uroot -e 'SELECT 1;'; \
21+
fi || exit 1"
22+
]
23+
interval: 10s
24+
timeout: 5s
25+
retries: 3
26+
start_period: 3s

0 commit comments

Comments
 (0)