Skip to content

Commit

Permalink
test(engine): fix flaky deadlock test on sql server
Browse files Browse the repository at this point in the history
related to CAM-14749, closes camunda#1970
  • Loading branch information
tasso94 authored Aug 9, 2022
1 parent b0a904c commit 729daf9
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
* HEADS-UP: If a test fails, please make sure to adjust the error code / sql state for the respective
* database in {@link ExceptionUtil.DEADLOCK_CODES}.
*/
@RequiredDatabase(
excludes = DbSqlSessionFactory.MSSQL
) // This test is flaky on SQL Server. Flakyness will be investigated with CAM-14749.
public class DeadlockTest {

public ProcessEngineRule engineRule = new ProvidedProcessEngineRule();
Expand All @@ -64,21 +61,31 @@ public class DeadlockTest {
@Before
public void createTestTables() throws SQLException {
Connection conn = engineRule.getProcessEngineConfiguration().getDataSource().getConnection();

conn.setAutoCommit(false);

Statement statement = conn.createStatement();
statement.execute("CREATE TABLE deadlock_test1 (FOO INTEGER)");
statement.execute("CREATE TABLE deadlock_test2 (FOO INTEGER)");
statement.executeUpdate("INSERT INTO deadlock_test1 VALUES (0)");
statement.executeUpdate("INSERT INTO deadlock_test2 VALUES (0)");

conn.commit();

sqlException = null;
}

@After
public void cleanTables() throws SQLException {
Connection conn = engineRule.getProcessEngineConfiguration().getDataSource().getConnection();

conn.setAutoCommit(false);

Statement statement = conn.createStatement();
statement.execute("DROP TABLE deadlock_test1");
statement.execute("DROP TABLE deadlock_test2");

conn.commit();
}

@Test
Expand Down

0 comments on commit 729daf9

Please sign in to comment.