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

test: run database tests in CI #174

Merged
merged 13 commits into from
Dec 18, 2024
Merged

test: run database tests in CI #174

merged 13 commits into from
Dec 18, 2024

Conversation

momentiris
Copy link
Contributor

@momentiris momentiris commented Nov 18, 2024

  • Adds mssql service to gh action test suite and connect to it when testing.
  • adds a withContext test helper that wraps each test in a db transaction and rollbacks after test finish
  • rewrites all tests that use db to use withContext
  • side effect: start adding db as param to adapter functions instead of them referencing the export themselves.

At first I thought running in transactions like this would allow us to parallelize tests but unfortunately not.. yet.
Something about how mssql works with transactions which I don't understand yet.

Todo:
Investigate what this does and if it's problematic to use in test and not in prod.

ALTER DATABASE [tenants-leases-test] SET READ_COMMITTED_SNAPSHOT ON;

It allows us to run multiple jest workers for the db tests that now run in transactions.

@momentiris momentiris force-pushed the test-foo-fix branch 5 times, most recently from befba4c to 0785fc4 Compare November 20, 2024 14:05
@momentiris momentiris force-pushed the test-foo-fix branch 2 times, most recently from 5b031a3 to 38a0d52 Compare December 9, 2024 14:18
@momentiris momentiris changed the title Test foo fix test: run database tests in CI Dec 9, 2024
Copy link
Collaborator

@driatic driatic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing to remark on, looks great!

@momentiris momentiris merged commit f164a9f into main Dec 18, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants