Skip to content

Commit a36693f

Browse files
committed
Skip some test on CockroachDB
1 parent 7d0a9d3 commit a36693f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/locking/OptimisticLockModeTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
import org.hibernate.Session;
1010
import org.hibernate.StaleObjectStateException;
1111
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
12+
import org.hibernate.dialect.CockroachDialect;
1213
import org.hibernate.dialect.MySQLDialect;
1314
import org.hibernate.dialect.lock.OptimisticEntityLockException;
1415
import org.hibernate.engine.spi.SharedSessionContractImplementor;
1516
import org.hibernate.testing.orm.junit.BaseSessionFactoryFunctionalTest;
1617
import org.hibernate.testing.orm.junit.JiraKey;
18+
import org.hibernate.testing.orm.junit.SkipForDialect;
1719
import org.junit.jupiter.api.BeforeEach;
1820
import org.junit.jupiter.api.Test;
1921

@@ -75,6 +77,8 @@ public void testRefreshWithOptimisticLockRefresh() {
7577

7678
@Test
7779
@JiraKey(value = "HHH-19937")
80+
@SkipForDialect(dialectClass = CockroachDialect.class,
81+
reason = "Cockroach uses SERIALIZABLE by default and seems to fail reading state that was written by a different TX that completed within this TX")
7882
public void testRefreshWithOptimisticForceIncrementLockRefresh() {
7983
doInHibernate( this::sessionFactory, session -> {
8084
C c = session.find( C.class, id, LockModeType.OPTIMISTIC_FORCE_INCREMENT );
@@ -87,6 +91,8 @@ public void testRefreshWithOptimisticForceIncrementLockRefresh() {
8791

8892
@Test
8993
@JiraKey(value = "HHH-19937")
94+
@SkipForDialect(dialectClass = CockroachDialect.class,
95+
reason = "Cockroach uses SERIALIZABLE by default and seems to fail reading state that was written by a different TX that completed within this TX")
9096
public void testRefreshWithOptimisticLockFailure() {
9197
assertThrows( OptimisticEntityLockException.class, () ->
9298
doInHibernate( this::sessionFactory, session -> {
@@ -101,9 +107,11 @@ public void testRefreshWithOptimisticLockFailure() {
101107

102108
@Test
103109
@JiraKey(value = "HHH-19937")
110+
@SkipForDialect(dialectClass = CockroachDialect.class,
111+
reason = "Cockroach uses SERIALIZABLE by default and seems to fail reading state that was written by a different TX that completed within this TX")
104112
public void testRefreshWithOptimisticForceIncrementLockFailure() {
105113
// TODO: shouldn't this also be an OptimisticEntityLockException
106-
assertThrows( StaleObjectStateException.class, () ->
114+
assertThrows( StaleObjectStateException.class /* or TransactionSerializationException */, () ->
107115
doInHibernate( this::sessionFactory, session -> {
108116
C c = session.find( C.class, id, LockModeType.OPTIMISTIC_FORCE_INCREMENT );
109117
session.refresh( c );

0 commit comments

Comments
 (0)