Bring more clarity on how to run unit tests (#449)

* The commit brings more clarity on how to run unut tests.

The commit chages behaivour of `make test-unit` by adding sourcing of
env vars. Documentation is updated to provide more clarity on how to run
unit tests.

* changed list of commands to run before unit tests

* moved env vars to .env

* removed dduplicated env var

* returned conventional file name in script

* link to DEVELOPMENT.md

* fixed typo

* moved env var export to script

* removed export of tmp folder
This commit is contained in:
Andrey Dyachkov
2018-08-11 21:12:24 +02:00
committed by Rob j Loranger
parent 8382266479
commit 051f3884e1
4 changed files with 27 additions and 2 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ Run `make setup-dev-env` to install local developer tools and run necessary
services, such as mongodb, for the end-to-end tests.
## Unit Tests
Run `make test-unit` to run the unit tests.
For further details see [DEVELOPMENT.md](DEVELOPMENT.md#L84)
## End-to-End Tests
End-to-End tests (e2e) are tests from the user perspective that validate that
+21
View File
@@ -80,3 +80,24 @@ Starting application at 127.0.0.1:3000
And you'll be up and running. As you edit and save code, the `buffalo dev` command will notice and automatically
re-compile and restart the server.
# Run unit tests
In order to run unit tests, services they depend on must be running first:
```console
make alldeps
```
and database created:
```console
buffalo db create
buffalo db migrate up
```
then you can run the unit tests:
```console
make test-unit
```
+2
View File
@@ -1 +1,3 @@
ATHENS_MONGO_STORAGE_URL=mongodb://127.0.0.1:27017
GO_ENV=test_postgres
POP_PATH=$PWD/cmd/proxy
+3 -1
View File
@@ -1,7 +1,9 @@
#!/bin/bash
# test_unit.sh
source cmd/proxy/.env
# Run the unit tests with the race detector and code coverage enabled
set -xeuo pipefail
go test -race -coverprofile cover.out -covermode atomic ./...