Skip to content

Commit

Permalink
Merge pull request #761 from avelanarius/docker-compose-next
Browse files Browse the repository at this point in the history
Switch from Docker Compose V1 to V2, use "--wait" flag
  • Loading branch information
piodul authored Jul 17, 2023
2 parents 69dc773 + 31beef0 commit b845c63
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 38 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/cassandra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v3
- 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 All @@ -28,9 +28,9 @@ jobs:
CDC='disabled' SCYLLA_URI=172.42.0.2:9042 SCYLLA_URI2=172.42.0.3:9042 SCYLLA_URI3=172.42.0.4:9042 cargo test --verbose -- --skip test_views_in_schema_info
- name: Stop the cluster
if: ${{ always() }}
run: docker-compose -f test/cluster/cassandra/docker-compose.yml stop
run: docker compose -f test/cluster/cassandra/docker-compose.yml stop
- name: Print the cluster logs
if: ${{ always() }}
run: docker-compose -f test/cluster/cassandra/docker-compose.yml logs
run: docker compose -f test/cluster/cassandra/docker-compose.yml logs
- name: Remove cluster
run: docker-compose -f test/cluster/cassandra/docker-compose.yml down
run: docker compose -f test/cluster/cassandra/docker-compose.yml down
8 changes: 4 additions & 4 deletions .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 All @@ -38,12 +38,12 @@ jobs:
run: SCYLLA_URI=172.42.0.2:9042 SCYLLA_URI2=172.42.0.3:9042 SCYLLA_URI3=172.42.0.4:9042 cargo test --verbose
- name: Stop the cluster
if: ${{ always() }}
run: docker-compose -f test/cluster/docker-compose.yml stop
run: docker compose -f test/cluster/docker-compose.yml stop
- name: Print the cluster logs
if: ${{ always() }}
run: docker-compose -f test/cluster/docker-compose.yml logs
run: docker compose -f test/cluster/docker-compose.yml logs
- name: Remove cluster
run: docker-compose -f test/cluster/docker-compose.yml down
run: docker compose -f test/cluster/docker-compose.yml down

# Tests that our current minimum supported rust version compiles everything sucessfully
min_rust:
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ Currently, we require new PRs to compile without warnings, pass `cargo fmt` and
## Testing

A 3-node ScyllaDB cluster is required to run the tests.
The simplest way to set it up locally is to use a `docker-compose`.
Fortunately there is no need to invoke `docker-compose` manually, everything can be handled by our `Makefile`.
The simplest way to set it up locally is to use a `docker compose`.
Fortunately there is no need to invoke `docker compose` manually, everything can be handled by our `Makefile`.

To run a cargo test suite, use the command below (note that you must have docker and docker-compose installed):
To run a cargo test suite, use the command below (note that you must have Docker and Docker Compose V2 installed):
```bash
make test
```
Expand Down
12 changes: 4 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
COMPOSE := docker-compose -f test/cluster/docker-compose.yml
COMPOSE := docker compose -f test/cluster/docker-compose.yml

.PHONY: all
all: test
Expand Down 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.

2 changes: 1 addition & 1 deletion test/dockerized/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

cd "$(dirname "$0")"/../../

if [[ -z $(docker container ls | grep cluster_scylla) ]]; then
if [[ -z $(docker container ls | grep cluster-scylla) ]]; then
echo "Scylla container must be running to execute tests (use 'make up')."
exit 1
fi
Expand Down

0 comments on commit b845c63

Please sign in to comment.