提交 cc74bdd8 编写于 作者: H Hui Li

[TD-1639]

上级 90bdea4c
@echo off
echo ==== start Go connector test cases test ====
cd /d %~dp0
set severIp=%1
set serverPort=%2
if "%severIp%"=="" (set severIp=127.0.0.1)
if "%serverPort%"=="" (set serverPort=6030)
cd case001
case001.bat %severIp% %serverPort%
rem cd case002
rem case002.bat
:: cd case002
:: case002.bat
#!/bin/bash #!/bin/bash
bash ./case001/case001.sh echo "==== start Go connector test cases test ===="
#bash ./case002/case002.sh
#bash ./case003/case003.sh severIp=$1
serverPort=$2
if [ ! -n "$severIp" ]; then
severIp=127.0.0.1
fi
if [ ! -n "$serverPort" ]; then
serverPort=6030
fi
bash ./case001/case001.sh $severIp $serverPort
#bash ./case002/case002.sh $severIp $serverPort
#bash ./case003/case003.sh $severIp $serverPort
@echo off
echo ==== start run cases001.go
del go.*
go mod init demotest
go build
demotest.exe -h %1 -p %2
cd ..
...@@ -16,20 +16,53 @@ package main ...@@ -16,20 +16,53 @@ package main
import ( import (
"database/sql" "database/sql"
"flag"
"fmt" "fmt"
_ "github.com/taosdata/driver-go/taosSql" _ "github.com/taosdata/driver-go/taosSql"
"log" "log"
"strconv"
"time" "time"
) )
type config struct {
hostName string
serverPort int
user string
password string
}
var configPara config
var url string
func init() {
flag.StringVar(&configPara.hostName, "h", "127.0.0.1","The host to connect to TDengine server.")
flag.IntVar(&configPara.serverPort, "p", 6030, "The TCP/IP port number to use for the connection to TDengine server.")
flag.StringVar(&configPara.user, "u", "root", "The TDengine user name to use when connecting to the server.")
flag.StringVar(&configPara.password, "P", "taosdata", "The password to use when connecting to the server.")
flag.Parse()
}
func printAllArgs() {
fmt.Printf("\n============= args parse result: =============\n")
fmt.Printf("hostName: %v\n", configPara.hostName)
fmt.Printf("serverPort: %v\n", configPara.serverPort)
fmt.Printf("usr: %v\n", configPara.user)
fmt.Printf("password: %v\n", configPara.password)
fmt.Printf("================================================\n")
}
func main() { func main() {
printAllArgs()
taosDriverName := "taosSql" taosDriverName := "taosSql"
demodb := "demodb" demodb := "demodb"
demot := "demot" demot := "demot"
fmt.Printf("\n======== start demo test ========\n") fmt.Printf("\n======== start demo test ========\n")
url = "root:taosdata@/tcp(" + configPara.hostName + ":" + strconv.Itoa(configPara.serverPort) + ")/"
// open connect to taos server // open connect to taos server
db, err := sql.Open(taosDriverName, "root:taosdata@/tcp(192.168.1.217:7100)/") db, err := sql.Open(taosDriverName, url)
if err != nil { if err != nil {
log.Fatalf("Open database error: %s\n", err) log.Fatalf("Open database error: %s\n", err)
} }
......
#!/bin/bash #!/bin/bash
################################################## echo "==== start run cases001.go"
#
# Do go test
#
##################################################
set +e set +e
#set -x #set -x
...@@ -12,59 +8,14 @@ set +e ...@@ -12,59 +8,14 @@ set +e
script_dir="$(dirname $(readlink -f $0))" script_dir="$(dirname $(readlink -f $0))"
#echo "pwd: $script_dir, para0: $0" #echo "pwd: $script_dir, para0: $0"
execName=$0 #execName=$0
execName=`echo ${execName##*/}` #execName=`echo ${execName##*/}`
goName=`echo ${execName%.*}` #goName=`echo ${execName%.*}`
###### step 1: start one taosd
scriptDir=$script_dir/../../script/sh
bash $scriptDir/stop_dnodes.sh
bash $scriptDir/deploy.sh -n dnode1 -i 1
bash $scriptDir/cfg.sh -n dnode1 -c walLevel -v 0
bash $scriptDir/exec.sh -n dnode1 -s start
###### step 2: set config item
TAOS_CFG=/etc/taos/taos.cfg
HOSTNAME=`hostname -f`
if [ ! -f ${TAOS_CFG} ]; then
touch -f $TAOS_CFG
fi
echo " " > $TAOS_CFG
echo "firstEp ${HOSTNAME}:7100" >> $TAOS_CFG
echo "secondEp ${HOSTNAME}:7200" >> $TAOS_CFG
echo "serverPort 7100" >> $TAOS_CFG
#echo "dataDir $DATA_DIR" >> $TAOS_CFG
#echo "logDir $LOG_DIR" >> $TAOS_CFG
#echo "scriptDir ${CODE_DIR}/../script" >> $TAOS_CFG
echo "numOfLogLines 100000000" >> $TAOS_CFG
echo "dDebugFlag 135" >> $TAOS_CFG
echo "mDebugFlag 135" >> $TAOS_CFG
echo "sdbDebugFlag 135" >> $TAOS_CFG
echo "rpcDebugFlag 135" >> $TAOS_CFG
echo "tmrDebugFlag 131" >> $TAOS_CFG
echo "cDebugFlag 135" >> $TAOS_CFG
echo "httpDebugFlag 135" >> $TAOS_CFG
echo "monitorDebugFlag 135" >> $TAOS_CFG
echo "udebugFlag 135" >> $TAOS_CFG
echo "tablemetakeeptimer 5" >> $TAOS_CFG
echo "wal 0" >> $TAOS_CFG
echo "asyncLog 0" >> $TAOS_CFG
echo "locale en_US.UTF-8" >> $TAOS_CFG
echo "enableCoreFile 1" >> $TAOS_CFG
echo " " >> $TAOS_CFG
ulimit -n 600000
ulimit -c unlimited
#
##sudo sysctl -w kernel.core_pattern=$TOP_DIR/core.%p.%e
#
###### step 3: start build ###### step 3: start build
cd $script_dir cd $script_dir
rm -f go.* rm -f go.*
go mod init $goName go mod init demotest
go build go build
sleep 1s sleep 1s
sudo ./$goName ./demotest -h $1 -p $2
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册