You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2020/12/05 20:09:43 UTC
[incubator-hop] branch integration-tests updated: HOP-2212
This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch integration-tests
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git
The following commit(s) were added to refs/heads/integration-tests by this push:
new 0e90252 HOP-2212
0e90252 is described below
commit 0e9025258f512fd25f25e8e6f4a422192df1c34e
Author: Hans Van Akelyen <ha...@gmail.com>
AuthorDate: Sat Dec 5 21:09:09 2020 +0100
HOP-2212
---
Dockerfile.unit-tests | 42 +++++++++++++++++++++++++++++++++
Jenkinsfile.daily | 43 +++++++++++++++++++++++-----------
integration-tests/scripts/run-tests.sh | 10 +++++---
3 files changed, 78 insertions(+), 17 deletions(-)
diff --git a/Dockerfile.unit-tests b/Dockerfile.unit-tests
index e69de29..1704359 100644
--- a/Dockerfile.unit-tests
+++ b/Dockerfile.unit-tests
@@ -0,0 +1,42 @@
+FROM openjdk:8-alpine
+MAINTAINER Apache Hop
+
+# Argument Branch name, used to download correct version
+ARG BRANCH_NAME
+ENV BRANCH_NAME=$BRANCH_NAME
+# path to where the artefacts should be deployed to
+ENV DEPLOYMENT_PATH=/opt
+# volume mount point
+ENV VOLUME_MOUNT_POINT=/files
+
+# any JRE settings you want to pass on
+# The “-XX:+AggressiveHeap” tells the container to use all memory assigned to the container.
+# this removed the need to calculate the necessary heap Xmx
+ENV HOP_OPTIONS=-XX:+AggressiveHeap
+
+# INSTALL REQUIRED PACKAGES AND ADJUST LOCALE
+# procps: The package includes the programs ps, top, vmstat, w, kill, free, slabtop, and skill
+
+RUN apk update \
+ && apk add --no-cache bash curl procps \
+ && rm -rf /var/cache/apk/* \
+ && mkdir ${VOLUME_MOUNT_POINT} \
+ && adduser -D -s /bin/bash -h /home/hop hop \
+ && chown hop:hop ${DEPLOYMENT_PATH} \
+ && chown hop:hop ${VOLUME_MOUNT_POINT}
+
+# copy the hop package from the local resources folder to the container image directory
+COPY --chown=hop:hop ./assemblies/client/target/hop-* ${DEPLOYMENT_PATH}/hop.zip
+
+RUN unzip ${DEPLOYMENT_PATH}/hop.zip -d ${DEPLOYMENT_PATH} \
+ && rm ${DEPLOYMENT_PATH}/hop.zip \
+ && chown -R hop:hop ${DEPLOYMENT_PATH}/hop \
+ && chmod 700 ${DEPLOYMENT_PATH}/hop/*.sh
+
+# make volume available so that hop pipeline and workflow files can be provided easily
+VOLUME ["/files"]
+USER hop
+ENV PATH=$PATH:${DEPLOYMENT_PATH}/hop
+WORKDIR /home/hop
+# CMD ["/bin/bash"]
+ENTRYPOINT ["/bin/bash", "/files/scripts/run-tests.sh"]
\ No newline at end of file
diff --git a/Jenkinsfile.daily b/Jenkinsfile.daily
index 6f47d31..cce1854 100644
--- a/Jenkinsfile.daily
+++ b/Jenkinsfile.daily
@@ -36,6 +36,8 @@ pipeline {
environment {
MAVEN_SKIP_RC = true
+ dockerImage = ''
+ imagename = 'hop'
}
options {
@@ -68,19 +70,36 @@ pipeline {
checkout scm
}
}
- stage('Build') {
+ stage('Build & Test') {
when {
branch 'integration-tests'
}
steps {
- echo 'Build'
-
- dir("local-snapshots-dir/") {
- deleteDir()
- }
-
+ echo 'Build & Test'
sh "mvn $MAVEN_PARAMS clean install"
}
+ }
+ // stage('Code Quality') {
+ // steps {
+ // echo 'Checking Code Quality on SonarCloud'
+ // withCredentials([string(credentialsId: 'sonarcloud-key-apache-hop', variable: 'SONAR_TOKEN')]) {
+ // sh 'mvn sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_incubator-hop -Dsonar.branch.name=${BRANCH_NAME} -Dsonar.login=${SONAR_TOKEN}'
+ // }
+ // }
+ // }
+ stage('Create Docker image'){
+ steps {
+ script {
+ dockerImage = docker.build -f 'Dockerfile.unit-tests' imagename
+ }
+ }
+ }
+ stage('Run Integration Tests'){
+ steps {
+ script {
+ echo 'Run tests'
+ }
+ }
post {
always {
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
@@ -88,13 +107,9 @@ pipeline {
}
}
}
- stage('Code Quality') {
- steps {
- echo 'Checking Code Quality on SonarCloud'
- withCredentials([string(credentialsId: 'sonarcloud-key-apache-hop', variable: 'SONAR_TOKEN')]) {
- sh 'mvn sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_incubator-hop -Dsonar.branch.name=${BRANCH_NAME} -Dsonar.login=${SONAR_TOKEN}'
- }
- }
+ stage('Remove docker image'){
+ sh "docker rmi $iamgename:$BUILD_NUMBER"
+ sh "docker rmi $iamgename:latest"
}
diff --git a/integration-tests/scripts/run-tests.sh b/integration-tests/scripts/run-tests.sh
index 28df867..c584214 100755
--- a/integration-tests/scripts/run-tests.sh
+++ b/integration-tests/scripts/run-tests.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+
if [ -z "${HOP_LOCATION}" ]; then
HOP_LOCATION=/opt/hop
fi
@@ -12,10 +14,8 @@ skipped_counter=0
failures_counter=0
spacer="==========================================="
-#cleanup surefire report
-/dev/null > /tmp/testcases
-for d in ../*/ ; do
+for d in $current_dir/../*/ ; do
if [[ "$d" != *"scripts/" ]]; then
test_name=$(basename $d)
@@ -98,3 +98,7 @@ echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" >> /tmp/surefire_report.xml
echo "<testsuite xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd\" version=\"3.0\" name=\"Hop Integration Tests\" time=\"$total_duration\" tests=\"$test_counter\" errors=\"$errors_counter\" skipped=\"$skipped_counter\" failures=\"$failures_counter\">" >> /tmp/surefire_report.xml
cat /tmp/testcases >> /tmp/surefire_report.xml
echo "</testsuite>" >> /tmp/surefire_report.xml
+
+#Copy final report back
+mkdir -p $current_dir/../surefire-reports/
+cp /tmp/surefire_report.xml $current_dir/../surefire-reports/report.xml