aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStep.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java12
2 files changed, 13 insertions, 1 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStep.java
index 1b0d7b0fdba..b8cc247a6c1 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStep.java
@@ -100,7 +100,7 @@ public class LoadPeriodsStep implements ComputationStep {
@Override
public void execute(ComputationStep.Context context) {
- if (analysisMetadataHolder.isFirstAnalysis()) {
+ if (analysisMetadataHolder.isFirstAnalysis() || !analysisMetadataHolder.isLongLivingBranch()) {
periodsHolder.setPeriod(null);
return;
}
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java
index 5b0eae50ef0..a0cd375b0a8 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java
@@ -112,6 +112,7 @@ public class LoadPeriodsStepTest extends BaseStepTest {
@Before
public void setUp() throws Exception {
november30th2008 = DATE_FORMAT.parse("2008-11-30");
+ when(analysisMetadataHolder.isLongLivingBranch()).thenReturn(true);
}
@Test
@@ -845,6 +846,17 @@ public class LoadPeriodsStepTest extends BaseStepTest {
verifyDebugLogs("Resolving new code period by version: 0.9");
}
+ @Test
+ @UseDataProvider("anyValidLeakPeriodSettingValue")
+ public void leak_period_setting_is_ignored_for_SLB_or_PR(String leakPeriodSettingValue) {
+ when(analysisMetadataHolder.isLongLivingBranch()).thenReturn(false);
+
+ settings.setProperty("sonar.leak.period", leakPeriodSettingValue);
+ underTest.execute(new TestComputationStepContext());
+
+ assertThat(periodsHolder.hasPeriod()).isFalse();
+ }
+
private void assertPeriod(String mode, @Nullable String modeParameter, long snapshotDate, String analysisUuid) {
Period period = periodsHolder.getPeriod();
assertThat(period).isNotNull();