]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
SQSCANNER-117 Add IT
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Fri, 4 Aug 2023 16:07:40 +0000 (11:07 -0500)
committerDuarte Meneses <duarte.meneses@sonarsource.com>
Tue, 15 Aug 2023 14:41:12 +0000 (09:41 -0500)
.cirrus.yml
it/projects/simple-js/file.js [new file with mode: 0644]
it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java
it/src/test/java/com/sonarsource/scanner/it/SonarScannerTestSuite.java

index ee3178c84095babea7da0a3fc05992cd5fc1e503..c7bda9f51109a9470eb90163aef724914c054d49 100644 (file)
@@ -34,7 +34,7 @@ eks_container: &EKS_CONTAINER
   namespace: default
   image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j17-m3-latest
   cpu: 1
-  memory: 2G
+  memory: 4G
 
 ec2_instance: &EC2_INSTANCE_WINDOWS
   experimental: true # see https://github.com/cirruslabs/cirrus-ci-docs/issues/1051
@@ -77,11 +77,16 @@ linux_qa_java17_task:
     <<: *EKS_CONTAINER
   env:
     matrix:
-      - SQ_VERSION: LATEST_RELEASE[8.9]
+      - SQ_VERSION: LATEST_RELEASE[9.9]
       - SQ_VERSION: DEV
   maven_cache:
     folder: ${CIRRUS_WORKING_DIR}/.m2/repository
   qa_script:
+    - nodeVersion=18.17.0
+    - nodeName=node-v${nodeVersion}-linux-x64
+    - wget https://nodejs.org/download/release/v${nodeVersion}/${nodeName}.tar.gz
+    - tar xzf ${nodeName}.tar.gz -C /tmp
+    - export PATH=$PATH:/tmp/${nodeName}/bin
     - source cirrus-env QA
     - source set_maven_build_version $BUILD_NUMBER
     - cd it
@@ -98,7 +103,7 @@ win_qa_java17_task:
   env:
     CIRRUS_SHELL: bash
     matrix:
-      - SQ_VERSION: LATEST_RELEASE[8.9]
+      - SQ_VERSION: LATEST_RELEASE[9.9]
       - SQ_VERSION: DEV
   maven_cache:
     folder: ${CIRRUS_WORKING_DIR}/.m2/repository
diff --git a/it/projects/simple-js/file.js b/it/projects/simple-js/file.js
new file mode 100644 (file)
index 0000000..85ddcdb
--- /dev/null
@@ -0,0 +1,3 @@
+function msg(){
+    alert("Hello JS");
+}
\ No newline at end of file
index 0058830da343d1e941bbcb92312f6dcebf16f129..3241b168e084af7b9d37dec4b8f65d6be3b73d05 100644 (file)
@@ -52,6 +52,20 @@ public class ScannerTest extends ScannerTestCase {
       .isGreaterThan(1);
   }
 
+  /**
+   * SQSCANNER-117
+   */
+  @Test
+  public void analyzers_can_spawn_processes() {
+    SonarScanner build = newScanner(new File("projects/simple-js"))
+      .useNative()
+      .setProjectKey("SAMPLE");
+    orchestrator.executeBuild(build);
+    Map<String, Measure> projectMeasures = getMeasures("SAMPLE", "files", "ncloc");
+    assertThat(parseInt(projectMeasures.get("files").getValue())).isEqualTo(1);
+    assertThat(parseInt(projectMeasures.get("ncloc").getValue())).isGreaterThan(1);
+  }
+
   /**
    * Replace the maven format groupId:artifactId by a single key
    */
index 73e011e89887f7246d58bff7d24a3b4d8f20327a..fbaa5b8d9796055190bb26d69ad48604c97a08b0 100644 (file)
@@ -36,13 +36,13 @@ public class SonarScannerTestSuite {
 
   private static Orchestrator createOrchestrator() {
     String sonarVersion = System
-      .getProperty("sonar.runtimeVersion", "LATEST_RELEASE[7.9]");
+      .getProperty("sonar.runtimeVersion", "LATEST_RELEASE[9.9]");
     return Orchestrator.builderEnv()
       .useDefaultAdminCredentialsForBuilds(true)
-      .setSonarVersion(
-        sonarVersion).addPlugin(MavenLocation
-        .of("org.sonarsource.sonarqube", "sonar-xoo-plugin",
-          sonarVersion)).build();
+      .setSonarVersion(sonarVersion)
+      .keepBundledPlugins()
+      .addPlugin(MavenLocation.of("org.sonarsource.sonarqube", "sonar-xoo-plugin", sonarVersion))
+      .build();
   }
 
 }