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

jungm pushed a commit to branch ee11
in repository https://gitbox.apache.org/repos/asf/tomee-tck.git

commit c62154d86c7050affbbd9818754cd1cec498e764
Author: Markus Jung <[email protected]>
AuthorDate: Sun Jul 19 16:29:34 2026 +0200

    Run the smoke suite through a free-port-selecting wrapper script
    
    run-smoke-suite.sh selects free http/shutdown ports and passes them as
    -Dtomee.http.port/-Dtomee.shutdown.port; the smoke pom defines those
    properties, filters them into arquillian.xml and the failsafe
    webServerPort, and asserts the effective ports free at validate so the
    guard covers caller overrides and runs right before TomEE binds. The
    Jenkinsfile Smoke step uses the wrapper and lints the two new scripts.
---
 Jenkinsfile                                    | 10 ++++---
 runner-smoke/pom.xml                           | 36 +++++++++++++++++++++++++-
 runner-smoke/run-smoke-suite.sh                | 27 +++++++++++++++++++
 runner-smoke/src/test/resources/arquillian.xml |  4 +--
 4 files changed, 71 insertions(+), 6 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 3d6bc47..7d0b1c3 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -39,10 +39,12 @@ pipeline {
           sh -n environment/database/require-derby-port-free.sh
           sh -n environment/database/wait-for-derby.sh
           sh -n environment/tomee/require-tomee-ports-free.sh
+          sh -n environment/ports/select-free-port.sh
           sh -n environment/certificates/generate-test-certificates.sh
           sh -n runner-webprofile/run-platform-suite.sh
           sh -n runner-standalone/run-standalone-suite.sh
           sh -n runner-standalone/verify-invoker-result.sh
+          sh -n runner-smoke/run-smoke-suite.sh
         '''
         sh '''python3 -c '
 from pathlib import Path
@@ -64,8 +66,10 @@ from xml.etree import ElementTree
       }
     }
 
-    // Each branch requests a single-executor ephemeral agent. TomEE and Derby
-    // use fixed localhost ports, so two partitions must never share a host.
+    // Each branch requests a single-executor ephemeral agent. The runner
+    // scripts select free localhost ports at branch start and the
+    // require-*-free guards assert the chosen ports right before the servers
+    // bind them.
     stage('Smoke') {
       matrix {
         axes {
@@ -82,7 +86,7 @@ from xml.etree import ElementTree
             steps {
               deleteDir()
               unstash 'source'
-              sh './mvnw -B -ntp -pl runner-smoke -am verify'
+              sh 'runner-smoke/run-smoke-suite.sh'
             }
             post {
               always {
diff --git a/runner-smoke/pom.xml b/runner-smoke/pom.xml
index 296db26..45bca4c 100644
--- a/runner-smoke/pom.xml
+++ b/runner-smoke/pom.xml
@@ -18,6 +18,10 @@
     <properties>
         <!-- A small Web Profile test which creates and deploys one JAX-RS 
WAR. -->
         
<smoke.test>com.sun.ts.tests.jaxrs.platform.servletconfig.JAXRSClientIT</smoke.test>
+        <!-- Container bind ports; run-smoke-suite.sh overrides these with
+             free ports selected at branch start. -->
+        <tomee.http.port>8080</tomee.http.port>
+        <tomee.shutdown.port>8005</tomee.shutdown.port>
     </properties>
 
     <dependencies>
@@ -65,6 +69,36 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <!-- Assert the effective container ports are free
+                             inside the build, immediately before the remote
+                             adapter starts TomEE. This asserts ${tomee.*.port}
+                             as Maven resolves them, so a caller -D override
+                             (last-wins on the mvnw command line) is guarded on
+                             its actual value, and the check runs after the
+                             reactor build rather than in the wrapper script, 
so
+                             a daemon binding the port during the build cannot
+                             slip past. Without it the adapter would silently
+                             attach to a foreign server already on the port. 
-->
+                        <id>require-free-tomee-ports</id>
+                        <phase>validate</phase>
+                        <goals><goal>exec</goal></goals>
+                        <configuration>
+                            <executable>sh</executable>
+                            <arguments>
+                                
<argument>${maven.multiModuleProjectDirectory}/environment/tomee/require-tomee-ports-free.sh</argument>
+                                <argument>${tomee.http.port}</argument>
+                                <argument></argument>
+                                <argument>${tomee.shutdown.port}</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-dependency-plugin</artifactId>
@@ -92,7 +126,7 @@
                     </includes>
                     <systemPropertyVariables>
                         <webServerHost>localhost</webServerHost>
-                        <webServerPort>8080</webServerPort>
+                        <webServerPort>${tomee.http.port}</webServerPort>
                         <junit.log.traceflag>true</junit.log.traceflag>
                     </systemPropertyVariables>
                 </configuration>
diff --git a/runner-smoke/run-smoke-suite.sh b/runner-smoke/run-smoke-suite.sh
new file mode 100755
index 0000000..1187be4
--- /dev/null
+++ b/runner-smoke/run-smoke-suite.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0.
+
+# Selects free HTTP and shutdown ports and runs the smoke suite on them. The
+# stock plume distribution ships the TLS and AJP connectors commented out, so
+# the smoke run binds only these two host ports.
+
+set -eu
+
+SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+ROOT_DIR=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)
+SELECT_PORT="$ROOT_DIR/environment/ports/select-free-port.sh"
+TOMEE_HTTP_PORT=$(sh "$SELECT_PORT" 8080)
+TOMEE_SHUTDOWN_PORT=$(sh "$SELECT_PORT" 8005 "$TOMEE_HTTP_PORT")
+echo "Using ports: http=$TOMEE_HTTP_PORT shutdown=$TOMEE_SHUTDOWN_PORT"
+
+# Final assertion on the chosen ports: the Arquillian adapter otherwise
+# attaches to whatever already answers on the HTTP port. The empty second arg
+# skips the HTTPS check via the guard's [ -n "$port" ] handling.
+sh "$ROOT_DIR/environment/tomee/require-tomee-ports-free.sh" 
"$TOMEE_HTTP_PORT" "" "$TOMEE_SHUTDOWN_PORT"
+
+exec "$ROOT_DIR/mvnw" -B -ntp -pl runner-smoke -am verify \
+  "-Dtomee.http.port=$TOMEE_HTTP_PORT" 
"-Dtomee.shutdown.port=$TOMEE_SHUTDOWN_PORT" "$@"
diff --git a/runner-smoke/src/test/resources/arquillian.xml 
b/runner-smoke/src/test/resources/arquillian.xml
index e719f1b..e72fdcd 100644
--- a/runner-smoke/src/test/resources/arquillian.xml
+++ b/runner-smoke/src/test/resources/arquillian.xml
@@ -14,8 +14,8 @@
             <property name="classifier">${tomee.classifier}</property>
             <property name="type">zip</property>
             <property name="host">localhost</property>
-            <property name="httpPort">8080</property>
-            <property name="stopPort">8005</property>
+            <property name="httpPort">${tomee.http.port}</property>
+            <property name="stopPort">${tomee.shutdown.port}</property>
             <property name="ajpPort">8009</property>
             <property name="cleanOnStartUp">true</property>
             <property name="removeUnusedWebapps">true</property>

Reply via email to