Skip to content

Commit

Permalink
tests: replace "docker-compose" -> "docker compose" (#3000)
Browse files Browse the repository at this point in the history
* replace "docker-compose" -> "docker compose"

* obsolete doc note

* bats: clean up extra output
  • Loading branch information
mmetc authored May 17, 2024
1 parent b6253d5 commit 0ba05ac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export AWS_ACCESS_KEY_ID=test
export AWS_SECRET_ACCESS_KEY=test

testenv:
@echo 'NOTE: You need Docker, docker-compose and run "make localstack" in a separate shell ("make localstack-stop" to terminate it)'
@echo 'NOTE: You need to run "make localstack" in a separate shell, "make localstack-stop" to terminate it'

.PHONY: test
test: testenv goversion ## Run unit tests with localstack
Expand All @@ -230,14 +230,19 @@ test: testenv goversion ## Run unit tests with localstack
go-acc: testenv goversion ## Run unit tests with localstack + coverage
go-acc ./... -o coverage.out --ignore database,notifications,protobufs,cwversion,cstest,models -- $(LD_OPTS)

check_docker:
@if ! docker info > /dev/null 2>&1; then \
echo "Could not run 'docker info': check that docker is running, and if you need to run this command with sudo."; \
fi

# mock AWS services
.PHONY: localstack
localstack: ## Run localstack containers (required for unit testing)
docker-compose -f test/localstack/docker-compose.yml up
localstack: check_docker ## Run localstack containers (required for unit testing)
docker compose -f test/localstack/docker-compose.yml up

.PHONY: localstack-stop
localstack-stop: ## Stop localstack containers
docker-compose -f test/localstack/docker-compose.yml down
localstack-stop: check_docker ## Stop localstack containers
docker compose -f test/localstack/docker-compose.yml down

# build vendor.tgz to be distributed with the release
.PHONY: vendor
Expand Down
7 changes: 0 additions & 7 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,3 @@ different syntax.
Check the heredocs (the <<EOT blocks). Each line must start with a hard TAB
followed by spaces. You are probably missing some tabs.

## gotchas

- Testing with Postgres or MySQL/MariaDB leads to (unpredictably) failing
tests in the GitHub workflows, so we had to disable them by default. We do
run these in a separate environment before doing releases. They should always
pass if you run them in a development machine.

6 changes: 3 additions & 3 deletions test/bats/50_simulation.bats
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ setup_file() {
load "../lib/setup_file.sh"
./instance-data load

cscli collections install crowdsecurity/sshd --error
cscli parsers install crowdsecurity/syslog-logs --error
cscli parsers install crowdsecurity/dateparse-enrich --error
cscli collections install crowdsecurity/sshd --error >/dev/null
cscli parsers install crowdsecurity/syslog-logs --error >/dev/null
cscli parsers install crowdsecurity/dateparse-enrich --error >/dev/null

./instance-crowdsec start
}
Expand Down

0 comments on commit 0ba05ac

Please sign in to comment.