diff options
Diffstat (limited to 'it')
-rw-r--r-- | it/pom.xml | 38 | ||||
-rw-r--r-- | it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java | 16 | ||||
-rw-r--r-- | it/src/test/java/com/sonarsource/scanner/it/SonarScannerTestSuite.java | 2 |
3 files changed, 28 insertions, 28 deletions
@@ -67,22 +67,28 @@ </dependencies> <build> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <systemProperties> - <scanner.version>${env.PROJECT_VERSION}</scanner.version> - </systemProperties> - <includes> - <include>**/SonarScannerTestSuite.java</include> - </includes> - </configuration> - </plugin> - </plugins> - </pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <!-- Some tests are asserting on localized messages or dates --> + <systemPropertyVariables> + <user.language>en</user.language> + <user.country>US</user.country> + </systemPropertyVariables> + <environmentVariables> + <LANGUAGE>en_US</LANGUAGE> + </environmentVariables> + <systemProperties> + <scanner.version>${env.PROJECT_VERSION}</scanner.version> + </systemProperties> + <includes> + <include>**/SonarScannerTestSuite.java</include> + </includes> + </configuration> + </plugin> + </plugins> </build> <profiles> diff --git a/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java b/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java index 8055d82..d6b9bf7 100644 --- a/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java +++ b/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java @@ -164,17 +164,14 @@ public class ScannerTest extends ScannerTestCase { @Test public void should_use_environment_prop() { SonarScanner build = newScanner(new File("projects/simple-sample")) - .setEnvironmentVariable("SONAR_HOST_URL", "http://from-env.org"); + .setEnvironmentVariable("SONAR_HOST_URL", "http://www.google.com/404"); BuildRunner runner = new BuildRunner(orchestrator.getConfiguration()); BuildResult buildResult = runner.runQuietly(null, build); assertThat(buildResult.isSuccess()).isFalse(); assertThat(buildResult.getLogs()) - .containsAnyOf( - "No such host is known (from-env.org)", // Windows - "from-env.org: Name or service not known" // Linux - ); + .contains("Error status returned by url [http://www.google.com/404/api/v2/analysis/version]: 404"); } @Test @@ -192,18 +189,15 @@ public class ScannerTest extends ScannerTestCase { public void should_fail_if_unable_to_connect() { SonarScanner build = newScanner(new File("projects/simple-sample")) //env property should be overridden - .setEnvironmentVariable("SONAR_HOST_URL", "http://from-env.org") - .setProperty("sonar.host.url", "http://foo"); + .setEnvironmentVariable("SONAR_HOST_URL", "http://www.google.com") + .setProperty("sonar.host.url", "http://www.google.com/404"); BuildResult result = orchestrator.executeBuildQuietly(build); // expect build failure assertThat(result.isSuccess()).isFalse(); // with the following message assertThat(result.getLogs()) - .containsAnyOf( - "No such host is known (foo)", // Windows - "foo: No address associated with hostname" // Linux - ); + .contains("Error status returned by url [http://www.google.com/404/api/v2/analysis/version]: 404"); } // SONARPLUGINS-3574 diff --git a/it/src/test/java/com/sonarsource/scanner/it/SonarScannerTestSuite.java b/it/src/test/java/com/sonarsource/scanner/it/SonarScannerTestSuite.java index e3222a5..8d4df88 100644 --- a/it/src/test/java/com/sonarsource/scanner/it/SonarScannerTestSuite.java +++ b/it/src/test/java/com/sonarsource/scanner/it/SonarScannerTestSuite.java @@ -38,7 +38,7 @@ public class SonarScannerTestSuite { private static OrchestratorRule createOrchestrator() { String sonarVersion = System - .getProperty("sonar.runtimeVersion", "LATEST_RELEASE[9.9]"); + .getProperty("sonar.runtimeVersion", "DEV"); return OrchestratorRule.builderEnv() .useDefaultAdminCredentialsForBuilds(true) .setSonarVersion(sonarVersion) |