From a7945437d456d5c1d0bfe58f38a53f4239f109e1 Mon Sep 17 00:00:00 2001 From: Eric Hartmann Date: Thu, 26 Oct 2017 17:40:15 +0200 Subject: [PATCH] SONAR-10027 Fix resetting tasks when Compute Engine starts --- .../src/main/java/org/sonar/ce/queue/CeQueueCleaner.java | 4 ---- .../test/java/org/sonar/ce/queue/CeQueueCleanerTest.java | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/queue/CeQueueCleaner.java b/server/sonar-ce/src/main/java/org/sonar/ce/queue/CeQueueCleaner.java index 39dd83f88bb..baf1459d99e 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/queue/CeQueueCleaner.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/queue/CeQueueCleaner.java @@ -66,10 +66,6 @@ public class CeQueueCleaner implements Startable { } private void verifyConsistency(DbSession dbSession) { - // server is not being upgraded - dbClient.ceQueueDao().resetAllToPendingStatus(dbSession); - dbSession.commit(); - // Reports that have been processed are not kept in database yet. // They are supposed to be systematically dropped. // Let's clean-up orphans if any. diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueCleanerTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueCleanerTest.java index 0397af0d4bd..140d7c5d1f6 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueCleanerTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueCleanerTest.java @@ -46,14 +46,14 @@ public class CeQueueCleanerTest { private CeQueueCleaner underTest = new CeQueueCleaner(dbTester.getDbClient(), serverUpgradeStatus, queue); @Test - public void start_resets_in_progress_tasks_to_pending() throws IOException { + public void start_does_not_reset_in_progress_tasks_to_pending() throws IOException { insertInQueue("TASK_1", CeQueueDto.Status.PENDING); insertInQueue("TASK_2", CeQueueDto.Status.IN_PROGRESS); underTest.start(); - assertThat(dbTester.getDbClient().ceQueueDao().countByStatus(dbTester.getSession(), CeQueueDto.Status.PENDING)).isEqualTo(2); - assertThat(dbTester.getDbClient().ceQueueDao().countByStatus(dbTester.getSession(), CeQueueDto.Status.IN_PROGRESS)).isEqualTo(0); + assertThat(dbTester.getDbClient().ceQueueDao().countByStatus(dbTester.getSession(), CeQueueDto.Status.PENDING)).isEqualTo(1); + assertThat(dbTester.getDbClient().ceQueueDao().countByStatus(dbTester.getSession(), CeQueueDto.Status.IN_PROGRESS)).isEqualTo(1); } @Test -- 2.39.5