aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Hartmann <hartmann.eric@gmail.com>2017-10-26 17:40:15 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2017-10-27 08:52:27 +0200
commita7945437d456d5c1d0bfe58f38a53f4239f109e1 (patch)
tree526194bdbd7cecaccd9fc097e4af20dff4edab72
parent89e8da171ea22dd75b6ac1e83b1354983ed209e6 (diff)
downloadsonarqube-a7945437d456d5c1d0bfe58f38a53f4239f109e1.tar.gz
sonarqube-a7945437d456d5c1d0bfe58f38a53f4239f109e1.zip
SONAR-10027 Fix resetting tasks when Compute Engine starts
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/queue/CeQueueCleaner.java4
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueCleanerTest.java6
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