Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP/POC: Test improvements #1058

wants to merge 11 commits into
base: master


None yet
2 participants
Copy link

commented Apr 3, 2019

  • try to use mount.lite
  • try to make most tests run in parallel
  • try to make all tests use a single initialized test database and not break it
  • run each test in a transaction and rollback after each test

Macroz added some commits Mar 22, 2019

refactor: get creation time from database
If test data is created already by a separate process, referring to
the stored value in the test-data ns does not provide the correct
value. This is more robust.
refactor: tests to assume test data is created already
The tests now work with less assumptions about what exists
before or only assume that there is the basic test data.

Having the tests each run in transaction that rolls back means
the test data will stay pristine between tests.
refactor: isolate tests that spoil the transaction
When a transaction fails in postgres the connection is not usable
withotu savepoints or rollback. Since our tests begin a transaction to
rollback final results, and Clojure JDBC assumes subtransactions are
merged into single transaction, the transaction per test will be in a
failed state forever after the first fail. Therefore the failing test
should be the last DB statement in a test. If more than one failing
statement is required it makes sense to split them each to their own test.
@@ -1,3 +0,0 @@
{:ns rems.migrations.example
:up-fn migrate-up
:down-fn nil}

This comment has been minimized.

Copy link

luontola Apr 5, 2019


Why was this removed? Do code based migrations not work with mount-lite?

This comment has been minimized.

Copy link

Macroz Apr 10, 2019

Author Collaborator

Simply because it's not required either.

@luontola luontola changed the title WIP: Test improvements WIP/POC: Test improvements Apr 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.