Keep integrationtest runtime folder 08/72508/3
authorLorand Jakab <lojakab@cisco.com>
Wed, 30 May 2018 17:19:20 +0000 (19:19 +0200)
committerLorand Jakab <lojakab@cisco.com>
Mon, 4 Jun 2018 16:41:25 +0000 (18:41 +0200)
It is very helpful to have the full Karaf environment used for the
integrationtest stay available after the test finishes. It lives in the
integrationtest/target/exam/{guid} folder, and has the full (~350MB)
Karaf distribution.

The most useful piece is the data/log/karaf.log file, which can be
examined in case of a failure. Other useful pieces are the configuration
files in etc/ which are modified by the integrationtests.

The patch makes sure to delete any existing such runtime environment, to
avoid developers building up many such folders, which takes up a lot of
space, and makes it harder to determine which environment was the last
one.

When running builds in Jenkins, only the log files are saved to the log
server, so the impact is minimal, but it helps debugging integration
test failures which occur on the CI infrastructure.

Change-Id: I11e92efebf6d74c95e4ddf12d02c4ba98462d8ba
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java

index 2d54508960bc4cd996384b8f91f84e1a6dda3c90..d53205aa6e2a8a9e12d4143e7a3418ea01f561e4 100644 (file)
@@ -30,10 +30,13 @@ import static org.opendaylight.lispflowmapping.integrationtest.MultiSiteScenario
 import static org.opendaylight.lispflowmapping.integrationtest.MultiSiteScenarioUtil.SITE_E_SB;
 import static org.ops4j.pax.exam.CoreOptions.composite;
 import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
+import java.io.File;
 import java.io.IOException;
 import java.net.DatagramSocket;
 import java.net.InetAddress;
@@ -136,6 +139,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.ma
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin;
+import org.ops4j.io.FileUtils;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
@@ -207,6 +211,14 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
         return option;
     }
 
+    @Override
+    protected Option[] getAdditionalOptions() {
+        return new Option[] {
+                keepRuntimeFolder(),
+                configureConsole().ignoreLocalConsole().ignoreRemoteShell()
+        };
+    }
+
     @Test
     public void testLispFlowMappingFeatureLoad() {
         Assert.assertTrue(true);
@@ -221,6 +233,9 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
 
     @Before
     public void before() throws Exception {
+        File paxExamDirectory = new File("target/exam/");
+        FileUtils.delete(paxExamDirectory);
+
         areWeReady();
         mapService.setLookupPolicy(IMappingService.LookupPolicy.NB_FIRST);
         mapService.setMappingMerge(false);