Replies: 1 comment 4 replies
-
|
Hm, that looks right (I think?). It might be work adding some logging in various places just to make sure the transaction is indeed being rolled back as expected (i.e. putting some in the Also, try running the test case on its own (i.e. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm loving river. It's such a straightforward and robust library.
I'm trying to write some tests for a worker using the
rivertest.Workerhelpers. In my particular case, my worker logic also needs to write to the database. However, when I try to run my test, it just hangs.For context, I am using SQLite as the database for my tests. I am also using
gormas an ORM. And I know from experience with SQLite that when a transaction is open and you try to perform other database operations, the database connection will just hang, which explains what I'm seeing.From what I understand,
rivertest.Workerkeeps the transaction open indefinitely, as indicated in this warning message in the documentation:Thus, my question is: is it possible to use
rivertest.Workerto test a worker'sWorkfunction that writes to the database, particularly when using SQLite as the database?I strongly suspect that I am doing something wrong or misunderstanding something, so hopefully someone can point me in the right direction.
Here's some pseudo-code showing what I'm trying to do in case it helps:
Beta Was this translation helpful? Give feedback.
All reactions