Skip to content

tests: Integrate the DB in "unit" tests.

This MR replaces !2076 (closed)

Technically this will turn our "unit" tests into integration tests.

For a legacy codebase like Hubzilla, where the DB is so tightly coupled, and usually via global state, this is probably the best chance we have for getting the code under test at all.

I have added a helper script to create a separate test DB for a PostgreSQL based setup. This is based on the existing scripts that seems to have been used in a travis CI setup at some point.

The tests will run against this test DB, with each test encapsulated in a transaction that is rolled back when the test is finished. This ensures that each test starts with a clean/predefined DB state.

I've created CI jobs that will run the tests both on MySQL and PostgreSQL, and report coverage stats for each.

See the individual commits for more details.

Merge request reports