diff --git a/tests/perftest-scripts/perftest-taosdemo.sh b/tests/perftest-scripts/perftest-taosdemo.sh index ae9e8dd7371cca2f522810da6d7816adba86a862..dffa251ef76d866f33247bd0ce6fd5bb718449de 100755 --- a/tests/perftest-scripts/perftest-taosdemo.sh +++ b/tests/perftest-scripts/perftest-taosdemo.sh @@ -16,6 +16,9 @@ fi logDir=`grep "^logDir" /etc/taos/taos.cfg | awk '{print $2}'` dataDir=`grep "^dataDir" /etc/taos/taos.cfg | awk '{print $2}'` +[ -z "$logDir" ] && logDir="/var/log/taos" +[ -z "$dataDir" ] && dataDir="/var/lib/taos" + # Coloured Echoes function red_echo { echo -e "\033[31m$@\033[0m"; } function green_echo { echo -e "\033[32m$@\033[0m"; } diff --git a/tests/perftest-scripts/perftest-tsdb-compare-13d.sh b/tests/perftest-scripts/perftest-tsdb-compare-13d.sh index 110ab9e5fa6463db9f55c8320b1fd3e36380d7a1..3f56a048e9f78b9e6d02bf8f1d704d27d46e1149 100755 --- a/tests/perftest-scripts/perftest-tsdb-compare-13d.sh +++ b/tests/perftest-scripts/perftest-tsdb-compare-13d.sh @@ -16,6 +16,9 @@ fi logDir=`grep "^logDir" /etc/taos/taos.cfg | awk '{print $2}'` dataDir=`grep "^dataDir" /etc/taos/taos.cfg | awk '{print $2}'` +[ -z "$logDir" ] && logDir="/var/log/taos" +[ -z "$dataDir" ] && dataDir="/var/lib/taos" + # Coloured Echoes # function red_echo { echo -e "\033[31m$@\033[0m"; } # function green_echo { echo -e "\033[32m$@\033[0m"; } # diff --git a/tests/perftest-scripts/perftest-tsdb-compare-1d.sh b/tests/perftest-scripts/perftest-tsdb-compare-1d.sh index 9e8bc697bc18e0e5c3a6d5957fed948192c09241..29e72d7b3ff62aa30fdefd694e435335e752e630 100755 --- a/tests/perftest-scripts/perftest-tsdb-compare-1d.sh +++ b/tests/perftest-scripts/perftest-tsdb-compare-1d.sh @@ -16,6 +16,9 @@ fi logDir=`grep "^logDir" /etc/taos/taos.cfg | awk '{print $2}'` dataDir=`grep "^dataDir" /etc/taos/taos.cfg | awk '{print $2}'` +[ -z "$logDir" ] && logDir="/var/log/taos" +[ -z "$dataDir" ] && dataDir="/var/lib/taos" + # Coloured Echoes # function red_echo { echo -e "\033[31m$@\033[0m"; } # function green_echo { echo -e "\033[32m$@\033[0m"; } # diff --git a/tests/perftest-scripts/perftest-tsdb-compare-var10k-int100s.sh b/tests/perftest-scripts/perftest-tsdb-compare-var10k-int100s.sh index 5fc5b9d03a4339263eb07a9af9b76ee2fc324f1b..3bc63b831b901b9a8a4b9b96385574a345ab58c6 100755 --- a/tests/perftest-scripts/perftest-tsdb-compare-var10k-int100s.sh +++ b/tests/perftest-scripts/perftest-tsdb-compare-var10k-int100s.sh @@ -16,6 +16,9 @@ fi logDir=`grep "^logDir" /etc/taos/taos.cfg | awk '{print $2}'` dataDir=`grep "^dataDir" /etc/taos/taos.cfg | awk '{print $2}'` +[ -z "$logDir" ] && logDir="/var/log/taos" +[ -z "$dataDir" ] && dataDir="/var/lib/taos" + # Coloured Echoes # function red_echo { echo -e "\033[31m$@\033[0m"; } # function green_echo { echo -e "\033[32m$@\033[0m"; } # diff --git a/tests/perftest-scripts/perftest-tsdb-compare-var10k-int10s.sh b/tests/perftest-scripts/perftest-tsdb-compare-var10k-int10s.sh index bafa04f174955d9938810f9b5bc353a0b712c3c3..566479c967320e9bbb8a9e877d26e1bbeb750add 100755 --- a/tests/perftest-scripts/perftest-tsdb-compare-var10k-int10s.sh +++ b/tests/perftest-scripts/perftest-tsdb-compare-var10k-int10s.sh @@ -16,6 +16,9 @@ fi logDir=`grep "^logDir" /etc/taos/taos.cfg | awk '{print $2}'` dataDir=`grep "^dataDir" /etc/taos/taos.cfg | awk '{print $2}'` +[ -z "$logDir" ] && logDir="/var/log/taos" +[ -z "$dataDir" ] && dataDir="/var/lib/taos" + # Coloured Echoes # function red_echo { echo -e "\033[31m$@\033[0m"; } # function green_echo { echo -e "\033[32m$@\033[0m"; } # diff --git a/tests/pytest/cluster/clusterEnvSetup/Dockerfile b/tests/pytest/cluster/clusterEnvSetup/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b699e8a23ff0e1ff329ffaf4b97aa8f34350eaf7 --- /dev/null +++ b/tests/pytest/cluster/clusterEnvSetup/Dockerfile @@ -0,0 +1,36 @@ +FROM ubuntu:latest AS builder + +ARG PACKAGE=TDengine-server-1.6.5.10-Linux-x64.tar.gz +ARG EXTRACTDIR=TDengine-enterprise-server +ARG CONTENT=taos.tar.gz + +WORKDIR /root + +COPY ${PACKAGE} . + +RUN tar -zxf ${PACKAGE} +RUN mv ${EXTRACTDIR}/driver ./lib +RUN tar -zxf ${EXTRACTDIR}/${CONTENT} + +FROM ubuntu:latest + +WORKDIR /root + +RUN apt-get update +RUN apt-get install -y vim tmux net-tools +RUN echo 'alias ll="ls -l --color=auto"' >> /root/.bashrc + +COPY --from=builder /root/bin/taosd /usr/bin +COPY --from=builder /root/bin/taos /usr/bin +COPY --from=builder /root/cfg/taos.cfg /etc/taos/ +COPY --from=builder /root/lib/libtaos.so.* /usr/lib/libtaos.so.1 + +ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib" +ENV LC_CTYPE=en_US.UTF-8 +ENV LANG=en_US.UTF-8 + +EXPOSE 6030-6041/tcp 6060/tcp 6030-6039/udp + +# VOLUME [ "/var/lib/taos", "/var/log/taos", "/etc/taos" ] + +CMD [ "bash" ] diff --git a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh new file mode 100755 index 0000000000000000000000000000000000000000..e0788ef329b6d513bce52ea0261c1b770c9352bc --- /dev/null +++ b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh @@ -0,0 +1,102 @@ +#!/bin/bash +echo "Executing buildClusterEnv.sh" +DOCKER_DIR=/data +CURR_DIR=`pwd` + +if [ $# != 4 ]; then + echo "argument list need input : " + echo " -n numOfNodes" + echo " -v version" + exit 1 +fi + +NUM_OF_NODES= +VERSION= +while getopts "n:v:" arg +do + case $arg in + n) + NUM_OF_NODES=$OPTARG + ;; + v) + VERSION=$OPTARG + ;; + ?) + echo "unkonwn argument" + ;; + esac +done + + +function createDIR { + for i in {1.. $2} + do + mkdir -p /data/node$i/data + mkdir -p /data/node$i/log + mkdir -p /data/node$i/cfg + done +} + +function cleanEnv { + for i in {1..3} + do + echo /data/node$i/data/* + rm -rf /data/node$i/data/* + echo /data/node$i/log/* + rm -rf /data/node$i/log/* + done +} + +function prepareBuild { + + if [ -d $CURR_DIR/../../../../release ]; then + echo release exists + rm -rf $CURR_DIR/../../../../release/* + fi + + cd $CURR_DIR/../../../../packaging + ./release.sh -v edge -n $VERSION >> /dev/null + + if [ ! -f $CURR_DIR/../../../../release/TDengine-server-$VERSION-Linux-x64.tar.gz ]; then + echo "no TDengine install package found" + exit 1 + fi + + cd $CURR_DIR/../../../../release + mv TDengine-server-$VERSION-Linux-x64.tar.gz $DOCKER_DIR + + rm -rf $DOCKER_DIR/*.yml + cd $CURR_DIR + + cp docker-compose.yml $DOCKER_DIR + cp Dockerfile $DOCKER_DIR + + if [ $NUM_OF_NODES -eq 4 ]; then + cp ../node4.yml $DOCKER_DIR + fi + + if [ $NUM_OF_NODES -eq 5 ]; then + cp ../node5.yml $DOCKER_DIR + fi +} + +function clusterUp { + + cd $DOCKER_DIR + + if [ $NUM_OF_NODES -eq 3 ]; then + PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION docker-compose up -d + fi + + if [ $NUM_OF_NODES -eq 4 ]; then + PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION docker-compose -f docker-compose.yml -f node4.yml up -d + fi + + if [ $NUM_OF_NODES -eq 5 ]; then + PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION docker-compose -f docker-compose.yml -f node4.yml -f node5.yml up -d + fi +} + +cleanEnv +# prepareBuild +# clusterUp \ No newline at end of file diff --git a/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml b/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..c8498b36d4a0f15ad70b0d258c37546ea6aec55c --- /dev/null +++ b/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml @@ -0,0 +1,127 @@ +version: '3.7' + +services: + td2.0-node1: + build: + context: . + args: + - PACKAGE=${PACKAGE} + - EXTRACTDIR=${DIR} + image: 'tdengine:2.0.13.1' + container_name: 'td2.0-node1' + cap_add: + - ALL + stdin_open: true + tty: true + environment: + TZ: "Asia/Shanghai" + command: > + sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && + echo $TZ > /etc/timezone && + exec my-main-application" + volumes: + # bind data directory + - type: bind + source: /data/node1/data + target: /var/lib/taos + # bind log directory + - type: bind + source: /data/node1/log + target: /var/log/taos + # bind configuration + - type: bind + source: /data/node1/cfg + target: /etc/taos + - type: bind + source: /data + target: /root + networks: + taos_update_net: + ipv4_address: 172.27.0.7 + command: taosd + + td2.0-node2: + build: + context: . + args: + - PACKAGE=${PACKAGE} + - EXTRACTDIR=${DIR} + image: 'tdengine:2.0.13.1' + container_name: 'td2.0-node2' + cap_add: + - ALL + stdin_open: true + tty: true + environment: + TZ: "Asia/Shanghai" + command: > + sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && + echo $TZ > /etc/timezone && + exec my-main-application" + volumes: + # bind data directory + - type: bind + source: /data/node2/data + target: /var/lib/taos + # bind log directory + - type: bind + source: /data/node2/log + target: /var/log/taos + # bind configuration + - type: bind + source: /data/node2/cfg + target: /etc/taos + - type: bind + source: /data + target: /root + networks: + taos_update_net: + ipv4_address: 172.27.0.8 + command: taosd + + td2.0-node3: + build: + context: . + args: + - PACKAGE=${PACKAGE} + - EXTRACTDIR=${DIR} + image: 'tdengine:2.0.13.1' + container_name: 'td2.0-node3' + cap_add: + - ALL + stdin_open: true + tty: true + environment: + TZ: "Asia/Shanghai" + command: > + sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && + echo $TZ > /etc/timezone && + exec my-main-application" + volumes: + # bind data directory + - type: bind + source: /data/node3/data + target: /var/lib/taos + # bind log directory + - type: bind + source: /data/node3/log + target: /var/log/taos + # bind configuration + - type: bind + source: /data/node3/cfg + target: /etc/taos + - type: bind + source: /data + target: /root + networks: + taos_update_net: + ipv4_address: 172.27.0.9 + command: taosd + +networks: + taos_update_net: +# external: true + ipam: + driver: default + config: + - subnet: "172.27.0.0/24" diff --git a/tests/pytest/cluster/clusterEnvSetup/node4.yml b/tests/pytest/cluster/clusterEnvSetup/node4.yml new file mode 100644 index 0000000000000000000000000000000000000000..542dc4cac1626ebc4387e6138067a5d91d64434d --- /dev/null +++ b/tests/pytest/cluster/clusterEnvSetup/node4.yml @@ -0,0 +1,41 @@ +version: '3.7' + +services: + td2.0-node4: + build: + context: . + args: + - PACKAGE=${PACKAGE} + - EXTRACTDIR=${DIR} + image: 'tdengine:2.0.13.1' + container_name: 'td2.0-node4' + cap_add: + - ALL + stdin_open: true + tty: true + environment: + TZ: "Asia/Shanghai" + command: > + sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && + echo $TZ > /etc/timezone && + exec my-main-application" + volumes: + # bind data directory + - type: bind + source: /data/node4/data + target: /var/lib/taos + # bind log directory + - type: bind + source: /data/node4/log + target: /var/log/taos + # bind configuration + - type: bind + source: /data/node4/cfg + target: /etc/taos + - type: bind + source: /data + target: /root + networks: + taos_update_net: + ipv4_address: 172.27.0.10 + command: taosd \ No newline at end of file diff --git a/tests/pytest/cluster/clusterEnvSetup/node5.yml b/tests/pytest/cluster/clusterEnvSetup/node5.yml new file mode 100644 index 0000000000000000000000000000000000000000..832cc65e0888e5fc51feae7f13a7cd24b813878b --- /dev/null +++ b/tests/pytest/cluster/clusterEnvSetup/node5.yml @@ -0,0 +1,41 @@ +version: '3.7' + +services: + td2.0-node5: + build: + context: . + args: + - PACKAGE=${PACKAGE} + - EXTRACTDIR=${DIR} + image: 'tdengine:2.0.13.1' + container_name: 'td2.0-node5' + cap_add: + - ALL + stdin_open: true + tty: true + environment: + TZ: "Asia/Shanghai" + command: > + sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && + echo $TZ > /etc/timezone && + exec my-main-application" + volumes: + # bind data directory + - type: bind + source: /data/node5/data + target: /var/lib/taos + # bind log directory + - type: bind + source: /data/node5/log + target: /var/log/taos + # bind configuration + - type: bind + source: /data/node5/cfg + target: /etc/taos + - type: bind + source: /data + target: /root + networks: + taos_update_net: + ipv4_address: 172.27.0.11 + command: taosd \ No newline at end of file