Issue using @ExpectedDataSet without @DataSet
See original GitHub issueI’m using Spring Boot, Jooq, HikariCP, and Rider-Spring. For the most part, this combination works fine.
I have one test in one class that is marked @Test, @ExpectedDataSet and does nothing but insert a couple of records via JooQ, then verify their existence.
The class is annotated:
@RunWith(SpringRunner.class)
@JooqTest
@DBRider
The test works when run alone or only that class is run.
When I run it with multiple test classes, this one test in the one class fails with:
junit.framework.ComparisonFailure: row count (table=mytable) expected:<[2]> but was:<[0]>
The transaction is not only not visible, but isn’t rolled back either - the two records will be left in the database. It seems like some kind of Spring related connect / datasource / pool related issue that I’ve been unable to track down.
Today I realized that, when I add a @DataSet that has no relation to the actual test, this all works fine. I’m glad I found a work around, but it seems like there’s still something wrong.
Any ideas?
Thanks for you work on this!
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Hi, depending on your setup it could solve your issue using @Commit (spring-test) or @DirtiesContext(…) (also from spring-test). Greetings
Am 31. Mai 2019 00:15:05 MESZ schrieb Possibly Cott notifications@github.com:
– Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
Also, disabling cachedConnections in DBUnit config may help, remembered it after looking at executor code here.
Ex: