diff options
author | Lukasz Jarocki <lukasz.jarocki@sonarsource.com> | 2022-12-06 14:44:08 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-12-09 20:03:10 +0000 |
commit | 64b25b0613feb16070ada8e02c64761ac0d0f6d2 (patch) | |
tree | 5fc6a8685ffa823a7b4b63895c140dad0eb673c9 /server/sonar-ce-common | |
parent | b7e67fd16dda1f14ce2901310f5bf21f0030960a (diff) | |
download | sonarqube-64b25b0613feb16070ada8e02c64761ac0d0f6d2.tar.gz sonarqube-64b25b0613feb16070ada8e02c64761ac0d0f6d2.zip |
SONAR-17699 implemented algorithm for running PRs in parallel
Diffstat (limited to 'server/sonar-ce-common')
-rw-r--r-- | server/sonar-ce-common/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/server/sonar-ce-common/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java b/server/sonar-ce-common/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java index 7ea2ba50baf..3aa74acca40 100644 --- a/server/sonar-ce-common/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java +++ b/server/sonar-ce-common/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java @@ -389,8 +389,8 @@ public class CeQueueImplTest { @Test public void fail_to_cancel_if_in_progress() { - submit(CeTaskTypes.REPORT, newComponent(randomAlphabetic(11))); - CeQueueDto ceQueueDto = db.getDbClient().ceQueueDao().peek(session, WORKER_UUID, false, false).get(); + CeTask task = submit(CeTaskTypes.REPORT, newComponent(randomAlphabetic(11))); + CeQueueDto ceQueueDto = db.getDbClient().ceQueueDao().tryToPeek(session, task.getUuid(), WORKER_UUID).get(); assertThatThrownBy(() -> underTest.cancel(db.getSession(), ceQueueDto)) .isInstanceOf(IllegalStateException.class) @@ -403,7 +403,7 @@ public class CeQueueImplTest { CeTask pendingTask1 = submit(CeTaskTypes.REPORT, newComponent(randomAlphabetic(12))); CeTask pendingTask2 = submit(CeTaskTypes.REPORT, newComponent(randomAlphabetic(12))); - db.getDbClient().ceQueueDao().peek(session, WORKER_UUID, false, false); + db.getDbClient().ceQueueDao().tryToPeek(session, inProgressTask.getUuid(), WORKER_UUID); int canceledCount = underTest.cancelAll(); assertThat(canceledCount).isEqualTo(2); @@ -429,8 +429,8 @@ public class CeQueueImplTest { @Test public void pauseWorkers_marks_workers_as_pausing_if_some_tasks_in_progress() { - submit(CeTaskTypes.REPORT, newComponent(randomAlphabetic(12))); - db.getDbClient().ceQueueDao().peek(session, WORKER_UUID, false, false); + CeTask task = submit(CeTaskTypes.REPORT, newComponent(randomAlphabetic(12))); + db.getDbClient().ceQueueDao().tryToPeek(session, task.getUuid(), WORKER_UUID); // task is in-progress assertThat(underTest.getWorkersPauseStatus()).isEqualTo(CeQueue.WorkersPauseStatus.RESUMED); @@ -450,8 +450,8 @@ public class CeQueueImplTest { @Test public void resumeWorkers_resumes_pausing_workers() { - submit(CeTaskTypes.REPORT, newComponent(randomAlphabetic(12))); - db.getDbClient().ceQueueDao().peek(session, WORKER_UUID, false, false); + CeTask task = submit(CeTaskTypes.REPORT, newComponent(randomAlphabetic(12))); + db.getDbClient().ceQueueDao().tryToPeek(session, task.getUuid(), WORKER_UUID); // task is in-progress underTest.pauseWorkers(); @@ -473,7 +473,7 @@ public class CeQueueImplTest { @Test public void fail_in_progress_task() { CeTask task = submit(CeTaskTypes.REPORT, newComponent(randomAlphabetic(12))); - CeQueueDto queueDto = db.getDbClient().ceQueueDao().peek(db.getSession(), WORKER_UUID, false, false).get(); + CeQueueDto queueDto = db.getDbClient().ceQueueDao().tryToPeek(db.getSession(), task.getUuid(), WORKER_UUID).get(); underTest.fail(db.getSession(), queueDto, "TIMEOUT", "Failed on timeout"); |