aboutsummaryrefslogtreecommitdiffstats
path: root/it
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2015-08-20 16:58:48 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2015-08-21 13:55:09 +0200
commit7370c19e9acfefb2b9ac1fb3aeea7fd73f5a5fc3 (patch)
treeb8446a920ddb827cbd967129b5a27e6c17331565 /it
parent24cd3f3a91720995ec076ac0073665ba73f27ade (diff)
downloadsonarqube-7370c19e9acfefb2b9ac1fb3aeea7fd73f5a5fc3.tar.gz
sonarqube-7370c19e9acfefb2b9ac1fb3aeea7fd73f5a5fc3.zip
SONAR-6721 Prevent running concurrent batch processes on the same physical project
Diffstat (limited to 'it')
-rw-r--r--it/it-tests/src/test/java/batch/IssuesModeTest.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/it/it-tests/src/test/java/batch/IssuesModeTest.java b/it/it-tests/src/test/java/batch/IssuesModeTest.java
index 0e8ce198440..e4c0f3306a1 100644
--- a/it/it-tests/src/test/java/batch/IssuesModeTest.java
+++ b/it/it-tests/src/test/java/batch/IssuesModeTest.java
@@ -295,7 +295,6 @@ public class IssuesModeTest {
fail("Issue not found");
}
- // SONAR-4602
@Test
public void concurrent_issue_mode_on_existing_project() throws Exception {
restoreProfile("one-issue-per-line.xml");
@@ -312,7 +311,7 @@ public class IssuesModeTest {
// Install sonar-runner in advance to avoid concurrent unzip issues
FileSystem fileSystem = orchestrator.getConfiguration().fileSystem();
new SonarRunnerInstaller(fileSystem).install(Version.create(SonarRunner.DEFAULT_RUNNER_VERSION), fileSystem.workspace());
- final int nThreads = 5;
+ final int nThreads = 3;
ExecutorService executorService = Executors.newFixedThreadPool(nThreads);
List<Callable<BuildResult>> tasks = new ArrayList<>();
for (int i = 0; i < nThreads; i++) {
@@ -325,8 +324,20 @@ public class IssuesModeTest {
});
}
+ boolean expectedError = false;
for (Future<BuildResult> result : executorService.invokeAll(tasks)) {
+ try {
result.get();
+ } catch(ExecutionException e) {
+ if(e.getCause() instanceof BuildFailureException) {
+ BuildFailureException bfe = (BuildFailureException) e.getCause();
+ assertThat(bfe.getResult().getLogs()).contains("Another SonarQube analysis is already in progress for this project");
+ expectedError = true;
+ }
+ }
+ }
+ if(!expectedError) {
+ fail("At least one of the threads should have failed");
}
}