Skip to content

Commit

Permalink
Merge pull request #6673 from simonladen/FISH-8630-integrate-test-pmi…
Browse files Browse the repository at this point in the history
…cro-jenkins

FISH-8630 - run functional test with payara micro and embedded in Jenkins pipeline
  • Loading branch information
simonladen authored May 24, 2024
2 parents fa80e1c + e55e80b commit aaa24bd
Show file tree
Hide file tree
Showing 7 changed files with 333 additions and 67 deletions.
55 changes: 54 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pipeline {
stage('Build') {
steps {
echo '*#*#*#*#*#*#*#*#*#*#*#*# Building SRC *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
sh """mvn -B -V -ff -e clean install --strict-checksums -PQuickBuild \
sh """mvn -B -V -ff -e clean install --strict-checksums -PQuickBuild,BuildEmbedded \
-Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \
-Djavax.xml.accessExternalSchema=all -Dbuild.number=${payaraBuildNumber} \
-Djavadoc.skip -Dsource.skip"""
Expand All @@ -42,6 +42,9 @@ pipeline {
archiveArtifacts artifacts: 'appserver/distributions/payara/target/payara.zip', fingerprint: true
archiveArtifacts artifacts: 'appserver/extras/payara-micro/payara-micro-distribution/target/payara-micro.jar', fingerprint: true
stash name: 'payara-target', includes: 'appserver/distributions/payara/target/**', allowEmpty: true
stash name: 'payara-micro', includes: 'appserver/extras/payara-micro/payara-micro-distribution/target/**', allowEmpty: true
stash name: 'payara-embedded-all', includes: 'appserver/extras/embedded/all/target/**', allowEmpty: true
stash name: 'payara-embedded-web', includes: 'appserver/extras/embedded/web/target/**', allowEmpty: true
dir('/home/ubuntu/.m2/repository/'){
stash name: 'payara-m2-repository', includes: '**', allowEmpty: true
}
Expand Down Expand Up @@ -224,6 +227,45 @@ pipeline {
}
}
}

stage('Payara Functional Tests') {
agent {
label 'general-purpose'
}
steps {
setupM2RepositoryOnly()
echo '*#*#*#*#*#*#*#*#*#*#*#*# Unstash Micro and Embedded *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
unstash name: 'payara-micro'
unstash name: 'payara-embedded-all'
unstash name: 'payara-embedded-web'

echo '*#*#*#*#*#*#*#*#*#*#*#*# Building dependencies *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
sh """mvn -V -B -ff clean install --strict-checksums \
-Dpayara.version=${pom.version} \
-Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \
-Djavax.xml.accessExternalSchema=all \
-DskipTests \
-f appserver/tests/payara-samples """

echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test with Payara Micro *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
sh """mvn -V -B -ff clean install --strict-checksums -Ppayara-micro-managed,install-deps \
-Dpayara.version=${pom.version} \
-f appserver/tests/functional/payara-micro """

echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test with Payara Embedded *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
sh """mvn -V -B -ff clean verify --strict-checksums -PFullProfile \
-Dversion=${pom.version} -f appserver/tests/functional/embeddedtest """

sh """mvn -V -B -ff clean verify --strict-checksums -PWebProfile \
-Dversion=${pom.version} -f appserver/tests/functional/embeddedtest """
echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
post {
cleanup {
processReport()
}
}
}
}
}
}
Expand All @@ -250,12 +292,23 @@ void setupDomain() {
sh "${ASADMIN} start-database || true"
}

void setupM2RepositoryOnly() {
echo '*#*#*#*#*#*#*#*#*#*#*#*# Unstash maven repository *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
dir('/home/ubuntu/.m2/repository/'){
unstash name: 'payara-m2-repository'
}
}

void processReportAndStopDomain() {
junit '**/target/*-reports/*.xml'
sh "${ASADMIN} stop-domain ${DOMAIN_NAME}"
sh "${ASADMIN} stop-database || true"
}

void processReport() {
junit '**/target/*-reports/*.xml'
}

void stopDomain() {
sh "${ASADMIN} stop-domain ${DOMAIN_NAME}"
sh "${ASADMIN} stop-database || true"
Expand Down
23 changes: 20 additions & 3 deletions appserver/tests/functional/embeddedtest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ It compiles the test with the required jar, starts payara embedded, deploy clust

## Usage

### To run the current version of Payara Embedded:

From the location ${PAYARA_HOME}/appserver/tests/functional/embeddedtest, run the command:

> mvn clean test -P{FullProfile/WebProfile}
the test is designed to adapt to jdk 8, 11 and higher.

### To run a specific version of Payara Embedded:

have the desired payara-embedded jar placed in ${PAYARA_HOME}/appserver/tests/functional/embeddedtest/lib

The jar should have a name following this format: payara-embedded-{web/all}-{payara-version}.jar
Expand All @@ -14,8 +24,15 @@ example: payara-embedded-all-6.2023.8.RC1.jar

From the location ${PAYARA_HOME}/appserver/tests/functional/embeddedtest, run the command:

> mvn clean -P {FullProfile/WebProfile} -Dpayara.version="6.2023.8.RC1" compile test
> mvn validate -P{FullProfile/WebProfile},specificJar -Dpayara.version="6.2023.8.RC1"
This first command installs the local jar before the compilation

> mvn clean verify -P{FullProfile/WebProfile},specificJar -Dpayara.version="6.2023.8.RC1"
It is also possible to specify a different location for the embedded jar:

> mvn validate -P{FullProfile/WebProfile},specificJar -Dpayara.version="6.2023.8.RC1" -Djarlocation="/tmp/payara-embedded-all-6.2023.8.RC1.jar"
the test is designed to adapt to jdk 8, 11, or 17.
> mvn clean verify -P{FullProfile/WebProfile},specificJar -Dpayara.version="6.2023.8.RC1" -Djarlocation="/tmp/payara-embedded-all-6.2023.8.RC1.jar"
If needed, the version of jdk used to compile and run can be modified with the properties maven.compiler.source, maven.compiler.target
159 changes: 100 additions & 59 deletions appserver/tests/functional/embeddedtest/pom.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2023-2024 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://github.com/payara/Payara/blob/master/LICENSE.txt
* See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* The Payara Foundation designates this particular file as subject to the "Classpath"
* exception as provided by the Payara Foundation in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">

<groupId>fish.payara.extras</groupId>
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-unit-test</artifactId>
<artifactId>payara-embedded-test</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<version>6.2024.6-SNAPSHOT</version>

<properties>
<!-- https://maven.apache.org/general.html#encoding-warning -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<payara.version>6.5.0.RC1</payara.version>
<payara.profile>all</payara.profile>
<payara.version>${project.version}</payara.version>
<jarlocation>${project.basedir}/lib/payara-embedded-${payara.profile}-${payara.version}.jar</jarlocation>
</properties>


Expand All @@ -26,7 +66,6 @@
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>

<dependency>
Expand All @@ -37,37 +76,25 @@
</dependency>

</dependencies>

<build>
<finalName>maven-embedded-deployment-test</finalName>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>install-external-non-maven-jar-Embedded-${payara.profile}-into-local-maven-repo</id>
<phase>clean</phase>
<configuration>
<repositoryLayout>default</repositoryLayout>
<groupId>fish.payara.extras</groupId>
<artifactId>payara-embedded-${payara.profile}</artifactId>
<version>${payara.version}</version>
<file>${project.basedir}/lib/payara-embedded-${payara.profile}-${payara.version}.jar</file>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.2.5</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

</build>

<profiles>
<profile>
<id>Jdk8</id>
Expand All @@ -82,16 +109,16 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.2.5</version>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>Jdk11</id>
<id>Jdk11+</id>
<activation>
<jdk>11</jdk>
<jdk>[11,)</jdk>
</activation>
<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand All @@ -101,30 +128,8 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine>--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.jrt=ALL-UNNAMED --add-exports=java.base/sun.net.www=ALL-UNNAMED --add-exports=java.base/sun.security.util=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.desktop/java.beans=ALL-UNNAMED --add-exports=jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>Jdk17</id>
<activation>
<jdk>17</jdk>
</activation>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<argLine>--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.jrt=ALL-UNNAMED --add-exports=java.base/sun.net.www=ALL-UNNAMED --add-exports=java.base/sun.security.util=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.desktop/java.beans=ALL-UNNAMED --add-exports=jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED</argLine>
</configuration>
Expand All @@ -144,6 +149,42 @@
<payara.profile>web</payara.profile>
</properties>
</profile>
<profile>
<id>specificJar</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>install-jar-Embedded-${payara.profile}-into-local-maven-repo</id>
<phase>validate</phase>
<configuration>
<repositoryLayout>default</repositoryLayout>
<groupId>fish.payara.extras</groupId>
<artifactId>payara-embedded-${payara.profile}</artifactId>
<version>${payara.version}</version>
<file>${jarlocation}</file>
<generatePom>true</generatePom>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
<execution>
<id>default-install</id>
<phase>none</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

</profiles>

Expand Down
Loading

0 comments on commit aaa24bd

Please sign in to comment.