Skip to content

Commit 5c73b8c

Browse files
committed
Fix SQL Server flaky tests
* Fix incorrect SQL server drop index * Manually execute jobs for CaseInstanceMigrationBatchTest to avoid SQL Server deadlock exceptions
1 parent b60cd0e commit 5c73b8c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/migration/CaseInstanceMigrationBatchTest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ void testCaseInstanceBatchMigrationSuccess() {
7676
}
7777

7878
// WHEN
79-
// Start async executor to process the batches
80-
CmmnJobTestHelper.waitForJobExecutorToProcessAllAsyncJobs(cmmnEngineConfiguration, 5000L, 500L, true);
79+
// We are manually executing because on SQL Server on our CI there is a deadlock exception from SQL Server when multiple threads run
80+
for (Job job : cmmnManagementService.createJobQuery().handlerType(CaseInstanceMigrationJobHandler.TYPE).list()) {
81+
cmmnManagementService.executeJob(job.getId());
82+
}
8183
assertThat(CmmnJobTestHelper.areJobsAvailable(cmmnManagementService)).isFalse();
8284
executeMigrationJobStatusHandlerTimerJob();
8385

modules/flowable-engine-common/src/main/resources/org/flowable/common/db/drop/flowable.mssql.drop.common.sql

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ if exists (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_ACT_HI_TSK_LOG_TASK
105105

106106
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_HI_TSK_LOG') drop table ACT_HI_TSK_LOG;
107107

108-
if exists (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_TASK_SCOPE') drop index ACT_HI_TASK.ACT_IDX_HI_TASK_SCOPE;
109-
if exists (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_TASK_SUB_SCOPE') drop index ACT_HI_TASK.ACT_IDX_HI_TASK_SUB_SCOPE;
110-
if exists (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_TASK_SCOPE_DEF') drop index ACT_HI_TASK.ACT_IDX_HI_TASK_SCOPE_DEF;
108+
if exists (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_TASK_SCOPE') drop index ACT_HI_TASKINST.ACT_IDX_HI_TASK_SCOPE;
109+
if exists (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_TASK_SUB_SCOPE') drop index ACT_HI_TASKINST.ACT_IDX_HI_TASK_SUB_SCOPE;
110+
if exists (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_TASK_SCOPE_DEF') drop index ACT_HI_TASKINST.ACT_IDX_HI_TASK_SCOPE_DEF;
111111

112112
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_HI_TASKINST') drop table ACT_HI_TASKINST;
113113

0 commit comments

Comments
 (0)