From 0c0d3c3a54fd25fad64a3442dcc487d14932f2e2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Mon, 18 Jan 2016 09:59:30 +0100 Subject: [PATCH] fix DifferentialPeriodsTest instability --- .../java/it/measureHistory/DifferentialPeriodsTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/it/it-tests/src/test/java/it/measureHistory/DifferentialPeriodsTest.java b/it/it-tests/src/test/java/it/measureHistory/DifferentialPeriodsTest.java index 8ce2033931c..9c03b93052e 100644 --- a/it/it-tests/src/test/java/it/measureHistory/DifferentialPeriodsTest.java +++ b/it/it-tests/src/test/java/it/measureHistory/DifferentialPeriodsTest.java @@ -75,15 +75,16 @@ public class DifferentialPeriodsTest { setServerProperty(orchestrator, PROJECT_KEY, "sonar.timemachine.period4", "30"); setServerProperty(orchestrator, PROJECT_KEY, "sonar.timemachine.period5", "previous_analysis"); - // Execute an analysis in the past to have a past snapshot without any issues + // Execute an analysis 60 days ago to have a past snapshot without any issues orchestrator.getServer().associateProjectToQualityProfile(PROJECT_KEY, "xoo", "empty"); orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")) .setProperty("sonar.projectDate", formatDate(addDays(new Date(), -60)))); - // Second analysis -> issues will be created + // Second analysis, 20 days ago, issues will be created orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/measureHistory/one-issue-per-line-profile.xml")); orchestrator.getServer().associateProjectToQualityProfile(PROJECT_KEY, "xoo", "one-issue-per-line"); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")) + .setProperty("sonar.projectDate", formatDate(addDays(new Date(), -20)))); // New technical debt only comes from new issues Resource newTechnicalDebt = orchestrator.getServer().getWsClient() @@ -92,7 +93,7 @@ public class DifferentialPeriodsTest { assertThat(measures.get(0).getVariation4()).isEqualTo(17); assertThat(measures.get(0).getVariation5()).isEqualTo(17); - // Third analysis, with exactly the same profile -> no new issues so no new technical debt + // Third analysis, today, with exactly the same profile -> no new issues so no new technical debt orchestrator.getServer().associateProjectToQualityProfile(PROJECT_KEY, "xoo", "one-issue-per-line"); orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); -- 2.39.5