]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10027 Fix resetting tasks when Compute Engine starts
authorEric Hartmann <hartmann.eric@gmail.com>
Thu, 26 Oct 2017 15:40:15 +0000 (17:40 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 27 Oct 2017 06:52:27 +0000 (08:52 +0200)
server/sonar-ce/src/main/java/org/sonar/ce/queue/CeQueueCleaner.java
server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueCleanerTest.java

index 39dd83f88bb111c99aeb72233ec551ef873bbbb9..baf1459d99e78cca37b7e59c8667f5e36624b731 100644 (file)
@@ -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.
index 0397af0d4bd3230ba520ee46eb578bc1272b8947..140d7c5d1f6e7e9bb985566e2bd9701e6dfaaa94 100644 (file)
@@ -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