]> source.dussan.org Git - sonarqube.git/commitdiff
SGB-211 SGB-212 Fix errors on weekly tasks
authorLéo Geoffroy <leo.geoffroy@sonarsource.com>
Mon, 11 Nov 2024 15:28:43 +0000 (16:28 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 12 Nov 2024 20:02:48 +0000 (20:02 +0000)
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v108/CreateNewSoftwareQualityMetricsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v108/DeleteSoftwareQualityRatingFromProjectMeasuresIT.java

index 16421382ed32674a45f6b59b7fb2d28781fc536e..bb542bd94ee88a37d8dd2fcb83454e68bb042cb7 100644 (file)
@@ -41,15 +41,17 @@ class CreateNewSoftwareQualityMetricsIT {
     underTest.execute();
     assertThat(db.select("select name,direction,qualitative,enabled,best_value,optimized_best_value,delete_historical_data  from metrics"))
       .hasSize(6)
-      .extracting(s -> s.get("name"), s -> s.get("direction"), s -> s.get("qualitative"), s -> s.get("enabled"), s -> s.get("best_value"), s -> s.get("optimized_best_value"),
+      .extracting(s -> s.get("name"), s -> s.get("direction"), s -> s.get("qualitative"), s -> s.get("enabled"), s -> ((Number) s.get("best_value")).longValue(),
+        s -> s.get("optimized_best_value"),
         s -> s.get("delete_historical_data"))
+
       .containsExactlyInAnyOrder(
-        tuple("software_quality_reliability_issues", -1L, false, true, 0.0, true, false),
-        tuple("software_quality_security_issues", -1L, false, true, 0.0, true, false),
-        tuple("new_software_quality_reliability_issues", -1L, true, true, 0.0, true, true),
-        tuple("new_software_quality_security_issues", -1L, true, true, 0.0, true, true),
-        tuple("new_software_quality_maintainability_issues", -1L, true, true, 0.0, true, true),
-        tuple("software_quality_maintainability_issues", -1L, false, true, 0.0, true, false));
+        tuple("software_quality_reliability_issues", -1L, false, true, 0L, true, false),
+        tuple("software_quality_security_issues", -1L, false, true, 0L, true, false),
+        tuple("new_software_quality_reliability_issues", -1L, true, true, 0L, true, true),
+        tuple("new_software_quality_security_issues", -1L, true, true, 0L, true, true),
+        tuple("new_software_quality_maintainability_issues", -1L, true, true, 0L, true, true),
+        tuple("software_quality_maintainability_issues", -1L, false, true, 0L, true, false));
   }
 
   @Test
index e430671948e4233d3dcba578aa81214f0b5ec5e6..146bd63e6f6b08fd82c744367f8997a9e02a3a6f 100644 (file)
@@ -46,12 +46,12 @@ class DeleteSoftwareQualityRatingFromProjectMeasuresIT {
       insertProjectMeasure(metricUUid);
     });
 
-    assertThat(db.countSql("select count(1) from project_measures;"))
+    assertThat(db.countSql("select count(1) from project_measures"))
       .isEqualTo(DeleteSoftwareQualityRatingFromProjectMeasures.SOFTWARE_QUALITY_METRICS_TO_DELETE.size());
 
     underTest.execute();
 
-    assertThat(db.countSql("select count(1) from project_measures;")).isZero();
+    assertThat(db.countSql("select count(1) from project_measures")).isZero();
     Mockito.verify(migrationEsClient, Mockito.times(1)).deleteIndexes("projectmeasures");
   }
 
@@ -60,11 +60,11 @@ class DeleteSoftwareQualityRatingFromProjectMeasuresIT {
     String metricUUid = insertMetric("other_metric");
     insertProjectMeasure(metricUUid);
 
-    assertThat(db.countSql("select count(1) from project_measures;")).isEqualTo(1);
+    assertThat(db.countSql("select count(1) from project_measures")).isEqualTo(1);
 
     underTest.execute();
 
-    assertThat(db.countSql("select count(1) from project_measures;")).isEqualTo(1);
+    assertThat(db.countSql("select count(1) from project_measures")).isEqualTo(1);
   }
 
   @Test
@@ -77,13 +77,13 @@ class DeleteSoftwareQualityRatingFromProjectMeasuresIT {
     String metricUUid = insertMetric("other_metric");
     insertProjectMeasure(metricUUid);
 
-    assertThat(db.countSql("select count(1) from project_measures;"))
+    assertThat(db.countSql("select count(1) from project_measures"))
       .isEqualTo(DeleteSoftwareQualityRatingFromProjectMeasures.SOFTWARE_QUALITY_METRICS_TO_DELETE.size() + 1);
 
     underTest.execute();
     underTest.execute();
 
-    assertThat(db.countSql("select count(1) from project_measures;")).isOne();
+    assertThat(db.countSql("select count(1) from project_measures")).isOne();
   }
 
   private String insertMetric(String key) {