Skip to content

Commit

Permalink
CI/Makefile: use "--wait" in "docker compose up"
Browse files Browse the repository at this point in the history
When using "--wait" flag (introduced in Docker Compose V2) in 
"docker compose up", Docker waits for all healthchecks to be in 
"healthy" state. Since docker-compose.yml files in this repository
use "cqlsh" to determine the health of a container, this means
that Docker will wait for all nodes of the cluster to be fully
bootstrapped and their CQL port ready.

By using this flag, this fixes a potential problem in CI - previously
the code would not wait for the last node to be fully started. 
Additionally, "wait.sh" script can be deleted (this logic now handled by
Docker Compose).
  • Loading branch information
avelanarius committed Jul 17, 2023
1 parent 58d23ef commit 31beef0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cassandra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- name: Setup 3-node Cassandra cluster
run: |
docker compose -f test/cluster/cassandra/docker-compose.yml up -d
docker compose -f test/cluster/cassandra/docker-compose.yml up -d --wait
# A separate step for building to separate measuring time of compilation and testing
- name: Build the project
run: cargo build --verbose --tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup 3-node Scylla cluster
run: |
sudo sh -c "echo 2097152 >> /proc/sys/fs/aio-max-nr"
docker compose -f test/cluster/docker-compose.yml up -d
docker compose -f test/cluster/docker-compose.yml up -d --wait
- name: Format check
run: cargo fmt --verbose --all -- --check
- name: Clippy check
Expand Down
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ clippy:
RUSTFLAGS=-Dwarnings cargo clippy --examples --tests -- -Aclippy::uninlined_format_args

.PHONY: test
test: up wait-for-cluster
test: up
SCYLLA_URI=172.42.0.2:9042 \
SCYLLA_URI2=172.42.0.3:9042 \
SCYLLA_URI3=172.42.0.4:9042 \
cargo test

.PHONY: dockerized-test
dockerized-test: up wait-for-cluster
dockerized-test: up
test/dockerized/run.sh

.PHONY: build
Expand All @@ -50,7 +50,7 @@ docs:

.PHONY: up
up:
$(COMPOSE) up -d
$(COMPOSE) up -d --wait
@echo
@echo "ScyllaDB cluster is running in the background. Use 'make down' to stop it."
@echo
Expand All @@ -75,7 +75,3 @@ shell:
clean: down
cargo clean
rm -rf docs/book

.PHONY: wait-for-cluster
wait-for-cluster:
@test/cluster/wait.sh
18 changes: 0 additions & 18 deletions test/cluster/wait.sh

This file was deleted.

0 comments on commit 31beef0

Please sign in to comment.