Setting up PostgreSQL for running integration tests
1–10 of 50 posts
Re: Setting up PostgreSQL for running integration tests
#2Another thing to contemplate is utilizing the multi tenancy systems you have in place for isolation. It can be a good way to test that the tenant isolation actually works.
Re: Setting up PostgreSQL for running integration tests
#3Re: Setting up PostgreSQL for running integration tests
#4There is testcontainers + flyway/liquibase. Problem solved.
Re: Setting up PostgreSQL for running integration tests
#5Re: Setting up PostgreSQL for running integration tests
#6Re: Setting up PostgreSQL for running integration tests
#7Wow. So much effort in reinventing the wheel. The transaction approach is obviously not suited for integration testing as commits/rollbacks are part of the package too. There is testcontainers + flyway/liquibase. Problem solved.
Re: Setting up PostgreSQL for running integration tests
#8With PostgreSQL at the beginning of the test the outer transaction is opened, then connection is shared with application, test steps are performed (including Selenium etc), requests open/close nested transactions etc. Once steps are done the test closes the outer transaction and the database is back to initial state for the next test. It is very simple and handled by the framework.
In fact it can be even more sophisticated. E.g. an integration test class can preload some data (fixtures) for all the test cases of the class. For that the another nested transaction is used to not repeat the data load process for every test case.
MariaDB doesn't have nested transactions, however in that case RoR uses SAVEPOINTs mechanism. https://mariadb.com/kb/en/savepoint/
Re: Setting up PostgreSQL for running integration tests
#9Re: Setting up PostgreSQL for running integration tests
#10https://medium.com/@kova98/easy-test-database-reset-in-net-w...