Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Apache Camel tests into external group #1615

Merged
merged 1 commit into from
Feb 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions external/camel/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0"?>
<project name="Camel-Test" default="build" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<description>
Build camel-test Docker image
</description>
<import file="${TEST_ROOT}/external/build.xml"/>

<!-- set properties for this build -->
<property name="DEST" value="${BUILD_ROOT}/external/camel-test" />
<property name="src" location="." />

<target name="init">
<mkdir dir="${DEST}"/>
</target>

<target name="clean_image" depends="init" description="clean camel test docker image if there is one">
<exec executable="docker">
<arg line="rmi -f adoptopenjdk-camel-test" />
</exec>
</target>

<target name="build_image" depends="clean_image" description="build camel test docker image">
<exec executable="docker" failonerror="true">
<arg line="build -t adoptopenjdk-camel-test -f dockerfile/Dockerfile --pull . --build-arg SDK=${JVM_VERSION} --build-arg IMAGE_VERSION=${dockerImageTag}"/>
</exec>
</target>

<target name="dist" depends="build_image" description="generate the distribution">
<copy todir="${DEST}">
<fileset dir="${src}" includes="*.xml, *.mk"/>
</copy>
</target>

<target name="build">
<antcall target="dist" inheritall="true" />
</target>
</project>
49 changes: 49 additions & 0 deletions external/camel/dockerfile/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This Dockerfile in external/camel/dockerfile dir is used to create an image with
# AdoptOpenJDK jdk binary installed. Basic test dependent executions
# are installed during the building process.
#
# Build example: `docker build -t adoptopenjdk-camel-test -f Dockerfile ../.`
#
# This Dockerfile builds image based on adoptopenjdk/openjdk8:latest.
# If you want to build image based on other images, please use
# `--build-arg list` to specify your base image
#
# Build example: `docker build --build-arg IMAGE_NAME=<image_name> --build-arg IMAGE_VERSION=<image_version >-t adoptopenjdk-camel-test .`


ARG SDK=openjdk8
ARG IMAGE_NAME=adoptopenjdk/$SDK
ARG IMAGE_VERSION=nightly

FROM $IMAGE_NAME:$IMAGE_VERSION

# Install test dependent executable files
RUN apt-get update \
&& apt-get -y install \
maven \
git \
wget

ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
ENV MODE="java"

COPY ./dockerfile/camel-test.sh /camel-test.sh
RUN mkdir testResults
WORKDIR /
RUN pwd
RUN git clone https://github.com/apache/camel-quarkus.git

ENTRYPOINT ["/bin/bash", "/camel-test.sh"]
CMD ["$MODE"]
53 changes: 53 additions & 0 deletions external/camel/dockerfile/camel-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#/bin/bash

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Set up Java to be used by the the camel-test

if [ -d /java/jre/bin ];then
echo "Using mounted Java8"
export JAVA_BIN=/java/jre/bin
export JAVA_HOME=/java
export PATH=$JAVA_BIN:$PATH
elif [ -d /java/bin ]; then
echo "Using mounted Java"
export JAVA_BIN=/java/bin
export JAVA_HOME=/java
export PATH=$JAVA_BIN:$PATH
else
echo "Using docker image default Java"
java_path=$(type -p java)
suffix="/java"
java_root=${java_path%$suffix}
export JAVA_BIN="$java_root"
echo "JAVA_BIN is: $JAVA_BIN"
export JAVA_HOME="${java_root%/bin}"
fi

java -version

# See https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
# for advise to set MAVEN_OPTS to avoid https://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError
export MAVEN_OPTS="-Xmx1g"

cd /camel-quarkus
pwd
echo "Compile and run camel tests"
mvn clean install
test_exit_code=$?
echo "Build camel completed"

find ./ -type d -name 'surefire-reports' -exec cp -r "{}" /testResults \;
echo "Test results copied"

exit $test_exit_code
31 changes: 31 additions & 0 deletions external/camel/playlist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-->
<playlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../TestConfig/playlist.xsd">
<test>
<testCaseName>camel_test</testCaseName>
<command>docker run --name camel-test $(EXTRA_DOCKER_ARGS) --env OPENJ9_JAVA_OPTIONS=-Xmx1g adoptopenjdk-camel-test:latest; \
$(TEST_STATUS); \
docker cp camel-test:/testResults/surefire-reports $(REPORTDIR)/external_test_reports; \
docker rm -f camel-test; \
docker rmi -f adoptopenjdk-camel-test
</command>
<levels>
<level>extended</level>
</levels>
<groups>
<group>external</group>
</groups>
</test>
</playlist>
18 changes: 17 additions & 1 deletion external/common_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ supported_builds="slim full"

# Supported tests
# Test Not Included: elasticsearch
supported_tests="derby jenkins functional-test kafka lucene-solr openliberty-mp-tck payara-mp-tck quarkus scala system-test thorntail-mp-tck tomcat tomee wildfly wycheproof"
supported_tests="camel derby jenkins functional-test kafka lucene-solr openliberty-mp-tck payara-mp-tck quarkus scala system-test thorntail-mp-tck tomcat tomee wildfly wycheproof"

function check_version() {
version=$1
Expand Down Expand Up @@ -176,6 +176,22 @@ function set_build() {
function set_test_info() {
test=$1
case ${test} in
camel)
github_url="https://github.com/apache/camel-quarkus.git"
script="camel-test.sh"
test_results="testResults"
tag_version="master"
cmd="\$MODE"
environment_variable="MODE=\"java\""
debian_packages="git maven"
debian_slim_packages="${debian_packages}"
ubuntu_packages="${debian_packages}"
alpine_packages="git maven"
centos_packages="git maven"
clefos_packages="${centos_packages}"
ubi_packages="git maven"
ubi_minimal_packages="${ubi_packages}"
;;
derby)
github_url="https://github.com/apache/derby.git"
script="derby-test.sh"
Expand Down