Closed jomatt closed 3 months ago
Hey @jomatt, sorry for the slightly delayed response.
First off, let me try to outline how the library works. At the start of the application (initialization of the testing context), a template database is created which holds the default state from which each test is run. The issue is a bit more complicated because there may actually be multiple template databases, but that's not important right now. Before a test is run, an isolated database is created for the specific test method as a clone from the previously prepared template database. To use the template database for this purpose, there must be no active connections to it, which is a restriction imposed by PostgreSQL. And that's the source of the above error source database "uqlipbuiagmk" is being accessed by other users
, where a new test database cannot be created because there is an active connection to the template database.
There could be several reasons for this, here are a few that come to mind:
Try going through your codebase to see if it contains any of the above issues. If you struggle to find the problem, you can try to pause the code using a breakpoint and use database tools to list details about the hanging connection. Perhaps it will guide you in the right direction.
My integration tests often fail with the error
source database "uqlipbuiagmk" is being accessed by other users
. The issue is not easy to reproduce since it happens non-deterministically. In between the two log blocks below (separated with[...]
), all tests finish successfully.Any ideas what could be the problem here?