With all required backends installed, stack build can build all packages
listed in stack.yaml and is equivalent to:
> stack build persistent persistent-template persistent-sqlite persistent-test
persistent-mongoDB persistent-mysql persistent-postgresql persistent-redis
If backends such as mysql and postgres are not installed then the default build will fail as will builds for packages for those backends alone:
> stack build persistent-mysql
...
Process exited with code: ExitFailure 1
Configuring mysql-0.1.4...
setup: The program 'mysql_config' is required but it could not be found
> stack build persistent-postgresql
...
Process exited with code: ExitFailure 1
Configuring postgresql-libpq-0.9.4.0...
setup: The program 'pg_config' is required but it could not be found.
To build all other packages, drop the failing package names as targets:
> stack build persistent persistent-template persistent-sqlite persistent-test
persistent-mongoDB persistent-redis
...
Completed 6 action(s).
For testing specific package:
> stack test persistent-sqlite
For appropriate backend specific testing using the package persistent-test:
> stack test persistent-test --flag persistent-test:<backend> --exec persistent-test
where is one listed in the cabal file
All tests are ran from the persistent-test directory
> cd persistent-test
Use cabal
> cabal configure --enable-tests
If you would like to configure tests with a specific backend that can be enabled using
> cabal configure -f<backend> --enable-tests
where is one of mongodb/postgresql/mysql/couchdb.
Now run with
> cabal build && dist/build/test/test
By default the sqlite backend is tested. To test other backends, you can give a flag described in persisten-test.
> cabal configure -fmongodb --enable-tests
For an easy install we recommend running a database from a docker container. Lets develop easy entry points for testing a database using a command runner.
> just --list
> just test-mongo
Installing just is easy.
Or you can look in ./bin/ for the commands it will call and run them directly
Or
Lets develop a docker-compose file for running different databases.