Skip to content

Commit

Permalink
Fix SQL Server flaky tests
Browse files Browse the repository at this point in the history
* Fix incorrect SQL server drop index
* Manually execute jobs for CaseInstanceMigrationBatchTest to avoid SQL Server deadlock exceptions
  • Loading branch information
filiphr committed Aug 2, 2024
1 parent b60cd0e commit 5c73b8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ void testCaseInstanceBatchMigrationSuccess() {
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ if exists (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_ACT_HI_TSK_LOG_TASK

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

if exists (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_TASK_SCOPE') drop index ACT_HI_TASK.ACT_IDX_HI_TASK_SCOPE;
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;
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;
if exists (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_TASK_SCOPE') drop index ACT_HI_TASKINST.ACT_IDX_HI_TASK_SCOPE;
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;
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;

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

Expand Down

0 comments on commit 5c73b8c

Please sign in to comment.