You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2022/08/18 07:41:16 UTC

[camel-quarkus] branch main updated: perf-regression: avoid using fixed port #4004

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

aldettinger pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new b73c280fb9 perf-regression: avoid using fixed port #4004
b73c280fb9 is described below

commit b73c280fb906890e805a5b3976eba257724347b8
Author: aldettinger <al...@gmail.com>
AuthorDate: Wed Aug 17 15:58:58 2022 +0200

    perf-regression: avoid using fixed port #4004
---
 .../cq-perf-regression-scenario.hf.yaml            |  3 +-
 .../cq-perf-regression-sample-base/pom.xml         | 64 +++++++++++++++++-----
 2 files changed, 53 insertions(+), 14 deletions(-)

diff --git a/tooling/perf-regression/cq-perf-regression-sample-base/cq-perf-regression-scenario.hf.yaml b/tooling/perf-regression/cq-perf-regression-sample-base/cq-perf-regression-scenario.hf.yaml
index 5c9f883c6f..2e8d06a3a0 100644
--- a/tooling/perf-regression/cq-perf-regression-sample-base/cq-perf-regression-scenario.hf.yaml
+++ b/tooling/perf-regression/cq-perf-regression-sample-base/cq-perf-regression-scenario.hf.yaml
@@ -18,7 +18,8 @@
 # A camel-quarkus performance scenario to detect possible regressions
 name: cq-perf-regression-scenario
 http:
-  host: http://localhost:8080
+  # A free port will be reserved and added to this configuration by maven later on
+  host: http://localhost:
 phases:
 - operator:
     # Running a fixed number of users during a fixed period of time
diff --git a/tooling/perf-regression/cq-perf-regression-sample-base/pom.xml b/tooling/perf-regression/cq-perf-regression-sample-base/pom.xml
index affc7ce5d0..2725a917f4 100644
--- a/tooling/perf-regression/cq-perf-regression-sample-base/pom.xml
+++ b/tooling/perf-regression/cq-perf-regression-sample-base/pom.xml
@@ -26,7 +26,7 @@
         <groupId>org.apache.camel.quarkus</groupId>
         <artifactId>camel-quarkus</artifactId>
         <!-- The parent version will be set programmatically -->
-        <version/>
+        <version />
     </parent>
     <artifactId>cq-perf-regression-sample</artifactId>
     <properties>
@@ -39,8 +39,8 @@
         <surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
     </properties>
     <!-- The repositories will be set programmatically, if needed -->
-    <pluginRepositories/>
-    <repositories/>
+    <pluginRepositories />
+    <repositories />
     <dependencyManagement>
         <dependencies>
             <dependency>
@@ -112,35 +112,53 @@
                 </executions>
             </plugin>
             <plugin>
-                <!-- Start the quarkus app under test async, will be killed when maven stops-->
                 <groupId>org.codehaus.mojo</groupId>
-                <artifactId>exec-maven-plugin</artifactId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>${build-helper-maven-plugin.version}</version>
                 <executions>
                     <execution>
-                        <phase>pre-integration-test</phase>
+                        <id>reserve-network-port</id>
                         <goals>
-                            <goal>exec</goal>
+                            <goal>reserve-network-port</goal>
                         </goals>
+                        <phase>pre-integration-test</phase>
+                        <configuration>
+                            <portNames>
+                                <portName>quarkus.http.port</portName>
+                            </portNames>
+                        </configuration>
                     </execution>
                 </executions>
-                <configuration>
-                    <async>true</async>
-                </configuration>
             </plugin>
             <plugin>
-                <!-- Wait the quarkus app under test to be listening on port 8080 -->
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-antrun-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>wait-for-quarkus-app-to-listen-on-port</id>
+                        <id>set-http-host-and-port-in-hyperfoil-benchmark</id>
+                        <phase>pre-integration-test</phase>
+                        <configuration>
+                            <target>
+                                <replaceregexp
+                                    file="cq-perf-regression-scenario.hf.yaml"
+                                    match="^([ ]*host: http://localhost:)[0-9]*$"
+                                    replace="\1${quarkus.http.port}"
+                                    flags="m" />
+                            </target>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>wait-for-quarkus-app-to-listen-on-reserved-port</id>
                         <phase>integration-test</phase>
                         <configuration>
                             <target>
                                 <waitfor maxwait="10"
                                     maxwaitunit="second">
                                     <socket server="localhost"
-                                        port="8080" />
+                                        port="${quarkus.http.port}" />
                                 </waitfor>
                             </target>
                         </configuration>
@@ -150,6 +168,22 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <!-- Start the quarkus app under test async, will be killed when maven stops-->
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <async>true</async>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>io.hyperfoil</groupId>
                 <artifactId>hyperfoil-maven-plugin</artifactId>
@@ -203,6 +237,9 @@
                         <artifactId>exec-maven-plugin</artifactId>
                         <configuration>
                             <executable>target/cq-perf-regression-sample-${project.version}-runner</executable>
+                            <arguments>
+                                <argument>-Dquarkus.http.port=${quarkus.http.port}</argument>
+                            </arguments>
                         </configuration>
                     </plugin>
                 </plugins>
@@ -226,6 +263,7 @@
                         <configuration>
                             <executable>java</executable>
                             <arguments>
+                                <argument>-Dquarkus.http.port=${quarkus.http.port}</argument>
                                 <argument>-jar</argument>
                                 <argument>target/quarkus-app/quarkus-run.jar</argument>
                             </arguments>