You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ju...@apache.org on 2024/09/18 18:06:30 UTC

(tomee) branch tomee-9.x updated: attempt to fix flaky openapi TCK by using random port

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

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


The following commit(s) were added to refs/heads/tomee-9.x by this push:
     new 717fb7a9f9 attempt to fix flaky openapi TCK by using random port
717fb7a9f9 is described below

commit 717fb7a9f964bc1f5e3ac0155502f45aaada2e4e
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
    
    (cherry picked from commit 615cc37e2f1eaf3b720a4aaff2c7994ddad8c004)
---
 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 fcbefacd7e..a5d5f47383 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 5fea36e73b..da8ceea88e 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>
@@ -39,7 +39,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>
@@ -55,7 +55,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>