未验证 提交 e1e9b623 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

[TD-12659]<fix>(tools): taos-tools 1.0.0 (#9542)

* [TD-12659]<fix>(tools): taos-tools 1.0.0

* [TD-12659]<fix>(tools): merge nanoinsert case from develop

* [TD-12659]<fix>(tools): taosTools 1.0.0

fix taosdumpTest2.py

* [TD12659]<fix>(tools): taosTools 1.0.0

merge tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py

* [TD12659]<fix>(tools): taosTools 1.0.0

merge tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py

* [TD12659]<fix>(tools): taosTools 1.0.0

merge tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json
上级 5a848d8f
Subproject commit dd78bfff5549c08153798719c1707ab441b5f4ab Subproject commit 59f00a69f36b08cea86a70a22c29b2c27ef506ae
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys import sys
import os import os, time
from util.log import * from util.log import *
from util.cases import * from util.cases import *
from util.sql import * from util.sql import *
...@@ -107,6 +107,7 @@ class TDTestCase: ...@@ -107,6 +107,7 @@ class TDTestCase:
# insert by csv files and timetamp is long int , strings in ts and # insert by csv files and timetamp is long int , strings in ts and
# cols # cols
os.system( os.system(
"%staosBenchmark -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestNanoDatabasecsv.json -y " % "%staosBenchmark -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestNanoDatabasecsv.json -y " %
binPath) binPath)
...@@ -117,9 +118,11 @@ class TDTestCase: ...@@ -117,9 +118,11 @@ class TDTestCase:
tdSql.checkData(0, 0, 10000) tdSql.checkData(0, 0, 10000)
tdSql.query("describe stb0") tdSql.query("describe stb0")
tdSql.checkDataType(3, 1, "TIMESTAMP") tdSql.checkDataType(3, 1, "TIMESTAMP")
tdSql.query( tdSql.query(
"select count(*) from stb0 where ts > \"2021-07-01 00:00:00.490000000\"") "select count(*) from nsdbcsv.stb0 where ts > \"2021-07-01 00:00:00.490000000\"")
tdSql.checkData(0, 0, 5000) tdSql.checkData(0, 0, 5000)
tdSql.query("select count(*) from stb0 where ts < 1626918583000000000") tdSql.query("select count(*) from stb0 where ts < 1626918583000000000")
tdSql.checkData(0, 0, 10000) tdSql.checkData(0, 0, 10000)
...@@ -134,31 +137,9 @@ class TDTestCase: ...@@ -134,31 +137,9 @@ class TDTestCase:
binPath) binPath)
tdSql.query("select count(*) from test.meters") tdSql.query("select count(*) from test.meters")
tdSql.checkData(0, 0, 600) tdSql.checkData(0, 0, 600)
# check taosdemo -s
sqls_ls = [
'drop database if exists nsdbsql;',
'create database nsdbsql precision "ns" keep 3600 days 6 update 1;',
'use nsdbsql;',
'CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupdId int);',
'CREATE TABLE d1001 USING meters TAGS ("Beijing.Chaoyang", 2);',
'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 10.2, 219, 0.32);',
'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 85, 32, 0.76);']
with open("./taosdemoTestNanoCreateDB.sql", mode="a") as sql_files:
for sql in sqls_ls:
sql_files.write(sql + "\n")
sql_files.close()
sleep(10)
os.system("%staosBenchmark -s taosdemoTestNanoCreateDB.sql -y " % binPath)
tdSql.query("select count(*) from nsdbsql.meters")
tdSql.checkData(0, 0, 2)
os.system("rm -rf ./res.txt") os.system("rm -rf ./res.txt")
os.system("rm -rf ./*.py.sql") os.system("rm -rf ./*.py.sql")
os.system("rm -rf ./taosdemoTestNanoCreateDB.sql")
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "INT"}], "columns": [{"type": "INT"}],
"tags": [{"type": "INT", "count":1}] "tags": [{"type": "INT", "count":6}]
}, },
{ {
"name": "stb1", "name": "stb1",
...@@ -81,8 +81,8 @@ ...@@ -81,8 +81,8 @@
"sample_format": "csv", "sample_format": "csv",
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "TINYINT", "count":1}], "columns": [{"type": "TINYINT", "count":6}],
"tags": [{"type": "TINYINT", "count":1}] "tags": [{"type": "TINYINT", "count":6}]
}, },
{ {
"name": "stb2", "name": "stb2",
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "BIGINT"}], "columns": [{"type": "BIGINT"}],
"tags": [{"type": "BIGINT", "count":1}] "tags": [{"type": "BIGINT", "count":6}]
}, },
{ {
"name": "stb3", "name": "stb3",
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "SMALLINT"}], "columns": [{"type": "SMALLINT"}],
"tags": [{"type": "SMALLINT", "count":1}] "tags": [{"type": "SMALLINT", "count":6}]
}, },
{ {
"name": "stb4", "name": "stb4",
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "FLOAT"}], "columns": [{"type": "FLOAT"}],
"tags": [{"type": "FLOAT", "count":1}] "tags": [{"type": "FLOAT", "count":6}]
}, },
{ {
"name": "stb5", "name": "stb5",
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "DOUBLE"}], "columns": [{"type": "DOUBLE"}],
"tags": [{"type": "DOUBLE", "count":1}] "tags": [{"type": "DOUBLE", "count":6}]
}, },
{ {
"name": "stb6", "name": "stb6",
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "UINT"}], "columns": [{"type": "UINT"}],
"tags": [{"type": "UINT", "count":1}] "tags": [{"type": "UINT", "count":6}]
}, },
{ {
"name": "stb7", "name": "stb7",
...@@ -237,8 +237,8 @@ ...@@ -237,8 +237,8 @@
"sample_format": "csv", "sample_format": "csv",
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [ {"type": "BOOL"}], "columns": [ {"type": "INT"}],
"tags": [{"type": "BOOL", "count":1}] "tags": [{"type": "INT", "count":3}]
}, },
{ {
"name": "stb8", "name": "stb8",
...@@ -263,8 +263,8 @@ ...@@ -263,8 +263,8 @@
"sample_format": "csv", "sample_format": "csv",
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "NCHAR","len": 16, "count":1}], "columns": [{"type": "NCHAR","len": 16, "count":6}],
"tags": [{"type": "NCHAR", "count":1}] "tags": [{"type": "NCHAR", "count":6}]
}, },
{ {
"name": "stb9", "name": "stb9",
...@@ -289,8 +289,8 @@ ...@@ -289,8 +289,8 @@
"sample_format": "csv", "sample_format": "csv",
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "BINARY", "len": 16, "count":1}], "columns": [{"type": "BINARY", "len": 16, "count":6}],
"tags": [{"type": "BINARY", "count":1}] "tags": [{"type": "BINARY", "count":6}]
}, },
{ {
"name": "stb10", "name": "stb10",
...@@ -316,7 +316,7 @@ ...@@ -316,7 +316,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "UBIGINT"}], "columns": [{"type": "UBIGINT"}],
"tags": [{"type": "UBIGINT", "count":1}] "tags": [{"type": "UBIGINT", "count":6}]
}, },
{ {
"name": "stb11", "name": "stb11",
...@@ -342,7 +342,7 @@ ...@@ -342,7 +342,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "UTINYINT"}], "columns": [{"type": "UTINYINT"}],
"tags": [{"type": "UTINYINT", "count":1}] "tags": [{"type": "UTINYINT", "count":3}]
}, },
{ {
"name": "stb12", "name": "stb12",
...@@ -368,7 +368,7 @@ ...@@ -368,7 +368,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [ {"type": "USMALLINT"}], "columns": [ {"type": "USMALLINT"}],
"tags": [{"type": "USMALLINT", "count":1}] "tags": [{"type": "USMALLINT", "count":6}]
}] }]
}] }]
} }
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "INT"}], "columns": [{"type": "INT"}],
"tags": [{"type": "INT", "count":1}] "tags": [{"type": "INT", "count":6}]
}, },
{ {
"name": "stb1", "name": "stb1",
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "UINT"}], "columns": [{"type": "UINT"}],
"tags": [{"type": "UINT", "count":1}] "tags": [{"type": "UINT", "count":6}]
}, },
{ {
"name": "stb2", "name": "stb2",
...@@ -107,8 +107,8 @@ ...@@ -107,8 +107,8 @@
"sample_format": "csv", "sample_format": "csv",
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "TINYINT", "count":1}], "columns": [{"type": "TINYINT", "count":6}],
"tags": [{"type": "TINYINT", "count":1}] "tags": [{"type": "TINYINT", "count":6}]
}, },
{ {
"name": "stb3", "name": "stb3",
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "BIGINT"}], "columns": [{"type": "BIGINT"}],
"tags": [{"type": "BIGINT", "count":1}] "tags": [{"type": "BIGINT", "count":6}]
}, },
{ {
"name": "stb4", "name": "stb4",
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "SMALLINT"}], "columns": [{"type": "SMALLINT"}],
"tags": [{"type": "SMALLINT", "count":1}] "tags": [{"type": "SMALLINT", "count":6}]
}, },
{ {
"name": "stb5", "name": "stb5",
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "FLOAT"}], "columns": [{"type": "FLOAT"}],
"tags": [{"type": "FLOAT", "count":1}] "tags": [{"type": "FLOAT", "count":6}]
}, },
{ {
"name": "stb6", "name": "stb6",
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "DOUBLE"}], "columns": [{"type": "DOUBLE"}],
"tags": [{"type": "DOUBLE", "count":1}] "tags": [{"type": "DOUBLE", "count":6}]
}, },
{ {
"name": "stb7", "name": "stb7",
...@@ -237,8 +237,8 @@ ...@@ -237,8 +237,8 @@
"sample_format": "csv", "sample_format": "csv",
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [ {"type": "BOOL"}], "columns": [ {"type": "int"}],
"tags": [{"type": "BOOL", "count":1}] "tags": [{"type": "int", "count":6}]
}, },
{ {
"name": "stb8", "name": "stb8",
...@@ -263,8 +263,8 @@ ...@@ -263,8 +263,8 @@
"sample_format": "csv", "sample_format": "csv",
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "NCHAR","len": 16, "count":1}], "columns": [{"type": "NCHAR","len": 16, "count":6}],
"tags": [{"type": "NCHAR", "count":1}] "tags": [{"type": "NCHAR", "count":6}]
}, },
{ {
"name": "stb9", "name": "stb9",
...@@ -289,8 +289,8 @@ ...@@ -289,8 +289,8 @@
"sample_format": "csv", "sample_format": "csv",
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "BINARY", "len": 16, "count":1}], "columns": [{"type": "BINARY", "len": 16, "count":6}],
"tags": [{"type": "BINARY", "count":1}] "tags": [{"type": "BINARY", "count":6}]
}, },
{ {
"name": "stb10", "name": "stb10",
...@@ -316,7 +316,7 @@ ...@@ -316,7 +316,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "UBIGINT"}], "columns": [{"type": "UBIGINT"}],
"tags": [{"type": "UBIGINT", "count":1}] "tags": [{"type": "UBIGINT", "count":6}]
}, },
{ {
"name": "stb11", "name": "stb11",
...@@ -342,7 +342,7 @@ ...@@ -342,7 +342,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [{"type": "UTINYINT"}], "columns": [{"type": "UTINYINT"}],
"tags": [{"type": "UTINYINT", "count":1}] "tags": [{"type": "UTINYINT", "count":6}]
}, },
{ {
"name": "stb12", "name": "stb12",
...@@ -368,7 +368,7 @@ ...@@ -368,7 +368,7 @@
"sample_file": "./sample.csv", "sample_file": "./sample.csv",
"tags_file": "", "tags_file": "",
"columns": [ {"type": "USMALLINT"}], "columns": [ {"type": "USMALLINT"}],
"tags": [{"type": "USMALLINT", "count":1}] "tags": [{"type": "USMALLINT", "count":6}]
}] }]
}] }]
} }
...@@ -268,16 +268,16 @@ class TDTestCase: ...@@ -268,16 +268,16 @@ class TDTestCase:
tdSql.checkData(0, 0, 10) tdSql.checkData(0, 0, 10)
# insert: sample json # insert: sample json
os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-sample-stmt.json -y " % binPath) #os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-sample-stmt.json -y " % binPath)
tdSql.execute("use dbtest123") #tdSql.execute("use dbtest123")
tdSql.query("select c2 from stb0") #tdSql.query("select c2 from stb0")
tdSql.checkData(0, 0, 2147483647) #tdSql.checkData(0, 0, 2147483647)
tdSql.query("select * from stb1 where t1=-127") #tdSql.query("select * from stb1 where t1=-127")
tdSql.checkRows(20) #tdSql.checkRows(20)
tdSql.query("select * from stb1 where t2=127") #tdSql.query("select * from stb1 where t2=127")
tdSql.checkRows(10) #tdSql.checkRows(10)
tdSql.query("select * from stb1 where t2=126") #tdSql.query("select * from stb1 where t2=126")
tdSql.checkRows(10) #tdSql.checkRows(10)
# insert: test interlace parament # insert: test interlace parament
os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-interlace-row-stmt.json -y " % binPath) os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-interlace-row-stmt.json -y " % binPath)
......
...@@ -27,6 +27,7 @@ class TDTestCase: ...@@ -27,6 +27,7 @@ class TDTestCase:
self.ts = 1601481600000 self.ts = 1601481600000
self.numberOfTables = 1 self.numberOfTables = 1
self.numberOfRecords = 15000 self.numberOfRecords = 15000
self.tmpdir = "tmp"
def getBuildPath(self): def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
...@@ -67,16 +68,22 @@ class TDTestCase: ...@@ -67,16 +68,22 @@ class TDTestCase:
tdLog.info("taosdump found in %s" % buildPath) tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/" binPath = buildPath + "/build/bin/"
os.system("rm /tmp/*.sql") if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
else:
print("directory exists")
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
os.system( os.system(
"%staosdump --databases db -o /tmp -B 16384 -L 1048576" % "%staosdump --databases db -o %s -B 16384 " %
binPath) (binPath, self.tmpdir))
tdSql.execute("drop database db") tdSql.execute("drop database db")
tdSql.query("show databases") tdSql.query("show databases")
tdSql.checkRows(0) tdSql.checkRows(0)
os.system("%staosdump -i /tmp" % binPath) os.system("%staosdump -i %s" % (binPath, self.tmpdir))
tdSql.query("show databases") tdSql.query("show databases")
tdSql.checkRows(1) tdSql.checkRows(1)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册