Merge pull request #23502 from taosdata/test/3.0/TD-27005

test:add testcase of the same ts data
This commit is contained in:
Alex Duan 2023-11-02 11:18:17 +08:00 committed by GitHub
commit 1db837ac77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 253 additions and 0 deletions

View File

@ -0,0 +1,91 @@
{
"filetype": "insert",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"connection_pool_size": 8,
"thread_count": 100,
"create_table_thread_count": 7,
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 0,
"interlace_rows": 100,
"num_of_records_per_req": 100,
"prepared_rand": 10000,
"chinese": "no",
"databases": [
{
"dbinfo": {
"name": "db",
"drop": "yes",
"replica": 1,
"precision": "ms",
"vgroups": 1,
"duration": "1d",
"keep": 3650,
"minRows": 100,
"maxRows": 200,
"STT_TRIGGER": 1,
"comp": 2
},
"super_tables": [
{
"name": "meters",
"child_table_exists": "no",
"childtable_count": 1,
"childtable_prefix": "d",
"escape_character": "yes",
"auto_create_table": "no",
"batch_create_tbl_num": 5,
"data_source": "rand",
"insert_mode": "taosc",
"non_stop_mode": "no",
"line_protocol": "line",
"insert_rows": 10000,
"childtable_limit": 0,
"childtable_offset": 100,
"interlace_rows": 0,
"insert_interval": 0,
"partial_col_num": 0,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1000,
"start_timestamp": "2021-10-02 00:01:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"use_sample_ts": "no",
"tags_file": "",
"columns": [
{
"type": "FLOAT",
"name": "current",
"count": 1,
"max": 12,
"min": 8
},
{ "type": "INT", "name": "voltage", "max": 225, "min": 215 },
{ "type": "FLOAT", "name": "phase", "max": 1, "min": 0 }
],
"tags": [
{
"type": "INT",
"name": "groupid",
"max": -10000,
"min": 10000
},
{
"name": "location",
"type": "BINARY",
"len": 16,
"values": ["San Francisco", "Los Angles", "San Diego",
"San Jose", "Palo Alto", "Campbell", "Mountain View",
"Sunnyvale", "Santa Clara", "Cupertino"]
}
]
}
]
}
]
}

View File

@ -0,0 +1,91 @@
{
"filetype": "insert",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"connection_pool_size": 8,
"thread_count": 100,
"create_table_thread_count": 7,
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 0,
"interlace_rows": 100,
"num_of_records_per_req": 100,
"prepared_rand": 10000,
"chinese": "no",
"databases": [
{
"dbinfo": {
"name": "db",
"drop": "no",
"replica": 1,
"precision": "ms",
"vgroups": 1,
"duration": "1d",
"keep": 3650,
"minRows": 100,
"maxRows": 200,
"STT_TRIGGER": 1,
"comp": 2
},
"super_tables": [
{
"name": "meters",
"child_table_exists": "yes",
"childtable_count": 1,
"childtable_prefix": "d",
"escape_character": "yes",
"auto_create_table": "no",
"batch_create_tbl_num": 5,
"data_source": "rand",
"insert_mode": "taosc",
"non_stop_mode": "no",
"line_protocol": "line",
"insert_rows": 4,
"childtable_limit": 0,
"childtable_offset": 100,
"interlace_rows": 0,
"insert_interval": 0,
"partial_col_num": 0,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 3600000,
"start_timestamp": "2021-10-02 00:00:00.001",
"sample_format": "csv",
"sample_file": "./sample.csv",
"use_sample_ts": "no",
"tags_file": "",
"columns": [
{
"type": "FLOAT",
"name": "current",
"count": 1,
"max": 12,
"min": 8
},
{ "type": "INT", "name": "voltage", "max": 225, "min": 215 },
{ "type": "FLOAT", "name": "phase", "max": 1, "min": 0 }
],
"tags": [
{
"type": "INT",
"name": "groupid",
"max": -10000,
"min": 10000
},
{
"name": "location",
"type": "BINARY",
"len": 16,
"values": ["San Francisco", "Los Angles", "San Diego",
"San Jose", "Palo Alto", "Campbell", "Mountain View",
"Sunnyvale", "Santa Clara", "Cupertino"]
}
]
}
]
}
]
}

View File

@ -0,0 +1,71 @@
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import time
from datetime import datetime
class TDTestCase:
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
self.rowNum = 10
self.ts = 1537146000000
def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
binPath = self.getPath()
tdLog.debug("insert full data block and flush db")
os.system(f"{binPath} -f ./2-query/megeFileSttQuery.json")
tdSql.execute("flush database db;")
tdLog.debug("insert disorder data and flush db")
os.system(f"{binPath} -f ./2-query/megeFileSttQueryUpdate.json")
tdSql.execute("flush database db;")
tdLog.debug("check data")
tdSql.query("select ts from db.d0 limit 5;")
tdSql.checkData(0, 0, '2021-10-02 00:00:00.001')
tdSql.checkData(1, 0, '2021-10-02 00:01:00.000')
tdLog.debug("update disorder data and flush db")
os.system(f"{binPath} -f ./2-query/megeFileSttQueryUpdate.json")
tdSql.query("select ts from db.d0 limit 5;")
tdSql.checkData(0, 0, '2021-10-02 00:00:00.001')
tdSql.checkData(1, 0, '2021-10-02 00:01:00.000')
tdSql.execute("flush database db;")
tdSql.query("select ts from db.d0 limit 5;")
tdSql.checkData(0, 0, '2021-10-02 00:00:00.001')
tdSql.checkData(1, 0, '2021-10-02 00:01:00.000')
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())