From dd0237017f0b7d5be1c41017d2781c56f64b1332 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 13 Apr 2017 22:43:53 +0200 Subject: Upgrade to Orchestrator 3.15.0.1038 to benefit from better HTTP reliability --- it/it-tests/src/test/java/it/analysis/SSLTest.java | 5 +++-- .../src/test/java/it/analysis/TempFolderTest.java | 22 +++++++--------------- it/it-tests/src/test/java/it/lite/LiteTest.java | 2 +- pom.xml | 2 +- tests/perf/pom.xml | 9 +++++++++ .../perf/scanner/suite/HighlightingTest.java | 1 + .../perf/scanner/suite/IssuesModeTest.java | 3 ++- .../sonarqube/perf/scanner/suite/MemoryTest.java | 11 +++++++++-- 8 files changed, 33 insertions(+), 22 deletions(-) diff --git a/it/it-tests/src/test/java/it/analysis/SSLTest.java b/it/it-tests/src/test/java/it/analysis/SSLTest.java index 8ee76c6653d..97b40550297 100644 --- a/it/it-tests/src/test/java/it/analysis/SSLTest.java +++ b/it/it-tests/src/test/java/it/analysis/SSLTest.java @@ -24,6 +24,7 @@ import com.sonar.orchestrator.build.BuildResult; import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.util.NetworkUtils; import it.Category3Suite; +import java.net.InetAddress; import java.nio.file.Path; import java.nio.file.Paths; import org.eclipse.jetty.http.HttpVersion; @@ -69,8 +70,8 @@ public class SSLTest { } public static void startSSLTransparentReverseProxy(boolean requireClientAuth) throws Exception { - int httpPort = NetworkUtils.getNextAvailablePort(); - httpsPort = NetworkUtils.getNextAvailablePort(); + int httpPort = NetworkUtils.getNextAvailablePort(InetAddress.getLoopbackAddress()); + httpsPort = NetworkUtils.getNextAvailablePort(InetAddress.getLoopbackAddress()); // Setup Threadpool QueuedThreadPool threadPool = new QueuedThreadPool(); diff --git a/it/it-tests/src/test/java/it/analysis/TempFolderTest.java b/it/it-tests/src/test/java/it/analysis/TempFolderTest.java index 613ef099e3a..0af1543b3ed 100644 --- a/it/it-tests/src/test/java/it/analysis/TempFolderTest.java +++ b/it/it-tests/src/test/java/it/analysis/TempFolderTest.java @@ -76,21 +76,13 @@ public class TempFolderTest { // SONAR-4748 @Test public void should_not_use_system_tmp_dir() throws Exception { - String oldTmp = System.getProperty("java.io.tmpdir"); - try { - File tmp = temp.newFolder(); - assertThat(tmp.list()).isEmpty(); - - SonarScanner runner = configureScanner() - .setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Djava.io.tmpdir=" + tmp.getAbsolutePath()); - orchestrator.executeBuild(runner); - - // TODO There is one remaining file waiting for SONARPLUGINS-3185 - assertThat(tmp.list()).hasSize(1); - assertThat(tmp.list()[0]).matches("sonar-runner-batch(.*).jar"); - } finally { - System.setProperty("java.io.tmpdir", oldTmp); - } + File tmp = temp.newFolder(); + SonarScanner runner = configureScanner() + .setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Djava.io.tmpdir=" + tmp.getAbsolutePath()); + orchestrator.executeBuild(runner); + + // temp directory is clean-up + assertThat(tmp.list()).isEmpty(); } private BuildResult scan(String... props) { diff --git a/it/it-tests/src/test/java/it/lite/LiteTest.java b/it/it-tests/src/test/java/it/lite/LiteTest.java index d96a9c94cba..3a636529d6c 100644 --- a/it/it-tests/src/test/java/it/lite/LiteTest.java +++ b/it/it-tests/src/test/java/it/lite/LiteTest.java @@ -52,7 +52,7 @@ public class LiteTest { @ClassRule public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv() - .setContext("/sonarqube") + .setOrchestratorProperty("sonar.web.context", "/sonarqube") .addPlugin(xooPlugin()) .build(); diff --git a/pom.xml b/pom.xml index 9445f14324a..96cf6b8aec8 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ 1.7.21 8.5.11 2.4.4 - 3.15.0.917 + 3.15.0.1038 3.3.1 2.6.6 diff --git a/tests/perf/pom.xml b/tests/perf/pom.xml index df243bc7b02..c37ae0e7b9b 100644 --- a/tests/perf/pom.xml +++ b/tests/perf/pom.xml @@ -51,6 +51,15 @@ sonar-orchestrator ${orchestrator.version} + + + org.codehaus.sonar.runner + sonar-runner-dist + 2.4 + zip + provided + org.codehaus.sonar sonar-update-center-common diff --git a/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/scanner/suite/HighlightingTest.java b/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/scanner/suite/HighlightingTest.java index e77ec458df2..b09c3278bfe 100644 --- a/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/scanner/suite/HighlightingTest.java +++ b/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/scanner/suite/HighlightingTest.java @@ -86,6 +86,7 @@ public class HighlightingTest extends PerfTestCase { } SonarScanner scanner = SonarScanner.create() + .setScannerVersion("2.4") .setProperties( "sonar.projectKey", "highlighting", "sonar.projectName", "highlighting", diff --git a/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/scanner/suite/IssuesModeTest.java b/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/scanner/suite/IssuesModeTest.java index 2555a919dc8..76b6b219d6e 100644 --- a/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/scanner/suite/IssuesModeTest.java +++ b/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/scanner/suite/IssuesModeTest.java @@ -61,7 +61,8 @@ public class IssuesModeTest extends PerfTestCase { "-Xmx512m -server", "sonar.analysis.mode", "issues", "sonar.userHome", userHome.getAbsolutePath(), - "sonar.showProfiling", "true"); + "sonar.showProfiling", "true") + .setScannerVersion("2.4"); long start = System.currentTimeMillis(); orchestrator.executeBuild(runner, false); long duration = System.currentTimeMillis() - start; diff --git a/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/scanner/suite/MemoryTest.java b/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/scanner/suite/MemoryTest.java index e65a4f9c087..01f9532d910 100644 --- a/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/scanner/suite/MemoryTest.java +++ b/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/scanner/suite/MemoryTest.java @@ -23,6 +23,7 @@ import com.google.common.base.Strings; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; import com.sonar.orchestrator.build.SonarScanner; +import com.sonar.orchestrator.http.HttpMethod; import java.io.File; import java.io.IOException; import org.apache.commons.io.FileUtils; @@ -31,7 +32,6 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.sonar.wsclient.services.PropertyCreateQuery; import org.sonarsource.sonarqube.perf.MavenLogs; import org.sonarsource.sonarqube.perf.PerfRule; import org.sonarsource.sonarqube.perf.PerfTestCase; @@ -79,6 +79,7 @@ public class MemoryTest extends PerfTestCase { FileUtils.write(new File(baseDir, "sonar-project.properties"), "sonar.myBigProp=" + Strings.repeat("A", 10000), true); SonarScanner scanner = SonarScanner.create() + .setScannerVersion("2.4") .setProperties( "sonar.projectKey", "big-module-tree", "sonar.projectName", "Big Module Tree", @@ -92,7 +93,13 @@ public class MemoryTest extends PerfTestCase { perfRule.assertDurationAround(MavenLogs.extractTotalTime(result.getLogs()), 4847L); // Second execution with a property on server side - orchestrator.getServer().getAdminWsClient().create(new PropertyCreateQuery("sonar.anotherBigProp", Strings.repeat("B", 1000), "big-module-tree")); + orchestrator.getServer().newHttpCall("/api/settings/set") + .setMethod(HttpMethod.POST) + .setAdminCredentials() + .setParam("key", "sonar.anotherBigProp") + .setParam("value", Strings.repeat("B", 1000)) + .setParam("component", "big-module-tree") + .execute(); result = orchestrator.executeBuild(scanner); perfRule.assertDurationAround(MavenLogs.extractTotalTime(result.getLogs()), 4620L); } -- cgit v1.2.3