-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-tests-local.sh
More file actions
executable file
·40 lines (33 loc) · 1.18 KB
/
run-tests-local.sh
File metadata and controls
executable file
·40 lines (33 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
script_dir=$(dirname "$(realpath -s "$0")")
go mod tidy
echo '\033[1;35mRun unit tests:\033[0m'
./scripts/coverage.sh unit "$script_dir"
export SMTP_HOST=127.0.0.1
export SMTP_USER=user
export SMTP_PASS=pass
export SMTP_PORT=1025
export SMTP_FROM=mailer@example.com
export SMTP_ALLOW_INSECURE_TLS=true
export PIPELINE_INTERVAL=1
export PIPELINE_CALLBACK_URL=http://127.0.0.1:8080
export ATTACHMENTS_BASE_PATH=testdata/attachments
export MYSQL_HOST=127.0.0.1
export MYSQL_PORT=3306
export MYSQL_USER=root
export MYSQL_PASSWORD=test
export MYSQL_DATABASE=mailculator_test
export MYSQL_TLS=false
if ! docker compose -f "$script_dir/compose.yml" --profile test-deps up -d --build --force-recreate; then
echo "Could not start test dependencies"
exitCode=1
fi
if [ "${exitCode:-}" = "" ]; then
test_packages=$(go list ./... | grep -v testutils)
echo '\033[1;35mRun repository tests:\033[0m'
go test $test_packages -tags=repository | grep -v '\[no test files\]'
echo '\033[1;35mRun integration tests:\033[0m'
go test $test_packages -tags=integration | grep -v '\[no test files\]'
fi
docker compose -f "$script_dir/compose.yml" --profile test-deps down --remove-orphans
exit $exitCode