[TD-3952]<test>: add taodemo-testcase that query with restful connector
This commit is contained in:
parent
661144963c
commit
15cfeb7f5e
|
@ -78,7 +78,7 @@ class TDTestCase:
|
|||
tdSql.checkData(0, 0, "%d" % suc_kill)
|
||||
os.system("rm -rf querySystemInfo*")
|
||||
os.system("rm -rf insert_res.txt")
|
||||
os.system("rm -rf insert_res.txt")
|
||||
os.system("rm -rf query_res.txt")
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"sqls":[
|
||||
{
|
||||
"sql": "select * from stb0",
|
||||
"result": ""
|
||||
"result": "./query_res.txt"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
"childtable_limit": 0,
|
||||
"childtable_offset":0,
|
||||
"multi_thread_write_one_tbl": "no",
|
||||
"interlace_rows": 1000000,
|
||||
"interlace_rows": 0,
|
||||
"insert_interval":0,
|
||||
"max_sql_len": 1024000,
|
||||
"disorder_ratio": 0,
|
||||
|
@ -97,7 +97,7 @@
|
|||
"childtable_limit": 0,
|
||||
"childtable_offset":0,
|
||||
"multi_thread_write_one_tbl": "no",
|
||||
"interlace_rows": 1000000,
|
||||
"interlace_rows": 0,
|
||||
"insert_interval":0,
|
||||
"max_sql_len": 1024000,
|
||||
"disorder_ratio": 0,
|
||||
|
@ -123,7 +123,7 @@
|
|||
"childtable_limit": 0,
|
||||
"childtable_offset":0,
|
||||
"multi_thread_write_one_tbl": "no",
|
||||
"interlace_rows": 1000000,
|
||||
"interlace_rows": 100,
|
||||
"insert_interval":0,
|
||||
"max_sql_len": 1024000,
|
||||
"disorder_ratio": 0,
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
"confirm_parameter_prompt": "no",
|
||||
"insert_interval": 0,
|
||||
"interlace_rows": 10,
|
||||
"num_of_records_per_req": 100,
|
||||
"max_sql_len": 10240000000,
|
||||
"num_of_records_per_req": 1000000,
|
||||
"max_sql_len": 1024000000,
|
||||
"databases": [{
|
||||
"dbinfo": {
|
||||
"name": "db1",
|
||||
|
@ -45,7 +45,7 @@
|
|||
"childtable_limit": 0,
|
||||
"childtable_offset":0,
|
||||
"multi_thread_write_one_tbl": "no",
|
||||
"interlace_rows": 0,
|
||||
"interlace_rows": 10000,
|
||||
"insert_interval":0,
|
||||
"max_sql_len": 1024000,
|
||||
"disorder_ratio": 0,
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
"super_tables": [{
|
||||
"name": "stb0",
|
||||
"child_table_exists":"no",
|
||||
"childtable_count": 100,
|
||||
"childtable_count": 10,
|
||||
"childtable_prefix": "stb00_",
|
||||
"auto_create_table": "no",
|
||||
"batch_create_tbl_num": 10,
|
||||
|
@ -60,7 +60,7 @@
|
|||
{
|
||||
"name": "stb1",
|
||||
"child_table_exists":"no",
|
||||
"childtable_count": 100,
|
||||
"childtable_count": 10,
|
||||
"childtable_prefix": "stb01_",
|
||||
"auto_create_table": "no",
|
||||
"batch_create_tbl_num": 10,
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
{
|
||||
"filetype": "insert",
|
||||
"cfgdir": "/etc/taos",
|
||||
"host": "127.0.0.1",
|
||||
"port": 6030,
|
||||
"user": "root",
|
||||
"password": "taosdata",
|
||||
"thread_count": 4,
|
||||
"thread_count_create_tbl": 4,
|
||||
"result_file": "./insert_res.txt",
|
||||
"confirm_parameter_prompt": "no",
|
||||
"insert_interval": 0,
|
||||
"interlace_rows": 0,
|
||||
"num_of_records_per_req": 3000,
|
||||
"max_sql_len": 1024000,
|
||||
"databases": [{
|
||||
"dbinfo": {
|
||||
"name": "db",
|
||||
"drop": "yes",
|
||||
"replica": 1,
|
||||
"days": 10,
|
||||
"cache": 16,
|
||||
"blocks": 8,
|
||||
"precision": "ms",
|
||||
"keep": 365,
|
||||
"minRows": 100,
|
||||
"maxRows": 4096,
|
||||
"comp":2,
|
||||
"walLevel":1,
|
||||
"cachelast":0,
|
||||
"quorum":1,
|
||||
"fsync":3000,
|
||||
"update": 0
|
||||
},
|
||||
"super_tables": [{
|
||||
"name": "stb0",
|
||||
"child_table_exists":"no",
|
||||
"childtable_count": 2,
|
||||
"childtable_prefix": "stb00_",
|
||||
"auto_create_table": "no",
|
||||
"batch_create_tbl_num": 10,
|
||||
"data_source": "rand",
|
||||
"insert_mode": "taosc",
|
||||
"insert_rows": 10,
|
||||
"childtable_limit": 0,
|
||||
"childtable_offset": 0,
|
||||
"interlace_rows": 0,
|
||||
"insert_interval": 0,
|
||||
"max_sql_len": 1024000,
|
||||
"disorder_ratio": 0,
|
||||
"disorder_range": 1000,
|
||||
"timestamp_step": 1,
|
||||
"start_timestamp": "2020-11-01 00:00:00.000",
|
||||
"sample_format": "csv",
|
||||
"sample_file": "./sample.csv",
|
||||
"tags_file": "",
|
||||
"columns": [{"type": "BINARY", "len": 1, "count":1}, {"type": "BINARY", "len": 3, "count":1}, {"type": "INT"}, {"type": "DOUBLE", "count":1}],
|
||||
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
|
||||
},
|
||||
{
|
||||
"name": "stb1",
|
||||
"child_table_exists":"no",
|
||||
"childtable_count": 2,
|
||||
"childtable_prefix": "stb01_",
|
||||
"auto_create_table": "no",
|
||||
"batch_create_tbl_num": 10,
|
||||
"data_source": "rand",
|
||||
"insert_mode": "taosc",
|
||||
"insert_rows": 5,
|
||||
"childtable_limit": 0,
|
||||
"childtable_offset": 0,
|
||||
"interlace_rows": 0 ,
|
||||
"insert_interval": 0,
|
||||
"max_sql_len": 1024000,
|
||||
"disorder_ratio": 0,
|
||||
"disorder_range": 1000,
|
||||
"timestamp_step": 1,
|
||||
"start_timestamp": "2020-11-01 00:00:00.000",
|
||||
"sample_format": "csv",
|
||||
"sample_file": "./sample.csv",
|
||||
"tags_file": "",
|
||||
"columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 1, "count":3}, {"type": "BINARY", "len": 2, "count":6}],
|
||||
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
|
||||
}]
|
||||
}]
|
||||
}
|
|
@ -48,212 +48,212 @@ class TDTestCase:
|
|||
tdLog.info("taosd found in %s" % buildPath)
|
||||
binPath = buildPath+ "/build/bin/"
|
||||
|
||||
# # insert: create one or mutiple tables per sql and insert multiple rows per sql
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insert-1s1tnt1r.json -y " % binPath)
|
||||
# tdSql.execute("use db")
|
||||
# tdSql.query("select count (tbname) from stb0")
|
||||
# tdSql.checkData(0, 0, 1000)
|
||||
# tdSql.query("select count (tbname) from stb1")
|
||||
# tdSql.checkData(0, 0, 1000)
|
||||
# tdSql.query("select count(*) from stb00_0")
|
||||
# tdSql.checkData(0, 0, 100)
|
||||
# tdSql.query("select count(*) from stb0")
|
||||
# tdSql.checkData(0, 0, 100000)
|
||||
# tdSql.query("select count(*) from stb01_1")
|
||||
# tdSql.checkData(0, 0, 200)
|
||||
# tdSql.query("select count(*) from stb1")
|
||||
# tdSql.checkData(0, 0, 200000)
|
||||
# insert: create one or mutiple tables per sql and insert multiple rows per sql
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insert-1s1tnt1r.json -y " % binPath)
|
||||
tdSql.execute("use db")
|
||||
tdSql.query("select count (tbname) from stb0")
|
||||
tdSql.checkData(0, 0, 1000)
|
||||
tdSql.query("select count (tbname) from stb1")
|
||||
tdSql.checkData(0, 0, 1000)
|
||||
tdSql.query("select count(*) from stb00_0")
|
||||
tdSql.checkData(0, 0, 100)
|
||||
tdSql.query("select count(*) from stb0")
|
||||
tdSql.checkData(0, 0, 100000)
|
||||
tdSql.query("select count(*) from stb01_1")
|
||||
tdSql.checkData(0, 0, 200)
|
||||
tdSql.query("select count(*) from stb1")
|
||||
tdSql.checkData(0, 0, 200000)
|
||||
|
||||
|
||||
# # insert: create mutiple tables per sql and insert one rows per sql .
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insert-1s1tntmr.json -y " % binPath)
|
||||
# tdSql.execute("use db")
|
||||
# tdSql.query("select count (tbname) from stb0")
|
||||
# tdSql.checkData(0, 0, 10)
|
||||
# tdSql.query("select count (tbname) from stb1")
|
||||
# tdSql.checkData(0, 0, 20)
|
||||
# tdSql.query("select count(*) from stb00_0")
|
||||
# tdSql.checkData(0, 0, 10000)
|
||||
# tdSql.query("select count(*) from stb0")
|
||||
# tdSql.checkData(0, 0, 100000)
|
||||
# tdSql.query("select count(*) from stb01_0")
|
||||
# tdSql.checkData(0, 0, 20000)
|
||||
# tdSql.query("select count(*) from stb1")
|
||||
# tdSql.checkData(0, 0, 400000)
|
||||
# insert: create mutiple tables per sql and insert one rows per sql .
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insert-1s1tntmr.json -y " % binPath)
|
||||
tdSql.execute("use db")
|
||||
tdSql.query("select count (tbname) from stb0")
|
||||
tdSql.checkData(0, 0, 10)
|
||||
tdSql.query("select count (tbname) from stb1")
|
||||
tdSql.checkData(0, 0, 20)
|
||||
tdSql.query("select count(*) from stb00_0")
|
||||
tdSql.checkData(0, 0, 10000)
|
||||
tdSql.query("select count(*) from stb0")
|
||||
tdSql.checkData(0, 0, 100000)
|
||||
tdSql.query("select count(*) from stb01_0")
|
||||
tdSql.checkData(0, 0, 20000)
|
||||
tdSql.query("select count(*) from stb1")
|
||||
tdSql.checkData(0, 0, 400000)
|
||||
|
||||
# # insert: using parament "insert_interval to controls spped of insert.
|
||||
# # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insert-interval-speed.json -y" % binPath)
|
||||
# tdSql.execute("use db")
|
||||
# tdSql.query("show stables")
|
||||
# tdSql.checkData(0, 4, 100)
|
||||
# tdSql.query("select count(*) from stb00_0")
|
||||
# tdSql.checkData(0, 0, 20000)
|
||||
# tdSql.query("select count(*) from stb0")
|
||||
# tdSql.checkData(0, 0, 2000000)
|
||||
# tdSql.query("show stables")
|
||||
# tdSql.checkData(1, 4, 100)
|
||||
# tdSql.query("select count(*) from stb01_0")
|
||||
# tdSql.checkData(0, 0, 20000)
|
||||
# tdSql.query("select count(*) from stb1")
|
||||
# tdSql.checkData(0, 0, 2000000)
|
||||
# insert: using parament "insert_interval to controls spped of insert.
|
||||
# but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insert-interval-speed.json -y" % binPath)
|
||||
tdSql.execute("use db")
|
||||
tdSql.query("show stables")
|
||||
tdSql.checkData(0, 4, 100)
|
||||
tdSql.query("select count(*) from stb00_0")
|
||||
tdSql.checkData(0, 0, 20000)
|
||||
tdSql.query("select count(*) from stb0")
|
||||
tdSql.checkData(0, 0, 2000000)
|
||||
tdSql.query("show stables")
|
||||
tdSql.checkData(1, 4, 100)
|
||||
tdSql.query("select count(*) from stb01_0")
|
||||
tdSql.checkData(0, 0, 20000)
|
||||
tdSql.query("select count(*) from stb1")
|
||||
tdSql.checkData(0, 0, 2000000)
|
||||
|
||||
# # spend 2min30s for 3 testcases.
|
||||
# # insert: drop and child_table_exists combination test
|
||||
# # insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insert-nodbnodrop.json -y" % binPath)
|
||||
# tdSql.error("show dbno.stables")
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insert-newdb.json -y" % binPath)
|
||||
# tdSql.execute("use db")
|
||||
# tdSql.query("select count (tbname) from stb0")
|
||||
# tdSql.checkData(0, 0, 5)
|
||||
# tdSql.query("select count (tbname) from stb1")
|
||||
# tdSql.checkData(0, 0, 6)
|
||||
# tdSql.query("select count (tbname) from stb2")
|
||||
# tdSql.checkData(0, 0, 7)
|
||||
# tdSql.query("select count (tbname) from stb3")
|
||||
# tdSql.checkData(0, 0, 8)
|
||||
# tdSql.query("select count (tbname) from stb4")
|
||||
# tdSql.checkData(0, 0, 8)
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insert-offset.json -y" % binPath)
|
||||
# tdSql.execute("use db")
|
||||
# tdSql.query("select count(*) from stb0")
|
||||
# tdSql.checkData(0, 0, 50)
|
||||
# tdSql.query("select count(*) from stb1")
|
||||
# tdSql.checkData(0, 0, 240)
|
||||
# tdSql.query("select count(*) from stb2")
|
||||
# tdSql.checkData(0, 0, 220)
|
||||
# tdSql.query("select count(*) from stb3")
|
||||
# tdSql.checkData(0, 0, 180)
|
||||
# tdSql.query("select count(*) from stb4")
|
||||
# tdSql.checkData(0, 0, 160)
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insert-newtable.json -y" % binPath)
|
||||
# tdSql.execute("use db")
|
||||
# tdSql.query("select count(*) from stb0")
|
||||
# tdSql.checkData(0, 0, 150)
|
||||
# tdSql.query("select count(*) from stb1")
|
||||
# tdSql.checkData(0, 0, 360)
|
||||
# tdSql.query("select count(*) from stb2")
|
||||
# tdSql.checkData(0, 0, 360)
|
||||
# tdSql.query("select count(*) from stb3")
|
||||
# tdSql.checkData(0, 0, 340)
|
||||
# tdSql.query("select count(*) from stb4")
|
||||
# tdSql.checkData(0, 0, 400)
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insert-renewdb.json -y" % binPath)
|
||||
# tdSql.execute("use db")
|
||||
# tdSql.query("select count(*) from stb0")
|
||||
# tdSql.checkData(0, 0, 50)
|
||||
# tdSql.query("select count(*) from stb1")
|
||||
# tdSql.checkData(0, 0, 120)
|
||||
# tdSql.query("select count(*) from stb2")
|
||||
# tdSql.checkData(0, 0, 140)
|
||||
# tdSql.query("select count(*) from stb3")
|
||||
# tdSql.checkData(0, 0, 160)
|
||||
# tdSql.query("select count(*) from stb4")
|
||||
# tdSql.checkData(0, 0, 160)
|
||||
# spend 2min30s for 3 testcases.
|
||||
# insert: drop and child_table_exists combination test
|
||||
# insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insert-nodbnodrop.json -y" % binPath)
|
||||
tdSql.error("show dbno.stables")
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insert-newdb.json -y" % binPath)
|
||||
tdSql.execute("use db")
|
||||
tdSql.query("select count (tbname) from stb0")
|
||||
tdSql.checkData(0, 0, 5)
|
||||
tdSql.query("select count (tbname) from stb1")
|
||||
tdSql.checkData(0, 0, 6)
|
||||
tdSql.query("select count (tbname) from stb2")
|
||||
tdSql.checkData(0, 0, 7)
|
||||
tdSql.query("select count (tbname) from stb3")
|
||||
tdSql.checkData(0, 0, 8)
|
||||
tdSql.query("select count (tbname) from stb4")
|
||||
tdSql.checkData(0, 0, 8)
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insert-offset.json -y" % binPath)
|
||||
tdSql.execute("use db")
|
||||
tdSql.query("select count(*) from stb0")
|
||||
tdSql.checkData(0, 0, 50)
|
||||
tdSql.query("select count(*) from stb1")
|
||||
tdSql.checkData(0, 0, 240)
|
||||
tdSql.query("select count(*) from stb2")
|
||||
tdSql.checkData(0, 0, 220)
|
||||
tdSql.query("select count(*) from stb3")
|
||||
tdSql.checkData(0, 0, 180)
|
||||
tdSql.query("select count(*) from stb4")
|
||||
tdSql.checkData(0, 0, 160)
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insert-newtable.json -y" % binPath)
|
||||
tdSql.execute("use db")
|
||||
tdSql.query("select count(*) from stb0")
|
||||
tdSql.checkData(0, 0, 150)
|
||||
tdSql.query("select count(*) from stb1")
|
||||
tdSql.checkData(0, 0, 360)
|
||||
tdSql.query("select count(*) from stb2")
|
||||
tdSql.checkData(0, 0, 360)
|
||||
tdSql.query("select count(*) from stb3")
|
||||
tdSql.checkData(0, 0, 340)
|
||||
tdSql.query("select count(*) from stb4")
|
||||
tdSql.checkData(0, 0, 400)
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insert-renewdb.json -y" % binPath)
|
||||
tdSql.execute("use db")
|
||||
tdSql.query("select count(*) from stb0")
|
||||
tdSql.checkData(0, 0, 50)
|
||||
tdSql.query("select count(*) from stb1")
|
||||
tdSql.checkData(0, 0, 120)
|
||||
tdSql.query("select count(*) from stb2")
|
||||
tdSql.checkData(0, 0, 140)
|
||||
tdSql.query("select count(*) from stb3")
|
||||
tdSql.checkData(0, 0, 160)
|
||||
tdSql.query("select count(*) from stb4")
|
||||
tdSql.checkData(0, 0, 160)
|
||||
|
||||
|
||||
# insert: let parament in json file is illegal, it'll expect error.
|
||||
# tdSql.execute("drop database if exists db")
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNumLarge1024.json -y " % binPath)
|
||||
# tdSql.error("use db")
|
||||
# tdSql.execute("drop database if exists db")
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insertSigcolumnsNum1024.json -y " % binPath)
|
||||
# tdSql.error("select * from db.stb0")
|
||||
# tdSql.execute("drop database if exists db")
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNum1024.json -y " % binPath)
|
||||
# tdSql.query("select count(*) from db.stb0")
|
||||
# tdSql.checkData(0, 0, 10000)
|
||||
# tdSql.execute("drop database if exists db")
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json -y " % binPath)
|
||||
# tdSql.query("select count(*) from db.stb0")
|
||||
# tdSql.checkRows(0)
|
||||
# tdSql.execute("drop database if exists db")
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insertColumnsNum0.json -y " % binPath)
|
||||
# tdSql.execute("use db")
|
||||
# tdSql.query("show stables like 'stb0%' ")
|
||||
# tdSql.checkData(0, 2, 11)
|
||||
# tdSql.execute("drop database if exists db")
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insertTagsNumLarge128.json -y " % binPath)
|
||||
# tdSql.error("use db1")
|
||||
# tdSql.execute("drop database if exists db")
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar16384.json -y " % binPath)
|
||||
# tdSql.query("select count(*) from db.stb0")
|
||||
# tdSql.checkRows(1)
|
||||
# tdSql.query("select count(*) from db.stb1")
|
||||
# tdSql.checkRows(1)
|
||||
# tdSql.error("select * from db.stb3")
|
||||
# tdSql.error("select * from db.stb2")
|
||||
# tdSql.execute("drop database if exists db")
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y " % binPath)
|
||||
# tdSql.error("select count(*) from db.stb0")
|
||||
# tdSql.execute("drop database if exists db")
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json -y " % binPath)
|
||||
# tdSql.error("use db")
|
||||
# tdSql.execute("drop database if exists db")
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insertChildTab0.json -y " % binPath)
|
||||
# tdSql.error("use db")
|
||||
# tdSql.execute("drop database if exists db")
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insertChildTabLess0.json -y " % binPath)
|
||||
# tdSql.error("use db")
|
||||
# tdSql.execute("drop database if exists blf")
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json -y " % binPath)
|
||||
# tdSql.execute("use blf")
|
||||
# tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1")
|
||||
# tdSql.checkData(0, 0, "2020-03-31 12:00:00.000")
|
||||
# tdSql.query("select first(ts) from blf.p_0_topics_2")
|
||||
# tdSql.checkData(0, 0, "2019-10-01 00:00:00")
|
||||
# tdSql.query("select last(ts) from blf.p_0_topics_6 ")
|
||||
# tdSql.checkData(0, 0, "2020-09-29 23:59:00")
|
||||
tdSql.execute("drop database if exists db")
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNumLarge1024.json -y " % binPath)
|
||||
tdSql.error("use db")
|
||||
tdSql.execute("drop database if exists db")
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insertSigcolumnsNum1024.json -y " % binPath)
|
||||
tdSql.error("select * from db.stb0")
|
||||
tdSql.execute("drop database if exists db")
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNum1024.json -y " % binPath)
|
||||
tdSql.query("select count(*) from db.stb0")
|
||||
tdSql.checkData(0, 0, 10000)
|
||||
tdSql.execute("drop database if exists db")
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json -y " % binPath)
|
||||
tdSql.query("select count(*) from db.stb0")
|
||||
tdSql.checkRows(0)
|
||||
tdSql.execute("drop database if exists db")
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insertColumnsNum0.json -y " % binPath)
|
||||
tdSql.execute("use db")
|
||||
tdSql.query("show stables like 'stb0%' ")
|
||||
tdSql.checkData(0, 2, 11)
|
||||
tdSql.execute("drop database if exists db")
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insertTagsNumLarge128.json -y " % binPath)
|
||||
tdSql.error("use db1")
|
||||
tdSql.execute("drop database if exists db")
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar16384.json -y " % binPath)
|
||||
tdSql.query("select count(*) from db.stb0")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.query("select count(*) from db.stb1")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.error("select * from db.stb3")
|
||||
tdSql.error("select * from db.stb2")
|
||||
tdSql.execute("drop database if exists db")
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y " % binPath)
|
||||
tdSql.error("select count(*) from db.stb0")
|
||||
tdSql.execute("drop database if exists db")
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json -y " % binPath)
|
||||
tdSql.error("use db")
|
||||
tdSql.execute("drop database if exists db")
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insertChildTab0.json -y " % binPath)
|
||||
tdSql.error("use db")
|
||||
tdSql.execute("drop database if exists db")
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insertChildTabLess0.json -y " % binPath)
|
||||
tdSql.error("use db")
|
||||
tdSql.execute("drop database if exists blf")
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json -y " % binPath)
|
||||
tdSql.execute("use blf")
|
||||
tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1")
|
||||
tdSql.checkData(0, 0, "2020-03-31 12:00:00.000")
|
||||
tdSql.query("select first(ts) from blf.p_0_topics_2")
|
||||
tdSql.checkData(0, 0, "2019-10-01 00:00:00")
|
||||
tdSql.query("select last(ts) from blf.p_0_topics_6 ")
|
||||
tdSql.checkData(0, 0, "2020-09-29 23:59:00")
|
||||
|
||||
|
||||
|
||||
# # insert: timestamp and step
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insert-timestep.json -y " % binPath)
|
||||
# tdSql.execute("use db")
|
||||
# tdSql.query("show stables")
|
||||
# tdSql.query("select count (tbname) from stb0")
|
||||
# tdSql.checkData(0, 0, 10)
|
||||
# tdSql.query("select count (tbname) from stb1")
|
||||
# tdSql.checkData(0, 0, 20)
|
||||
# tdSql.query("select last(ts) from db.stb00_0")
|
||||
# tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000")
|
||||
# tdSql.query("select count(*) from stb0")
|
||||
# tdSql.checkData(0, 0, 200)
|
||||
# tdSql.query("select last(ts) from db.stb01_0")
|
||||
# tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000")
|
||||
# tdSql.query("select count(*) from stb1")
|
||||
# tdSql.checkData(0, 0, 400)
|
||||
# insert: timestamp and step
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insert-timestep.json -y " % binPath)
|
||||
tdSql.execute("use db")
|
||||
tdSql.query("show stables")
|
||||
tdSql.query("select count (tbname) from stb0")
|
||||
tdSql.checkData(0, 0, 10)
|
||||
tdSql.query("select count (tbname) from stb1")
|
||||
tdSql.checkData(0, 0, 20)
|
||||
tdSql.query("select last(ts) from db.stb00_0")
|
||||
tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000")
|
||||
tdSql.query("select count(*) from stb0")
|
||||
tdSql.checkData(0, 0, 200)
|
||||
tdSql.query("select last(ts) from db.stb01_0")
|
||||
tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000")
|
||||
tdSql.query("select count(*) from stb1")
|
||||
tdSql.checkData(0, 0, 400)
|
||||
|
||||
# # # insert: disorder_ratio
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insert-disorder.json -g 2>&1 -y " % binPath)
|
||||
# tdSql.execute("use db")
|
||||
# tdSql.query("select count (tbname) from stb0")
|
||||
# tdSql.checkData(0, 0, 1)
|
||||
# tdSql.query("select count (tbname) from stb1")
|
||||
# tdSql.checkData(0, 0, 1)
|
||||
# tdSql.query("select count(*) from stb0")
|
||||
# tdSql.checkData(0, 0, 10)
|
||||
# tdSql.query("select count(*) from stb1")
|
||||
# tdSql.checkData(0, 0, 10)
|
||||
# # insert: disorder_ratio
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insert-disorder.json -g 2>&1 -y " % binPath)
|
||||
tdSql.execute("use db")
|
||||
tdSql.query("select count (tbname) from stb0")
|
||||
tdSql.checkData(0, 0, 1)
|
||||
tdSql.query("select count (tbname) from stb1")
|
||||
tdSql.checkData(0, 0, 1)
|
||||
tdSql.query("select count(*) from stb0")
|
||||
tdSql.checkData(0, 0, 10)
|
||||
tdSql.query("select count(*) from stb1")
|
||||
tdSql.checkData(0, 0, 10)
|
||||
|
||||
# # insert: sample json
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insert-sample.json -y " % binPath)
|
||||
# tdSql.execute("use dbtest123")
|
||||
# tdSql.query("select col2 from stb0")
|
||||
# tdSql.checkData(0, 0, 2147483647)
|
||||
# tdSql.query("select t1 from stb1")
|
||||
# tdSql.checkData(0, 0, -127)
|
||||
# tdSql.query("select t2 from stb1")
|
||||
# tdSql.checkData(1, 0, 126)
|
||||
# insert: sample json
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insert-sample.json -y " % binPath)
|
||||
tdSql.execute("use dbtest123")
|
||||
tdSql.query("select col2 from stb0")
|
||||
tdSql.checkData(0, 0, 2147483647)
|
||||
tdSql.query("select t1 from stb1")
|
||||
tdSql.checkData(0, 0, -127)
|
||||
tdSql.query("select t2 from stb1")
|
||||
tdSql.checkData(1, 0, 126)
|
||||
|
||||
# # insert: test interlace parament
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/insert-interlace-row.json -y " % binPath)
|
||||
# tdSql.execute("use db")
|
||||
# tdSql.query("select count (tbname) from stb0")
|
||||
# tdSql.checkData(0, 0, 100)
|
||||
# tdSql.query("select count (*) from stb0")
|
||||
# tdSql.checkData(0, 0, 15000)
|
||||
# insert: test interlace parament
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/insert-interlace-row.json -y " % binPath)
|
||||
tdSql.execute("use db")
|
||||
tdSql.query("select count (tbname) from stb0")
|
||||
tdSql.checkData(0, 0, 100)
|
||||
tdSql.query("select count (*) from stb0")
|
||||
tdSql.checkData(0, 0, 15000)
|
||||
|
||||
|
||||
os.system("rm -rf ./insert_res.txt")
|
||||
|
|
|
@ -19,6 +19,9 @@ from util.sql import *
|
|||
from util.dnodes import *
|
||||
import time
|
||||
from datetime import datetime
|
||||
import ast
|
||||
# from assertpy import assert_that
|
||||
import subprocess
|
||||
|
||||
class TDTestCase:
|
||||
def init(self, conn, logSql):
|
||||
|
@ -40,7 +43,50 @@ class TDTestCase:
|
|||
buildPath = root[:len(root)-len("/build/bin")]
|
||||
break
|
||||
return buildPath
|
||||
|
||||
|
||||
# 获取taosc接口查询的结果文件中的内容,返回每行数据,并断言数据的第一列内容。
|
||||
def assertfileDataTaosc(self,filename,expectResult):
|
||||
self.filename = filename
|
||||
self.expectResult = expectResult
|
||||
with open("%s" % filename, 'r+') as f1:
|
||||
for line in f1.readlines():
|
||||
queryResult = line.strip().split()[0]
|
||||
self.assertCheck(filename,queryResult,expectResult)
|
||||
|
||||
# 获取restful接口查询的结果文件中的关键内容,目前的关键内容找到第一个key就跳出循,所以就只有一个数据。后续再修改多个结果文件。
|
||||
def getfileDataRestful(self,filename):
|
||||
self.filename = filename
|
||||
with open("%s" % filename, 'r+') as f1:
|
||||
for line in f1.readlines():
|
||||
contents = line.strip()
|
||||
if contents.find("data") != -1:
|
||||
contentsDict = ast.literal_eval(contents) # 字符串转换为字典
|
||||
queryResult = contentsDict['data'][0][0]
|
||||
break
|
||||
return queryResult
|
||||
|
||||
# 获取taosc接口查询次数
|
||||
def queryTimesTaosc(self,filename):
|
||||
self.filename = filename
|
||||
command = 'cat %s |wc -l'% filename
|
||||
times = int(subprocess.getstatusoutput(command)[1])
|
||||
return times
|
||||
|
||||
# 获取restful接口查询次数
|
||||
def queryTimesRestful(self,filename):
|
||||
self.filename = filename
|
||||
command = 'cat %s |grep "200 OK" |wc -l'% filename
|
||||
times = int(subprocess.getstatusoutput(command)[1])
|
||||
return times
|
||||
|
||||
# 定义断言结果是否正确。不正确返回错误结果,正确即通过。
|
||||
def assertCheck(self,filename,queryResult,expectResult):
|
||||
self.filename = filename
|
||||
self.queryResult = queryResult
|
||||
self.expectResult = expectResult
|
||||
args0 = (filename, queryResult, expectResult)
|
||||
assert queryResult == expectResult , "Queryfile:%s ,result is %s != expect: %s" % args0
|
||||
|
||||
def run(self):
|
||||
buildPath = self.getBuildPath()
|
||||
if (buildPath == ""):
|
||||
|
@ -50,102 +96,92 @@ class TDTestCase:
|
|||
binPath = buildPath+ "/build/bin/"
|
||||
|
||||
# delete useless files
|
||||
os.system("rm -rf ./insert_res.txt")
|
||||
os.system("rm -rf tools/taosdemoAllTest/*.py.sql")
|
||||
os.system("rm -rf ./querySystemInfo*")
|
||||
os.system("rm -rf ./query_res*")
|
||||
os.system("rm -rf ./all_query*")
|
||||
os.system("rm -rf ./test_query_res0.txt")
|
||||
|
||||
# # query: query specified table and query super table
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json" % binPath)
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/queryTaosc.json" % binPath)
|
||||
# os.system("cat query_res0.txt* |sort -u > all_query_res0.txt")
|
||||
# os.system("cat query_res1.txt* |sort -u > all_query_res1.txt")
|
||||
# os.system("cat query_res2.txt* |sort -u > all_query_res2.txt")
|
||||
# tdSql.execute("use db")
|
||||
# tdSql.execute('create table result0 using stb0 tags(121,43,"beijing","beijing","beijing","beijing","beijing")')
|
||||
# os.system("python3 tools/taosdemoAllTest/convertResFile.py")
|
||||
# tdSql.execute("insert into result0 file './test_query_res0.txt'")
|
||||
# tdSql.query("select ts from result0")
|
||||
# tdSql.checkData(0, 0, "2020-11-01 00:00:00.099000")
|
||||
# tdSql.query("select count(*) from result0")
|
||||
# tdSql.checkData(0, 0, 1)
|
||||
# with open('./all_query_res1.txt','r+') as f1:
|
||||
# result1 = int(f1.readline())
|
||||
# tdSql.query("select count(*) from stb00_1")
|
||||
# tdSql.checkData(0, 0, "%d" % result1)
|
||||
# taosc query: query specified table and query super table
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json" % binPath)
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/queryTaosc.json" % binPath)
|
||||
os.system("cat query_res0.txt* > all_query_res0_taosc.txt")
|
||||
os.system("cat query_res1.txt* > all_query_res1_taosc.txt")
|
||||
os.system("cat query_res2.txt* > all_query_res2_taosc.txt")
|
||||
|
||||
# correct Times testcases
|
||||
queryTimes0Taosc = self.queryTimesTaosc("all_query_res0_taosc.txt")
|
||||
self.assertCheck("all_query_res0_taosc.txt",queryTimes0Taosc,6)
|
||||
|
||||
# with open('./all_query_res2.txt','r+') as f2:
|
||||
# result2 = int(f2.readline())
|
||||
# d2 = datetime.fromtimestamp(result2/1000)
|
||||
# timest = d2.strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
# tdSql.query("select last_row(ts) from stb1")
|
||||
# tdSql.checkData(0, 0, "%s" % timest)
|
||||
queryTimes1Taosc = self.queryTimesTaosc("all_query_res1_taosc.txt")
|
||||
self.assertCheck("all_query_res1_taosc.txt",queryTimes1Taosc,6)
|
||||
|
||||
queryTimes2Taosc = self.queryTimesTaosc("all_query_res2_taosc.txt")
|
||||
self.assertCheck("all_query_res2_taosc.txt",queryTimes2Taosc,20)
|
||||
|
||||
# # delete useless files
|
||||
# os.system("rm -rf ./insert_res.txt")
|
||||
# os.system("rm -rf tools/taosdemoAllTest/*.py.sql")
|
||||
# os.system("rm -rf ./querySystemInfo*")
|
||||
# os.system("rm -rf ./query_res*")
|
||||
# os.system("rm -rf ./all_query*")
|
||||
# os.system("rm -rf ./test_query_res0.txt")
|
||||
# correct data testcase
|
||||
self.assertfileDataTaosc("all_query_res0_taosc.txt","1604160000099")
|
||||
self.assertfileDataTaosc("all_query_res1_taosc.txt","100")
|
||||
self.assertfileDataTaosc("all_query_res2_taosc.txt","1604160000199")
|
||||
|
||||
# delete useless files
|
||||
os.system("rm -rf ./query_res*")
|
||||
os.system("rm -rf ./all_query*")
|
||||
|
||||
|
||||
# use restful api to query
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json" % binPath)
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/queryInsertrestdata.json" % binPath)
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/queryRestful.json" % binPath)
|
||||
os.system("cat query_res0.txt* |sort -u > all_query_res0.txt")
|
||||
os.system("cat query_res1.txt* |sort -u > all_query_res1.txt")
|
||||
# os.system("cat query_res2.txt* |sort -u > all_query_res2.txt")
|
||||
tdSql.execute("use db")
|
||||
tdSql.execute('create table result0 using stb0 tags(121,43,"beijing","beijing","beijing","beijing","beijing")')
|
||||
os.system("python3 tools/taosdemoAllTest/convertResFile.py")
|
||||
tdSql.execute("insert into result0 file './test_query_res0.txt'")
|
||||
tdSql.query("select ts from result0")
|
||||
tdSql.checkData(0, 0, "2020-11-01 00:00:00.099000")
|
||||
tdSql.query("select count(*) from result0")
|
||||
tdSql.checkData(0, 0, 1)
|
||||
with open('./all_query_res1.txt','r+') as f1:
|
||||
result1 = int(f1.readline())
|
||||
tdSql.query("select count(*) from stb00_1")
|
||||
tdSql.checkData(0, 0, "%d" % result1)
|
||||
|
||||
with open('./all_query_res2.txt','r+') as f2:
|
||||
result2 = int(f2.readline())
|
||||
d2 = datetime.fromtimestamp(result2/1000)
|
||||
timest = d2.strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.query("select last_row(ts) from stb1")
|
||||
tdSql.checkData(0, 0, "%s" % timest)
|
||||
os.system("cat query_res0.txt* > all_query_res0_rest.txt")
|
||||
os.system("cat query_res1.txt* > all_query_res1_rest.txt")
|
||||
os.system("cat query_res2.txt* > all_query_res2_rest.txt")
|
||||
|
||||
# correct Times testcases
|
||||
queryTimes0Restful = self.queryTimesRestful("all_query_res0_rest.txt")
|
||||
self.assertCheck("all_query_res0_rest.txt",queryTimes0Restful,6)
|
||||
|
||||
queryTimes1Restful = self.queryTimesRestful("all_query_res1_rest.txt")
|
||||
self.assertCheck("all_query_res1_rest.txt",queryTimes1Restful,6)
|
||||
|
||||
# # query times less than or equal to 100
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json" % binPath)
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/querySpeciMutisql100.json" % binPath)
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/querySuperMutisql100.json" % binPath)
|
||||
queryTimes2Restful = self.queryTimesRestful("all_query_res2_rest.txt")
|
||||
self.assertCheck("all_query_res2_rest.txt",queryTimes2Restful,4)
|
||||
|
||||
# #query result print QPS
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/speciQueryInsertdata.json" % binPath)
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/queryQps.json" % binPath)
|
||||
# correct data testcase
|
||||
data0 = self.getfileDataRestful("all_query_res0_rest.txt")
|
||||
self.assertCheck('all_query_res0_rest.txt',data0,"2020-11-01 00:00:00.009")
|
||||
|
||||
# # use illegal or out of range parameters query json file
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/speciQueryInsertdata.json" % binPath)
|
||||
# exceptcode = os.system("%staosdemo -f tools/taosdemoAllTest/queryTimes0.json" % binPath)
|
||||
# assert exceptcode != 0
|
||||
# exceptcode0 = os.system("%staosdemo -f tools/taosdemoAllTest/queryTimesless0.json" % binPath)
|
||||
# assert exceptcode0 != 0
|
||||
# exceptcode1 = os.system("%staosdemo -f tools/taosdemoAllTest/queryConcurrentless0.json" % binPath)
|
||||
# assert exceptcode1 != 0
|
||||
# exceptcode2 = os.system("%staosdemo -f tools/taosdemoAllTest/queryConcurrent0.json" % binPath)
|
||||
# assert exceptcode2 != 0
|
||||
# exceptcode3 = os.system("%staosdemo -f tools/taosdemoAllTest/querrThreadsless0.json" % binPath)
|
||||
# assert exceptcode3 != 0
|
||||
# exceptcode4 = os.system("%staosdemo -f tools/taosdemoAllTest/querrThreads0.json" % binPath)
|
||||
# assert exceptcode4 != 0
|
||||
data1 = self.getfileDataRestful("all_query_res1_rest.txt")
|
||||
self.assertCheck('all_query_res1_rest.txt',data1,10)
|
||||
|
||||
data2 = self.getfileDataRestful("all_query_res2_rest.txt")
|
||||
self.assertCheck('all_query_res2_rest.txt',data2,"2020-11-01 00:00:00.004")
|
||||
|
||||
|
||||
# query times less than or equal to 100
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json" % binPath)
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/querySpeciMutisql100.json" % binPath)
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/querySuperMutisql100.json" % binPath)
|
||||
|
||||
#query result print QPS
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json" % binPath)
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/queryQps.json" % binPath)
|
||||
|
||||
# use illegal or out of range parameters query json file
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json" % binPath)
|
||||
exceptcode = os.system("%staosdemo -f tools/taosdemoAllTest/queryTimes0.json" % binPath)
|
||||
assert exceptcode != 0
|
||||
|
||||
exceptcode0 = os.system("%staosdemo -f tools/taosdemoAllTest/queryTimesless0.json" % binPath)
|
||||
assert exceptcode0 != 0
|
||||
|
||||
exceptcode1 = os.system("%staosdemo -f tools/taosdemoAllTest/queryConcurrentless0.json" % binPath)
|
||||
assert exceptcode1 != 0
|
||||
|
||||
exceptcode2 = os.system("%staosdemo -f tools/taosdemoAllTest/queryConcurrent0.json" % binPath)
|
||||
assert exceptcode2 != 0
|
||||
|
||||
exceptcode3 = os.system("%staosdemo -f tools/taosdemoAllTest/querrThreadsless0.json" % binPath)
|
||||
assert exceptcode3 != 0
|
||||
|
||||
exceptcode4 = os.system("%staosdemo -f tools/taosdemoAllTest/querrThreads0.json" % binPath)
|
||||
assert exceptcode4 != 0
|
||||
|
||||
# delete useless files
|
||||
os.system("rm -rf ./insert_res.txt")
|
||||
|
@ -154,6 +190,8 @@ class TDTestCase:
|
|||
os.system("rm -rf ./query_res*")
|
||||
os.system("rm -rf ./all_query*")
|
||||
os.system("rm -rf ./test_query_res0.txt")
|
||||
|
||||
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
|
|
|
@ -42,7 +42,21 @@ class TDTestCase:
|
|||
buildPath = root[:len(root)-len("/build/bin")]
|
||||
break
|
||||
return buildPath
|
||||
|
||||
|
||||
# 获取订阅次数
|
||||
def subTimes(self,filename):
|
||||
self.filename = filename
|
||||
command = 'cat %s |wc -l'% filename
|
||||
times = int(subprocess.getstatusoutput(command)[1])
|
||||
return times
|
||||
|
||||
def assertCheck(self,filename,queryResult,expectResult):
|
||||
self.filename = filename
|
||||
self.queryResult = queryResult
|
||||
self.expectResult = expectResult
|
||||
args0 = (filename, queryResult, expectResult)
|
||||
assert queryResult == expectResult , "Queryfile:%s ,result is %s != expect: %s" % args0
|
||||
|
||||
def run(self):
|
||||
buildPath = self.getBuildPath()
|
||||
if (buildPath == ""):
|
||||
|
@ -50,65 +64,54 @@ class TDTestCase:
|
|||
else:
|
||||
tdLog.info("taosd found in %s" % buildPath)
|
||||
binPath = buildPath+ "/build/bin/"
|
||||
|
||||
# query: query specified table and query super table
|
||||
|
||||
# clear env
|
||||
os.system("ps -ef |grep 'taosdemoAllTest/sub.json' |grep -v 'grep' |awk '{print $2}'|xargs kill -9")
|
||||
sleep(1)
|
||||
os.system("rm -rf ./subscribe_res*")
|
||||
os.system("rm -rf ./all_subscribe_res*")
|
||||
|
||||
# subscribe: resultfile
|
||||
os.system("%staosdemo -f tools/taosdemoAllTest/subInsertdata.json" % binPath)
|
||||
os.system("nohup %staosdemo -f tools/taosdemoAllTest/sub.json &" % binPath)
|
||||
query_pid = int(subprocess.getstatusoutput('ps aux|grep "taosdemoAllTest/sub.json" |grep -v "grep"|awk \'{print $2}\'')[1])
|
||||
query_pid = int(subprocess.getstatusoutput('ps aux|grep "taosdemoAllTest/sub.json" |grep -v "grep"|awk \'{print $2}\'')[1])
|
||||
|
||||
# insert extral data
|
||||
tdSql.execute("use db")
|
||||
tdSql.execute("insert into stb00_0 values(1614218412000,'R','bf3',8637,98.861045)")
|
||||
tdSql.execute("insert into stb00_1 values(1614218412000,'R','bf3',8637,78.861045)(1614218422000,'R','bf3',8637,98.861045)")
|
||||
sleep(5)
|
||||
sub0_0 = int(subprocess.getstatusoutput('cat subscribe_res0.txt-0 |wc -l')[1])
|
||||
assert sub0_0 == 11
|
||||
sub0_1 = int(subprocess.getstatusoutput('cat subscribe_res0.txt-1 |wc -l')[1])
|
||||
assert sub0_1 == 11
|
||||
sub1_0 = int(subprocess.getstatusoutput('cat subscribe_res1.txt-0 |wc -l')[1])
|
||||
assert sub1_0 == 12
|
||||
sub1_1 = int(subprocess.getstatusoutput('cat subscribe_res1.txt-1 |wc -l')[1])
|
||||
assert sub1_1 == 12
|
||||
# sub2_0 = int(subprocess.getstatusoutput('cat subscribe_res2.txt-0 |wc -l')[0])
|
||||
# assert sub2_0 == 10
|
||||
# sub2_1 = int(subprocess.getstatusoutput('cat subscribe_res2.txt-1 |wc -l')[0])
|
||||
# assert sub2_1 == 10
|
||||
# sub3_0 = int(subprocess.getstatusoutput('cat subscribe_res3.txt-0 |wc -l')[0])
|
||||
# assert sub3_0 == 7
|
||||
# sub3_1 = int(subprocess.getstatusoutput('cat subscribe_res3.txt-1 |wc -l')[0])
|
||||
# assert sub3_1 == 7
|
||||
sleep(1)
|
||||
os.system("kill -9 %d" % query_pid)
|
||||
|
||||
# tdSql.query("select ts from result0")
|
||||
# tdSql.checkData(0, 0, "2020-11-01 00:00:00.099000")
|
||||
# tdSql.query("select count(*) from result0")
|
||||
# tdSql.checkData(0, 0, 1)
|
||||
# with open('./all_query_res1.txt','r+') as f1:
|
||||
# result1 = int(f1.readline())
|
||||
# tdSql.query("select count(*) from stb00_1")
|
||||
# tdSql.checkData(0, 0, "%d" % result1)
|
||||
|
||||
# with open('./all_query_res2.txt','r+') as f2:
|
||||
# result2 = int(f2.readline())
|
||||
# d2 = datetime.fromtimestamp(result2/1000)
|
||||
# timest = d2.strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
# tdSql.query("select last_row(ts) from stb1")
|
||||
# tdSql.checkData(0, 0, "%s" % timest)
|
||||
|
||||
# merge result files
|
||||
os.system("cat subscribe_res0.txt* > all_subscribe_res0.txt")
|
||||
os.system("cat subscribe_res1.txt* > all_subscribe_res1.txt")
|
||||
os.system("cat subscribe_res2.txt* > all_subscribe_res2.txt")
|
||||
|
||||
# correct subscribeTimes testcase
|
||||
subTimes0 = self.subTimes("all_subscribe_res0.txt")
|
||||
self.assertCheck("all_subscribe_res0.txt",subTimes0 ,22)
|
||||
|
||||
subTimes1 = self.subTimes("all_subscribe_res1.txt")
|
||||
self.assertCheck("all_subscribe_res1.txt",subTimes1 ,24)
|
||||
|
||||
subTimes2 = self.subTimes("all_subscribe_res2.txt")
|
||||
self.assertCheck("all_subscribe_res2.txt",subTimes2 ,21)
|
||||
|
||||
# correct data testcase
|
||||
|
||||
os.system("kill -9 %d" % query_pid)
|
||||
|
||||
# # query times less than or equal to 100
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/QuerySpeciMutisql100.json" % binPath)
|
||||
# os.system("%staosdemo -f tools/taosdemoAllTest/QuerySuperMutisql100.json" % binPath)
|
||||
|
||||
|
||||
|
||||
|
||||
# delete useless files
|
||||
os.system("rm -rf ./insert_res.txt")
|
||||
os.system("rm -rf tools/taosdemoAllTest/*.py.sql")
|
||||
os.system("rm -rf ./querySystemInfo*")
|
||||
os.system("rm -rf ./subscribe_res*")
|
||||
# os.system("rm -rf ./all_query*")
|
||||
# os.system("rm -rf ./test_query_res0.txt")
|
||||
os.system("rm -rf ./all_subscribe*")
|
||||
os.system("rm -rf ./test_query_res0.txt")
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
|
|
Loading…
Reference in New Issue