Optimistic lock test not working

16 views
Skip to first unread message

adithya kamath

unread,
Jun 18, 2023, 6:53:16 AM6/18/23
to jOOQ User Group
Hey,

I've tried to set up a concurrency test for optimistic locking and I'm not getting any exceptions at all.
There are two methods, one I saw in some post in the group and also wiith the assert throws and both of them were tried seperately.

Please have a look at this file


Lukas Eder

unread,
Jun 19, 2023, 3:41:15 AM6/19/23
to jooq...@googlegroups.com
Hi Adithya,

Thanks for your message. I just spent quite some time trying to reproduce the issue and after tweaking a ton of things, I could, indeed. Having said so, may I ask you to please use our official MCVE template in the future:

MCVE stands for "Minimal, Complete, Verifiable Example". Yours is "C" and "V", but not M. I had to remove tons of things, set up databases manually, tweak configuration, passwords, etc. and set up test data by hand, because your test didn't do that.

Only to find out that something was simply wrong with your test setup itself. Adding the following line to the test itself "fixes" the test:

context.settings().withExecuteWithOptimisticLocking(true)

One reason why I keep recommending using our MCVE template is because when trying to create a Minimal example, this kind of mistake is easily detected as you remove unnecessary things to make it minimal, and then suddenly, the test works.

I hope this helps,
Lukas


--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/7e5c13a6-89af-459a-adf6-8eb0059c2f36n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages