[TD-1639]
This commit is contained in:
parent
90bdea4c5f
commit
cc74bdd8f8
|
@ -0,0 +1,17 @@
|
||||||
|
@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
|
|
@ -1,5 +1,18 @@
|
||||||
#!/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
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
@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
|
||||||
|
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
#!/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
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue