Optimize Build 17/112017/5
authorsebdet <sebastien.determe@intl.att.com>
Tue, 1 Sep 2020 21:47:27 +0000 (23:47 +0200)
committerSébastien Determe <sebastien.determe@intl.att.com>
Wed, 2 Sep 2020 15:06:30 +0000 (15:06 +0000)
Optimize the time required to compute the tests so that the build can be faster

Issue-ID: SDC-3232
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I0ccbc3a0f9d895e75dcf5e4c1ef35ebf3ba06808
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
14 files changed:
catalog-be/pom.xml
catalog-dao/pom.xml
common/onap-common-configuration-management/onap-configuration-management-core/pom.xml
common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/pom.xml
integration-tests/pom.xml
integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ComponentBaseTest.java
integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/FileHandling.java
integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/SetupCDTest.java
integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java
integration-tests/src/test/resources/ci/conf/sdc-conf.yaml
integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml
onboarding/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/pom.xml
pom.xml

index 61a40e4..4eb05e6 100644 (file)
   <build>
     <finalName>${project.artifactId}-${project.version}</finalName>
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <configuration>
+            <forkCount>1</forkCount>
+          </configuration>
+      </plugin>
       <plugin>
         <!-- Download Swagger UI webjar. -->
         <artifactId>maven-dependency-plugin</artifactId>
index 52a317d..4634ce3 100644 (file)
@@ -345,7 +345,15 @@ Modifications copyright (c) 2018 Nokia
   </dependencies>
 
   <build>
-
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkCount>1</forkCount>
+        </configuration>
+      </plugin>
+    </plugins>
     <pluginManagement>
       <plugins>
         <!--This plugin's configuration is used to store Eclipse m2e settings
@@ -406,5 +414,6 @@ Modifications copyright (c) 2018 Nokia
         </plugin>
       </plugins>
     </pluginManagement>
+
   </build>
 </project>
index cf74fa1..b2f545f 100755 (executable)
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
-        <version>${maven-surefire-plugin.version}</version>
         <configuration>
           <systemPropertyVariables>
             <config.location>${project.basedir}/src/test/resources</config.location>
index 4efc32f..48124dd 100644 (file)
 
   </dependencies>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <version>${maven-surefire-plugin.version}</version>
-      </plugin>
-    </plugins>
-  </build>
-
 </project>
\ No newline at end of file
index 977c49e..7583de4 100644 (file)
@@ -242,7 +242,7 @@ limitations under the License.
                 <artifactId>maven-resources-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>copy-resources</id>
+                        <id>copy-chef-resources</id>
                         <phase>pre-integration-test</phase>
                         <goals>
                             <goal>copy-resources</goal>
@@ -293,10 +293,10 @@ limitations under the License.
                         <phase>pre-integration-test</phase>
                         <configuration>
                             <target>
-                                <mkdir dir="${it.shared.volume}"/>
-                                <chmod dir="${it.shared.volume}" type="dir" perm="ugo+rwx"/>
-                                <mkdir dir="target/automationDownloadDir"/>
-                                <chmod dir="target/automationDownloadDir" type="dir" perm="ugo+rwx"/>
+                                <mkdir dir="/tmp/sdc-integration-tests"/>
+                                <chmod dir="/tmp/sdc-integration-tests" type="dir" perm="ugo+rwx"/>
+                                <mkdir dir="/tmp/sdc-integration-tests/downloadAutomation"/>
+                                <chmod dir="/tmp/sdc-integration-tests/downloadAutomation" type="dir" perm="ugo+rwx"/>
                             </target>
                         </configuration>
                         <goals>
@@ -437,7 +437,7 @@ limitations under the License.
                             <alias>sdc-cassandra-onboard-init</alias>
                             <run>
                                 <dependsOn>
-                                    <container>sdc-cassandra-init</container>
+                                    <container>sdc-cassandra</container>
                                 </dependsOn>
                                 <env>
                                     <RELEASE>${project.version}</RELEASE>
@@ -520,7 +520,7 @@ limitations under the License.
                             <alias>sdc-backend</alias>
                             <run>
                                 <dependsOn>
-                                    <container>sdc-onboard-backend</container>
+                                    <container>sdc-cassandra-init</container>
                                 </dependsOn>
                                 <env>
                                     <cassandra_ssl_enabled>${it.cassandra.ssl.enabled}</cassandra_ssl_enabled>
@@ -593,9 +593,6 @@ limitations under the License.
                             <name>onap/sdc-frontend:${it.docker.version}</name>
                             <alias>sdc-frontend</alias>
                             <run>
-                                <dependsOn>
-                                    <container>sdc-backend-init</container>
-                                </dependsOn>
                                 <env>
                                     <ENVNAME>${it.env.name}</ENVNAME>
                                     <JAVA_OPTIONS>-Xdebug
@@ -718,7 +715,7 @@ limitations under the License.
                                 <volumes>
                                     <bind>
                                         <volume>
-                                            ${project.basedir}/target/automationDownloadDir/:/home/seluser/Desktop
+                                            /tmp/sdc-integration-tests/downloadAutomation/:/home/seluser/Desktop
                                         </volume>
                                         <volume>/dev/shm:/dev/shm</volume>
                                     </bind>
@@ -757,6 +754,8 @@ limitations under the License.
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-failsafe-plugin</artifactId>
                 <configuration>
+                    <forkCount>1</forkCount>
+                    <reuseForks>true</reuseForks>
                     <suiteXmlFiles>
                         <file>src/test/resources/ci/testSuites/backend/onapApiSanity.xml</file>
                         <file>src/test/resources/ci/testSuites/frontend/onapUiSanity.xml</file>
@@ -782,10 +781,6 @@ limitations under the License.
                         <!--<file>src/test/resources/ci/testSuites/testngLifeCycle.xml</file>-->
                         <!--                        <file>src/test/resources/ci/testSuites/user.xml</file>-->
                     </suiteXmlFiles>
-                    <!--                    <includes>-->
-                    <!--                        <include>**/*Test.java</include>-->
-                    <!--                    </includes>-->
-
                 </configuration>
             </plugin>
         </plugins>
index 71c8db0..985d161 100644 (file)
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -68,7 +68,7 @@ public abstract class ComponentBaseTest {
 
     protected static Logger logger = LogManager.getLogger(ComponentBaseTest.class);
 
-    protected static final String REPORT_FOLDER = "target" + File.separator + "ExtentReport" + File.separator;
+    protected static final String REPORT_FOLDER = "target" + File.separator + "ExtentReport" + File.separator + "API" + File.separator;
     private static final String REPORT_FILE_NAME = "SDC_CI_Extent_Report.html";
     public static Config config;
     protected static ITestContext myContext;
@@ -108,7 +108,7 @@ public abstract class ComponentBaseTest {
     @BeforeMethod(alwaysRun = true)
     public void setupBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception {
         if (!"onboardVNFShotFlow".equals(method.getName()) &&
-            !"onboardPNFFlow".equals(method.getName()) ) {
+                !"onboardPNFFlow".equals(method.getName())) {
             logger.info("ExtentReport instance started from BeforeMethod...");
             ExtentTestManager.startTest(method.getName());
             ExtentTestManager.assignCategory(this.getClass());
@@ -186,7 +186,7 @@ public abstract class ComponentBaseTest {
 
 
         List<String> genericCollection = new ArrayList<>();
-        if(resourcesArrayList.get(0) != null) {
+        if (resourcesArrayList.get(0) != null) {
             ComponentTypeEnum componentTypeEnum = resourcesArrayList.get(0).getComponentType();
             resourcesArrayList.stream().filter(Objects::nonNull).
                     filter(s -> s.getName().toLowerCase().startsWith("ci") && !s.getName().toLowerCase().equals("cindervolume")).
index 5cb55fd..19533e9 100644 (file)
@@ -312,7 +312,7 @@ public class FileHandling {
        public static void createDirectory(String directoryPath) {
                File directory = new File(String.valueOf(directoryPath));
            if (! directory.exists()){
-               directory.mkdir();
+               directory.mkdirs();
            }
        }
 
index 9f5a7cc..18b5a71 100644 (file)
@@ -24,11 +24,13 @@ import ch.qos.logback.classic.Level;
 import ch.qos.logback.classic.LoggerContext;
 import com.aventstack.extentreports.ExtentTest;
 import com.aventstack.extentreports.Status;
+
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.UUID;
+
 import net.lightbody.bmp.core.har.Har;
 import org.json.simple.JSONObject;
 import org.onap.sdc.backend.ci.tests.config.UserCredentialsFromFile;
@@ -75,7 +77,7 @@ public abstract class SetupCDTest extends DriverFactory {
     private static final String CREDENTIALS_FILE = "credentials.yaml";
 
     private static final String REPORT_FILE_NAME = "SDC_UI_Extent_Report.html";
-    private static final String REPORT_FOLDER = "target" + File.separator + "ExtentReport" + File.separator;
+    private static final String REPORT_FOLDER = "target" + File.separator + "ExtentReport" + File.separator + "UI" + File.separator;
     private static final String SCREENSHOT_FOLDER = REPORT_FOLDER + "screenshots" + File.separator;
     private static final String HAR_FILES_FOLDER_NAME = "har_files";
     private static final String HAR_FILES_FOLDER = REPORT_FOLDER + HAR_FILES_FOLDER_NAME + File.separator;
@@ -392,7 +394,7 @@ public abstract class SetupCDTest extends DriverFactory {
     private void loginWithUser(final UserRoleEnum role) {
         try {
             final String msg = String
-                .format("Login as user '%s', role '%s'", role.getUserId(), role.getUserRole());
+                    .format("Login as user '%s', role '%s'", role.getUserId(), role.getUserRole());
             getExtendTest().log(Status.INFO, msg);
             LOGGER.info(msg);
             loginToSystem(role);
@@ -423,7 +425,7 @@ public abstract class SetupCDTest extends DriverFactory {
         LOGGER.info(String.format("Setup before test for role '%s'", role.name()));
         if (!getWindowTest().getPreviousRole().equalsIgnoreCase(role.name())) {
             LOGGER.info(String.format("Logging in with new role '%s'. Previous role was: '%s'.", role.name(),
-                getWindowTest().getPreviousRole()));
+                    getWindowTest().getPreviousRole()));
             navigateAndLogin(role);
         }
     }
index bb058e4..b7f199d 100644 (file)
@@ -304,7 +304,7 @@ public class FileHandling {
     public static void createDirectory(String directoryPath) {
         File directory = new File(String.valueOf(directoryPath));
         if (!directory.exists()) {
-            directory.mkdir();
+            directory.mkdirs();
         }
     }
 
index cea230e..5303e3b 100644 (file)
@@ -5,7 +5,7 @@ remoteTestingMachinePort: 4444
 remoteTesting: true
 useBrowserMobProxy: false
 captureTraffic: false
-downloadAutomationFolder: target/automationDownloadDir
+downloadAutomationFolder: /tmp/sdc-integration-tests/downloadAutomation
 uiSimulator: true
 
 #### Local Front end testing
index a9d5661..47dc9f6 100644 (file)
@@ -1,30 +1,30 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
 <suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="1"
-  data-provider-thread-count="1">
+       data-provider-thread-count="1">
 
-  <parameter name="makeDistribution" value="false"/>
+    <parameter name="makeDistribution" value="false"/>
 
-  <test name="uiSanity">
-    <classes>
-      <class name="org.onap.sdc.frontend.ci.tests.execute.sanity.Vf">
-        <methods>
-          <include name="changeInstanceNameInVfTest"/>
-        </methods>
-      </class>
-      <class name="org.onap.sdc.frontend.ci.tests.execute.sanity.Service">
-        <methods>
-          <include name="updateService"/>
-        </methods>
-      </class>
-      <class name="org.onap.sdc.frontend.ci.tests.execute.sanity.OnboardingFlowsUi">
-        <methods>
-          <include name="onapOnboardVNFflow"/>
-          <include name="onapOnboardVSPValidationsSanityFlow"/>
-          <include name="onboardPNFSoftwareInformationFlow"/>
-        </methods>
-      </class>
-      <class name="org.onap.sdc.frontend.ci.tests.execute.sanity.GAB"/>
-    </classes>
-  </test>
+    <test name="uiSanity">
+        <classes>
+            <class name="org.onap.sdc.frontend.ci.tests.execute.sanity.Vf">
+                <methods>
+                    <include name="changeInstanceNameInVfTest"/>
+                </methods>
+            </class>
+            <class name="org.onap.sdc.frontend.ci.tests.execute.sanity.Service">
+                <methods>
+                    <include name="updateService"/>
+                </methods>
+            </class>
+            <class name="org.onap.sdc.frontend.ci.tests.execute.sanity.OnboardingFlowsUi">
+                <methods>
+                    <include name="onapOnboardVNFflow"/>
+                    <include name="onapOnboardVSPValidationsSanityFlow"/>
+                    <include name="onboardPNFSoftwareInformationFlow"/>
+                </methods>
+            </class>
+            <class name="org.onap.sdc.frontend.ci.tests.execute.sanity.GAB"/>
+        </classes>
+    </test>
 </suite>
index 4ccb3d8..2d7927e 100644 (file)
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
-        <version>${maven-surefire-plugin.version}</version>
         <configuration>
-          <forkCount>${fork.count}</forkCount>
-          <forkMode>${fork.mode}</forkMode>
           <printSummary>false</printSummary>
           <additionalClasspathElements>
             <additionalClasspathElement>${project.basedir}/src/test/resources
             </logback.configurationFile>
             <config.location>${project.basedir}/configuration</config.location>
           </systemPropertyVariables>
-          <useSystemClassLoader>${useSystemClassLoader}</useSystemClassLoader>
         </configuration>
       </plugin>
       <plugin>
index 44ea11c..d1269cf 100644 (file)
     </dependency>
   </dependencies>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <version>${maven-surefire-plugin.version}</version>
-      </plugin>
-    </plugins>
-  </build>
-
 </project>
diff --git a/pom.xml b/pom.xml
index 08a6dc9..ea422e0 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -156,15 +156,14 @@ Modifications copyright (c) 2018-2019 Nokia
         <docker.tag>${project.version}-${maven.build.timestamp}</docker.tag>
         <!--togglz version-->
         <togglz.version>2.4.1.Final</togglz.version>
-
         <joda.time.version>2.9.9</joda.time.version>
-
         <!--sdc-security-utils-->
         <security.util.lib.version>1.6.0</security.util.lib.version>
         <!--jacoco-->
         <jacoco.version>0.8.5</jacoco.version>
-
         <java.driver.core.version>4.5.1</java.driver.core.version>
+        <surefire.forkCount>1C</surefire.forkCount>
+        <surefire.reuseForks>true</surefire.reuseForks>
     </properties>
 
     <dependencyManagement>
@@ -513,6 +512,9 @@ Modifications copyright (c) 2018-2019 Nokia
                     <systemPropertyVariables>
                         <jacoco-agent.destfile>${project.build.directory}/jacoco.exec</jacoco-agent.destfile>
                     </systemPropertyVariables>
+                    <forkCount>${surefire.forkCount}</forkCount>
+                    <reuseForks>${surefire.reuseForks}</reuseForks>
+                    <parallel>methods</parallel>
                 </configuration>
             </plugin>
             <plugin>