You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by ji...@apache.org on 2023/05/24 09:47:03 UTC
[rocketmq-test-tool] branch main updated: support multiple language test
This is an automated email from the ASF dual-hosted git repository.
jinrongtong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/rocketmq-test-tool.git
The following commit(s) were added to refs/heads/main by this push:
new 7d84d27 support multiple language test
7d84d27 is described below
commit 7d84d276ad7755b1dc5cf9657a7a9bff6ae6d288
Author: wangtong.wt <wa...@alibaba-inc.com>
AuthorDate: Wed May 24 16:48:26 2023 +0800
support multiple language test
---
entry.sh | 18 ++++-----
test-runner/Dockerfile-test-runner | 78 ++++++++++++++++++++++++++++++++++++--
test-runner/code_run.sh | 10 +++--
3 files changed, 88 insertions(+), 18 deletions(-)
diff --git a/entry.sh b/entry.sh
index d57ef6c..b3d064d 100755
--- a/entry.sh
+++ b/entry.sh
@@ -131,7 +131,7 @@ spec:
restartPolicy: Never
containers:
- name: ${test_pod_name}
- image: cloudnativeofalibabacloud/test-runner:v0.0.1
+ image: cloudnativeofalibabacloud/test-runner:v0.0.3
resources:
limits:
cpu: "8"
@@ -146,10 +146,11 @@ spec:
value: ${TEST_CODE_BRANCH}
- name: CODE_PATH
value: ${TEST_CODE_PATH}
- - name: CMD
- value: ${TEST_CMD}
- name: ALL_IP
value: ${ALL_IP}
+ - name: CMD
+ value: |
+${TEST_CMD}
'
echo -e "${TEST_POD_TEMPLATE}" > ./testpod.yaml
@@ -182,12 +183,9 @@ if [ ${ACTION} == "test" ]; then
export ALL_IP
export ns
- is_mvn_cmd=`echo $TEST_CMD_BASE | grep "mvn"`
- if [ ! -z "$is_mvn_cmd" ]; then
- TEST_CMD="$TEST_CMD_BASE -DALL_IP=${ALL_IP}"
- else
- TEST_CMD=$TEST_CMD_BASE
- fi
+
+ TEST_CMD=`echo "${TEST_CMD_BASE}" | sed -s 's/^/ /g'`
+
echo $TEST_CMD
export TEST_CMD
@@ -214,7 +212,6 @@ if [ ${ACTION} == "test" ]; then
test_done=`kubectl exec -i ${test_pod_name} -n ${ns} -- ls /root | grep testdone`
if [ ! -z "$test_done" ]; then
echo "Test status: test done"
- if [ ! -z "$is_mvn_cmd" ]; then
if [ ! -d "./test_report" ]; then
echo "Copy test reports"
kubectl cp --retries=10 ${test_pod_name}:/root/testlog.txt testlog.txt -n ${ns}
@@ -225,7 +222,6 @@ if [ ${ACTION} == "test" ]; then
ls
cd -
fi
- fi
fi
done
diff --git a/test-runner/Dockerfile-test-runner b/test-runner/Dockerfile-test-runner
index 81b3cc5..c7eed78 100644
--- a/test-runner/Dockerfile-test-runner
+++ b/test-runner/Dockerfile-test-runner
@@ -20,15 +20,87 @@ ENV LANG C.UTF-8
WORKDIR /root
COPY code_run.sh /root/code_run.sh
-RUN wget https://dlcdn.apache.org/maven/maven-3/3.8.7/binaries/apache-maven-3.8.7-bin.tar.gz
+RUN wget https://dlcdn.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz
RUN chmod 755 /root/code_run.sh
-RUN tar -xvf /root/apache-maven-3.8.7-bin.tar.gz -C /opt/
-COPY settings.xml /opt/apache-maven-3.8.7/conf
+RUN tar -xvf /root/apache-maven-3.8.8-bin.tar.gz -C /opt/
RUN yum install unzip curl git epel-release gettext jq wget psmisc -y
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
RUN install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
RUN curl -fsSl https://kubevela.net/script/install.sh | bash
+RUN wget -O go1.19.linux-amd64.tar.gz -q https://go.dev/dl/go1.19.linux-amd64.tar.gz && \
+ tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz && \
+ rm go1.19.linux-amd64.tar.gz
+
+RUN echo "export GOROOT=/usr/local/go" >> /root/.bashrc && \
+ echo "export PATH=\$GOROOT/bin:\$PATH" >> /root/.bashrc && \
+ echo "export GOPATH=/home/admin/code" >> /root/.bashrc && \
+ echo "export GOPROXY=https://proxy.golang.com.cn,direct" >> /root/.bashrc && \
+ echo "export GO111MODULE=on" >> /root/.bashrc && \
+ echo "export GOSUMDB=off" >> /root/.bashrc && \
+ echo "export GONOSUMDB=*.corp.example.com,rsc.io/private" >> /root/.bashrc && \
+ source /root/.bashrc
+
+RUN yum install -y centos-release-scl && \
+ yum install -y devtoolset-7-gcc devtoolset-7-gcc-c++
+
+RUN echo "source /opt/rh/devtoolset-7/enable" >> /root/.bashrc && \
+ source /root/.bashrc
+
+ENV PATH="${PATH}:/opt/rh/devtoolset-7/root/usr/bin:/usr/local/go/bin"
+
+RUN GO111MODULE="on" go install gotest.tools/gotestsum@latest && \
+ ln -s /root/go/bin/gotestsum /usr/bin/gotestsum
+
+RUN yum -y install make && \
+ yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel && \
+ wget http://pasmicrosservice.oss-cn-hangzhou.aliyuncs.com/tools/Python-3.9.0.tgz && \
+ mkdir /usr/local/python3 && \
+ tar -zxvf Python-3.9.0.tgz && \
+ cd Python-3.9.0 && \
+ ./configure --prefix=/usr/local/python3 && \
+ make && make install && \
+ ln -s /usr/local/python3/bin/python3 /usr/bin/python3 && \
+ ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3 && \
+ pip3 install pytest && \
+ ln -s /usr/local/python3/bin/pytest /usr/bin/pytest && \
+ cd - && \
+ rm -rf Python-3.9.0.tgz
+
+RUN pip3 install cmake && \
+ ln -s /usr/local/python3/bin/cmake /usr/bin/cmake
+
+RUN git clone https://github.com/google/googletest && \
+ cd googletest && \
+ cmake CMakeLists.txt && \
+ make && \
+ cp lib/libgtest*.a /usr/lib && \
+ cp -a googletest/include/gtest/ /usr/include/ && \
+ cd - && \
+ rm -rf googletest
+
+RUN cd /root && \
+ wget http://pasmicrosservice.oss-cn-hangzhou.aliyuncs.com/tools/node-v10.16.0-linux-x64.tar.xz && \
+ xz -d node-v10.16.0-linux-x64.tar.xz && \
+ tar -xf node-v10.16.0-linux-x64.tar && \
+ chown -R root:root /root/node-v10.16.0-linux-x64 && \
+ cd node-v10.16.0-linux-x64/bin && \
+ ln -s /root/node-v10.16.0-linux-x64/bin/node /usr/local/bin/node && \
+ ln -s /root/node-v10.16.0-linux-x64/bin/npm /usr/local/bin/npm && \
+ rm -rf node-v10.16.0-linux-x64.tar && \
+ cd -
+
+ENV PATH="${PATH}:/usr/local/bin"
+
+RUN npm install -g mocha-junit-reporter && \
+ npm install -g mocha@3.5.3 && \
+ ln -s /root/node-v10.16.0-linux-x64/bin/mocha /bin/mocha
+
+RUN rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm && \
+ yum install -y dotnet-sdk-3.1
+
+RUN echo "export PYTHONPATH=$PYTHONPATH:/root/code/" >> /root/.bashrc
+
WORKDIR /root
CMD ["/bin/bash", "-c", "./code_run.sh"]
diff --git a/test-runner/code_run.sh b/test-runner/code_run.sh
index 5f9fa9f..2141efc 100644
--- a/test-runner/code_run.sh
+++ b/test-runner/code_run.sh
@@ -16,15 +16,17 @@
# limitations under the License.
#
-export M2_HOME=/opt/apache-maven-3.8.7
-export MAVEN_HOME=/opt/apache-maven-3.8.7
+export M2_HOME=/opt/apache-maven-3.8.8
+export MAVEN_HOME=/opt/apache-maven-3.8.8
export PATH=${M2_HOME}/bin:${PATH}
-git clone $CODE -b $BRANCH code
+git clone $CODE -b $BRANCH code
cd code
cd $CODE_PATH
-$CMD > /root/testlog.txt
+script_name=$(uuidgen).sh
+echo -e "$CMD" > $script_name
+sh $script_name > /root/testlog.txt 2>&1
res=$?
# wait for result collect
touch /root/testdone