You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2021/05/28 10:28:47 UTC

[sling-org-apache-sling-starter] branch master updated: SLING-10402 - add docker.skip, based on a PR by Eric Norman, thanks!

This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-starter.git


The following commit(s) were added to refs/heads/master by this push:
     new bd042fb  SLING-10402 - add docker.skip, based on a PR by Eric Norman, thanks!
bd042fb is described below

commit bd042fb0e178457a9b071fcf6dbbf05a9cbf8601
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri May 28 12:27:32 2021 +0200

    SLING-10402 - add docker.skip, based on a PR by Eric Norman, thanks!
---
 pom.xml                                            | 24 +++++++++++++++++++---
 .../java/org/apache/sling/launchpad/SmokeIT.java   | 22 +++++++++++++-------
 2 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8f67664..a691629 100644
--- a/pom.xml
+++ b/pom.xml
@@ -50,12 +50,28 @@
         <groovy.version>3.0.7</groovy.version>
         <!-- skip index generation for all builds except for CI and release -->
         <bnd.index.generation.skip>true</bnd.index.generation.skip>
-
+        <docker.skip>true</docker.skip>
     </properties>
 
     <build>
         <plugins>
             <plugin>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <configuration>
+                            <target if="${docker.skip}">
+                                <echo>WARNING: docker.skip is ${docker.skip}, Docker-based tests will not be executed.</echo>
+                            </target>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>ianal-maven-plugin</artifactId>
                 <executions>
@@ -215,6 +231,7 @@
                 <artifactId>docker-maven-plugin</artifactId>
                 <version>0.19.1</version>
                 <configuration>
+                    <skip>${docker.skip}</skip>
                     <images>
                         <image>
                             <alias>mongo</alias>
@@ -273,6 +290,7 @@
                         </launch>
                         <launch>
                             <id>sling-12-oak-mongo</id>
+                            <skip>${docker.skip}</skip>
                             <feature>
                                 <groupId>${project.groupId}</groupId>
                                 <artifactId>${project.artifactId}</artifactId>
@@ -313,8 +331,7 @@
                </executions>
                <configuration>
                    <systemPropertyVariables>
-                       <starter.http.port>${http.port}</starter.http.port>
-                       <starter.http.port.mongo>${http.port.mongo}</starter.http.port.mongo>
+                       <starter.http.test.ports>false:${http.port},${docker.skip}:${http.port.mongo}</starter.http.test.ports>
                        <starter.min.bundles.count>${starter.min.bundles.count}</starter.min.bundles.count>
                    </systemPropertyVariables>
                </configuration>
@@ -372,6 +389,7 @@
             <id>ci</id>
             <properties>
                <bnd.index.generation.skip>false</bnd.index.generation.skip>
+               <docker.skip>false</docker.skip>
             </properties>
         </profile>
     </profiles>
diff --git a/src/test/java/org/apache/sling/launchpad/SmokeIT.java b/src/test/java/org/apache/sling/launchpad/SmokeIT.java
index c3e5d0e..ec672d1 100644
--- a/src/test/java/org/apache/sling/launchpad/SmokeIT.java
+++ b/src/test/java/org/apache/sling/launchpad/SmokeIT.java
@@ -21,10 +21,11 @@ import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 
-import java.util.Arrays;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Stream;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -45,7 +46,6 @@ import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.hamcrest.CoreMatchers;
 import org.junit.Before;
-import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -67,14 +67,22 @@ public class SmokeIT {
 
     @Parameterized.Parameters(name = "{0}")
     public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][] {
-            {"starter.http.port", 8080},
-            {"starter.http.port.mongo", 8081}
+        // This is a string of Sling instance port numbers to test, like
+        //     false:80,true:1234
+        // meaning: do not skip testing on port 80 but skip testing port 1234
+        final Stream<String> portDefs = Stream.of(System.getProperty("starter.http.test.ports").split(","));
+        final List<Object[]> result = new ArrayList<>();
+        portDefs.forEach(def -> {
+            final String [] parts = def.split(":");
+            if("false".equals(parts[0])) {
+                result.add(new Object[]{Integer.valueOf(parts[1].trim())});
+            }
         });
+        return result;
     }
 
-    public SmokeIT(String propName, int defaultPort) {
-        slingHttpPort = Integer.getInteger(propName, defaultPort);
+    public SmokeIT(int slingHttpPort) {
+        this.slingHttpPort = slingHttpPort;
         launchpadRule = new StarterReadyRule(slingHttpPort);
     }