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

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


The following commit(s) were added to refs/heads/main by this push:
     new 615cc37e2f attempt to fix flaky openapi TCK by using random port
615cc37e2f is described below

commit 615cc37e2f1eaf3b720a4aaff2c7994ddad8c004
Author: Markus Jung <ju...@apache.org>
AuthorDate: Mon Sep 16 16:22:33 2024 +0200

    attempt to fix flaky openapi TCK by using random port
---
 tck/microprofile-tck/openapi/pom.xml               | 33 +++++++++++++++++++++-
 .../openapi/src/test/resources/arquillian.xml      |  6 ++--
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/tck/microprofile-tck/openapi/pom.xml 
b/tck/microprofile-tck/openapi/pom.xml
index 0dff612d33..191fc2ddb8 100644
--- a/tck/microprofile-tck/openapi/pom.xml
+++ b/tck/microprofile-tck/openapi/pom.xml
@@ -29,7 +29,38 @@
   <name>TomEE :: TCK :: MicroProfile Open API TCK</name>
 
   <build>
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>true</filtering>
+      </testResource>
+    </testResources>
+
     <plugins>
+      <!-- we can't just set httpPort=-1 in arquillian.xml because we need to 
know the URL below to set as a system property
+           so instead let's rely on build-helper plugin to reserve an actually 
free port for us -->
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+
+        <executions>
+          <execution>
+            <id>reserve-tomee-port</id>
+
+            <phase>generate-test-resources</phase>
+            <goals>
+              <goal>reserve-network-port</goal>
+            </goals>
+
+            <configuration>
+              <portNames>
+                <name>tomee.port</name>
+              </portNames>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
       <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
         <!-- Updated version to fix hanging text -->
@@ -39,7 +70,7 @@
             
<dependency>org.eclipse.microprofile.openapi:microprofile-openapi-tck</dependency>
           </dependenciesToScan>
           <systemPropertyVariables>
-            <test.url>http://localhost:50290</test.url>
+            <test.url>http://localhost:${tomee.port}</test.url>
           </systemPropertyVariables>
         </configuration>
       </plugin>
diff --git a/tck/microprofile-tck/openapi/src/test/resources/arquillian.xml 
b/tck/microprofile-tck/openapi/src/test/resources/arquillian.xml
index a5125a131d..9bb935ea54 100644
--- a/tck/microprofile-tck/openapi/src/test/resources/arquillian.xml
+++ b/tck/microprofile-tck/openapi/src/test/resources/arquillian.xml
@@ -23,7 +23,7 @@
               http://jboss.org/schema/arquillian/arquillian_1_0.xsd";>
   <container qualifier="tomee-microprofile" default="true">
     <configuration>
-      <property name="httpPort">50290</property>
+      <property name="httpPort">${tomee.port}</property>
       <property name="ajpPort">-1</property>
       <property name="stopPort">-1</property>
       <property name="classifier">microprofile</property>
@@ -38,7 +38,7 @@
   </container>
   <container qualifier="tomee-plus">
     <configuration>
-      <property name="httpPort">50290</property>
+      <property name="httpPort">${tomee.port}</property>
       <property name="ajpPort">-1</property>
       <property name="stopPort">-1</property>
       <property name="classifier">plus</property>
@@ -53,7 +53,7 @@
   </container>
   <container qualifier="tomee-plume">
     <configuration>
-      <property name="httpPort">50290</property>
+      <property name="httpPort">${tomee.port}</property>
       <property name="ajpPort">-1</property>
       <property name="stopPort">-1</property>
       <property name="classifier">plume</property>

Reply via email to