Skip to content

Commit 672f2b0

Browse files
authored
Fix ITs after upgrade of orchestrator (SonarSource#160)
1 parent a8af76e commit 672f2b0

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

.cix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ TEST:
88
SQ_VERSION:
99
- DEV
1010
- LATEST_RELEASE
11-
- LTS
11+
- LATEST_RELEASE[6.7]
1212

1313
exclude:
1414
- TEST: plugin
@@ -18,4 +18,4 @@ exclude:
1818
SQ_VERSION: DEV
1919

2020
- TEST: ruling
21-
SQ_VERSION: LTS
21+
SQ_VERSION: LATEST_RELEASE[6.7]

its/plugin/src/test/java/com/sonar/python/it/plugin/Tests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@
5858
})
5959
public class Tests {
6060

61+
private static final String SQ_VERSION_PROPERTY = "sonar.runtimeVersion";
62+
private static final String DEFAULT_SQ_VERSION = "LATEST_RELEASE";
63+
6164
public static final FileLocation PLUGIN_LOCATION = FileLocation.byWildcardMavenFilename(new File("../../sonar-python-plugin/target"), "sonar-python-plugin-*.jar");
6265

6366
@ClassRule
6467
public static Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
68+
.setSonarVersion(System.getProperty(SQ_VERSION_PROPERTY, DEFAULT_SQ_VERSION))
6569
.addPlugin(PLUGIN_LOCATION)
6670
.restoreProfileAtStartup(FileLocation.of("profiles/no_rule.xml"))
6771
.restoreProfileAtStartup(FileLocation.of("profiles/pylint.xml"))

its/ruling/src/test/java/org/sonar/python/it/PythonRulingTest.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,29 @@
2323
import com.sonar.orchestrator.Orchestrator;
2424
import com.sonar.orchestrator.build.SonarScanner;
2525
import com.sonar.orchestrator.locator.FileLocation;
26-
import org.junit.ClassRule;
27-
import org.junit.Test;
28-
26+
import com.sonar.orchestrator.locator.MavenLocation;
2927
import java.io.File;
3028
import java.nio.charset.StandardCharsets;
29+
import org.junit.ClassRule;
30+
import org.junit.Test;
3131

3232
import static org.assertj.core.api.Assertions.assertThat;
33-
import static org.junit.Assert.assertTrue;
3433

3534
public class PythonRulingTest {
3635

36+
private static final String SQ_VERSION_PROPERTY = "sonar.runtimeVersion";
37+
private static final String DEFAULT_SQ_VERSION = "LATEST_RELEASE";
38+
3739
@ClassRule
3840
public static Orchestrator orchestrator = Orchestrator.builderEnv()
41+
.setSonarVersion(System.getProperty(SQ_VERSION_PROPERTY, DEFAULT_SQ_VERSION))
3942
.addPlugin(FileLocation.byWildcardMavenFilename(new File("../../sonar-python-plugin/target"), "sonar-python-plugin-*.jar"))
40-
.setOrchestratorProperty("litsVersion", "0.6")
41-
.addPlugin("lits")
43+
.addPlugin(MavenLocation.of("org.sonarsource.sonar-lits-plugin", "sonar-lits-plugin", "0.6"))
4244
.restoreProfileAtStartup(FileLocation.of("src/test/resources/profile.xml"))
4345
.build();
4446

4547
@Test
4648
public void test() throws Exception {
47-
assertTrue(
48-
"SonarQube 5.6 is the minimum version to generate the issues report",
49-
orchestrator.getConfiguration().getSonarVersion().isGreaterThanOrEquals("5.6"));
5049
orchestrator.getServer().provisionProject("project", "project");
5150
orchestrator.getServer().associateProjectToQualityProfile("project", "py", "rules");
5251
File litsDifferencesFile = FileLocation.of("target/differences").getFile();

0 commit comments

Comments
 (0)