From d976cddf0c7d777cb1ce3dc5d178280f7f4997b4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?L=C3=A9o=20Geoffroy?= Date: Mon, 11 Nov 2024 16:28:43 +0100 Subject: [PATCH] SGB-211 SGB-212 Fix errors on weekly tasks --- .../v108/CreateNewSoftwareQualityMetricsIT.java | 16 +++++++++------- ...ftwareQualityRatingFromProjectMeasuresIT.java | 12 ++++++------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v108/CreateNewSoftwareQualityMetricsIT.java b/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v108/CreateNewSoftwareQualityMetricsIT.java index 16421382ed3..bb542bd94ee 100644 --- a/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v108/CreateNewSoftwareQualityMetricsIT.java +++ b/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v108/CreateNewSoftwareQualityMetricsIT.java @@ -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 diff --git a/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v108/DeleteSoftwareQualityRatingFromProjectMeasuresIT.java b/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v108/DeleteSoftwareQualityRatingFromProjectMeasuresIT.java index e430671948e..146bd63e6f6 100644 --- a/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v108/DeleteSoftwareQualityRatingFromProjectMeasuresIT.java +++ b/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v108/DeleteSoftwareQualityRatingFromProjectMeasuresIT.java @@ -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) { -- 2.39.5