From 8dc8d70c9df6990b77629ef260a629e17fa8af78 Mon Sep 17 00:00:00 2001
From: Suman Mitra <32052862+suman-mitra@users.noreply.github.com>
Date: Tue, 17 Jul 2018 21:24:38 +0530
Subject: [PATCH] Adding Kafka under third party tests (#469)
* Adding kafka under thirdparty apps
* Made appropriate changes based on review comments
---
thirdparty_containers/kafka/build.xml | 38 ++++++++++
.../kafka/dockerfile/Dockerfile | 71 +++++++++++++++++++
.../kafka/dockerfile/kafka-test.sh | 61 ++++++++++++++++
thirdparty_containers/kafka/playlist.xml | 31 ++++++++
4 files changed, 201 insertions(+)
create mode 100644 thirdparty_containers/kafka/build.xml
create mode 100644 thirdparty_containers/kafka/dockerfile/Dockerfile
create mode 100644 thirdparty_containers/kafka/dockerfile/kafka-test.sh
create mode 100644 thirdparty_containers/kafka/playlist.xml
diff --git a/thirdparty_containers/kafka/build.xml b/thirdparty_containers/kafka/build.xml
new file mode 100644
index 0000000000..590b26031b
--- /dev/null
+++ b/thirdparty_containers/kafka/build.xml
@@ -0,0 +1,38 @@
+
+
+
+
+ Build kafka-test Docker image
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/thirdparty_containers/kafka/dockerfile/Dockerfile b/thirdparty_containers/kafka/dockerfile/Dockerfile
new file mode 100644
index 0000000000..b4f8fbf3da
--- /dev/null
+++ b/thirdparty_containers/kafka/dockerfile/Dockerfile
@@ -0,0 +1,71 @@
+# 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
+#
+# http://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 thirdparty_containers/kafka/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-kafka-test .`
+#
+# 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= --build-arg IMAGE_VERSION=-t adoptopenjdk-kafka-test .`
+
+ARG SDK=openjdk8
+ARG IMAGE_NAME=adoptopenjdk/$SDK
+ARG IMAGE_VERSION=latest
+
+FROM $IMAGE_NAME:$IMAGE_VERSION
+
+# Install test dependent executable files
+RUN apt-get update \
+ && apt-get -y install \
+ ant \
+ apt-transport-https \
+ ca-certificates \
+ dirmngr \
+ curl \
+ git \
+ make \
+ unzip \
+ vim \
+ wget
+
+#Install Gradle
+RUN mkdir -p /usr/share/gradle \
+ && cd /usr/share/gradle \
+ && wget -q https://services.gradle.org/distributions/gradle-4.5-bin.zip \
+ && unzip -qq gradle-4.5-bin.zip \
+ && rm -rf gradle-4.5-bin.zip \
+ && ln -s /usr/share/gradle/gradle-4.5/bin/gradle /usr/bin/gradle \
+ && cd /
+
+RUN cd .
+
+VOLUME ["/java"]
+ENV JAVA_HOME=/java \
+ PATH=/java/bin:$PATH \
+ JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
+
+# This is the main script to run kafka tests.
+COPY ./dockerfile/kafka-test.sh /kafka-test.sh
+
+# Clone the repo where kafka tests reside.
+WORKDIR /
+RUN pwd
+
+RUN git clone https://github.com/apache/kafka.git
+
+ENTRYPOINT ["/bin/bash", "/kafka-test.sh"]
+CMD ["--version"]
diff --git a/thirdparty_containers/kafka/dockerfile/kafka-test.sh b/thirdparty_containers/kafka/dockerfile/kafka-test.sh
new file mode 100644
index 0000000000..7c3b85bffd
--- /dev/null
+++ b/thirdparty_containers/kafka/dockerfile/kafka-test.sh
@@ -0,0 +1,61 @@
+#/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
+#
+# http://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 kafka-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
+ java -version
+elif [ -d /java/bin ]; then
+ echo "Using mounted Java9"
+ export JAVA_BIN=/java/bin
+ export JAVA_HOME=/java
+ export PATH=$JAVA_BIN:$PATH
+ java -version
+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"
+ $JAVA_BIN/java -version
+fi
+
+TEST_SUITE=$1
+
+echo "PATH is : $PATH"
+echo "JAVA_HOME is : $JAVA_HOME"
+echo "type -p java is :"
+type -p java
+echo "java -version is: \n"
+java -version
+
+# Initial command to trigger the execution of kafka test
+cd /kafka
+ls .
+pwd
+
+echo "Building kafka using gradle" && \
+gradle -q
+./gradlew jar
+
+echo "Kafka Build - Completed"
+
+echo "Running (ALL) Kafka tests :"
+
+./gradlew testAll
diff --git a/thirdparty_containers/kafka/playlist.xml b/thirdparty_containers/kafka/playlist.xml
new file mode 100644
index 0000000000..1d333cee17
--- /dev/null
+++ b/thirdparty_containers/kafka/playlist.xml
@@ -0,0 +1,31 @@
+
+
+
+
+ kafka_test
+ docker run --rm -v $(JDK_HOME):/java adoptopenjdk-kafka-test:latest ; \
+ $(TEST_STATUS)
+
+ SE80
+ SE90
+
+
+ extended
+
+
+ external
+
+
+