[TD-5661]<test> : let the test case about nano support for connector runing on CI !

This commit is contained in:
wenzhouwww 2021-08-31 15:23:00 +08:00
parent 8db12cdfed
commit f28a29a85f
5 changed files with 217 additions and 216 deletions

5
Jenkinsfile vendored
View File

@ -234,11 +234,16 @@ pipeline {
cd ${WKC}/tests/examples/nodejs
npm install td2.0-connector > /dev/null 2>&1
node nodejsChecker.js host=localhost
node ../../connectorTest/nodejsTest/nanosupport/nanosecondTest.js
'''
sh '''
cd ${WKC}/tests/examples/C#/taosdemo
mcs -out:taosdemo *.cs > /dev/null 2>&1
echo '' |./taosdemo
cd ${WKC}/tests/connectorTest/C#Test/nanosupport
mcs -out:nano *.cs > /dev/null 2>&1
echo '' |./nano
'''
sh '''
cd ${WKC}/tests/gotest

View File

@ -1,5 +1,5 @@
const taos = require('../tdengine');
var conn = taos.connect({config:"/etc/taos"});
const taos = require('td2.0-connector');
var conn = taos.connect({host:"localhost", user:"root", password:"taosdata", config:"/etc/taos",port:6030})
var c1 = conn.cursor();
@ -16,8 +16,8 @@ function checkData(sql,row,col,data){
}
else{
console.log('check failed')
console.log(checkdata)
console.log(data)
console.log('checked is :',checkdata)
console.log("expected is :",data)
}

View File

@ -19,3 +19,6 @@ go env -w GOPROXY=https://goproxy.io,direct
bash ./case001/case001.sh $severIp $serverPort
#bash ./case002/case002.sh $severIp $serverPort
#bash ./case003/case003.sh $severIp $serverPort
cd nanosupport
go run main.go

View File

@ -3,12 +3,13 @@ package connector
import (
"context"
"fmt"
"reflect"
"time"
"github.com/taosdata/go-utils/log"
"github.com/taosdata/go-utils/tdengine/config"
"github.com/taosdata/go-utils/tdengine/connector"
tdengineExecutor "github.com/taosdata/go-utils/tdengine/executor"
"reflect"
"time"
)
type Executor struct {
@ -34,6 +35,7 @@ func (e *Executor) Execute(sql string) (int64, error) {
return e.executor.DoExec(e.ctx, sql)
}
func (e *Executor) Query(sql string) (*connector.Data, error) {
fmt.Println("query :", sql)
return e.executor.DoQuery(e.ctx, sql)
}
func (e *Executor) CheckData(row, col int, value interface{}, data *connector.Data) (bool, error) {
@ -104,10 +106,10 @@ func (e *Executor) CheckData(row, col int, value interface{}, data *connector.Da
func (e *Executor) CheckData2(row, col int, value interface{}, data *connector.Data) {
match, err := e.CheckData(row, col, value, data)
if err != nil {
fmt.Println(err)
fmt.Println("expect data is :", value)
fmt.Println("go got data is :", data.Data[row][col])
if err != nil {
fmt.Println(err)
}
if !match {
fmt.Println(" data not match")
@ -198,9 +200,6 @@ func (e *Executor) CheckData2(row, col int, value interface{}, data *connector.D
*/
}
func (e *Executor) CheckRow(count int, data *connector.Data) {
if len(data.Data) != count {

View File

@ -2,10 +2,11 @@ package main
import (
"fmt"
"github.com/taosdata/go-utils/tdengine/config"
"log"
"taos/connector"
"time"
"github.com/taosdata/go-utils/tdengine/config"
)
func main() {
@ -44,7 +45,6 @@ func main() {
fmt.Println(" start check nano support!")
data, _ = e.Query("select count(*) from tb where ts > 1623254400100000000 and ts < 1623254400100000002;")
e.CheckData2(0, 0, int64(1), data)
@ -111,7 +111,6 @@ func main() {
data, _ = e.Query("select * from tb;")
e.CheckRow(7, data)
e.Execute("create table tb2 (ts timestamp, speed int, ts2 timestamp);")
e.Execute("insert into tb2 values(\"2021-06-10 0:00:00.100000001\", 1, \"2021-06-11 0:00:00.100000001\");")
e.Execute("insert into tb2 values(1623254400150000000, 2, 1623340800150000000);")
@ -135,7 +134,6 @@ func main() {
data, _ = e.Query("select count(*) from tb2 where ts2 > 1623340800000000000 and ts2 < 1623340800150000000;")
e.CheckData2(0, 0, int64(1), data)
data, _ = e.Query("select count(*) from tb2 where ts2 > \"2021-06-11 0:00:00.100000000\" and ts2 < \"2021-06-11 0:00:00.100000002\";")
e.CheckData2(0, 0, int64(1), data)
@ -233,11 +231,8 @@ func main() {
e.CheckData2(0, 0, ttt3, data)
fmt.Println("all test done!")
}
func prepareData(e *connector.Executor) {
sqlList := []string{
"reset query cache;",
@ -272,4 +267,3 @@ func executeSql(e *connector.Executor, sql string) error {
}
return nil
}