enh: add case to describe
This commit is contained in:
parent
7e8ef8ed98
commit
152d945f3c
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"filetype":"insert",
|
||||
"cfgdir":"/etc/taos",
|
||||
"host":"127.0.0.1",
|
||||
"port":6030,
|
||||
"user":"root",
|
||||
"password":"taosdata",
|
||||
"thread_count":1,
|
||||
"create_table_thread_count":1,
|
||||
"confirm_parameter_prompt":"no",
|
||||
"prepare_rand":100,
|
||||
"num_of_records_per_req":100,
|
||||
"databases": [
|
||||
{
|
||||
"dbinfo":{
|
||||
"name":"test",
|
||||
"drop":"yes"
|
||||
},
|
||||
"super_tables":[
|
||||
{
|
||||
"name":"meters",
|
||||
"child_table_exists":"no",
|
||||
"childtable_prefix":"d",
|
||||
"data_source":"rand",
|
||||
"insert_mode":"taosc",
|
||||
"childtable_count": 1,
|
||||
"insert_rows":10,
|
||||
"timestamp_step":1000,
|
||||
"start_timestamp":"2022-10-01 00:00:00.000",
|
||||
"columns":[
|
||||
{ "type": "int", "count": 1000, "max": 2000, "min": 0 }
|
||||
],
|
||||
"tags":[
|
||||
{
|
||||
"type":"binary",
|
||||
"name":"location",
|
||||
"max":64,
|
||||
"min":1,
|
||||
"values":[
|
||||
"San Francisco",
|
||||
"Los Angles",
|
||||
"San Diego",
|
||||
"San Jose",
|
||||
"Palo Alto",
|
||||
"Campbell",
|
||||
"Mountain View",
|
||||
"Sunnyvale",
|
||||
"Santa Clara",
|
||||
"Cupertino"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
###################################################################
|
||||
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is proprietary and confidential to TAOS Technologies.
|
||||
# No part of this file may be reproduced, stored, transmitted,
|
||||
# disclosed or used in any form or by any means other than as
|
||||
# expressly provided by the written permission from Jianhui Tao
|
||||
#
|
||||
###################################################################
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import time
|
||||
import random
|
||||
|
||||
import frame.eos
|
||||
import frame.etime
|
||||
import frame.etool
|
||||
import frame.etool
|
||||
import frame.etool
|
||||
import frame.etool
|
||||
import taos
|
||||
import frame.etool
|
||||
import frame
|
||||
|
||||
from frame.log import *
|
||||
from frame.sql import *
|
||||
from frame.cases import *
|
||||
from frame.caseBase import *
|
||||
from frame.srvCtl import *
|
||||
from frame import *
|
||||
|
||||
|
||||
class TDTestCase(TBase):
|
||||
updatecfgDict = {
|
||||
'slowLogScope':"query"
|
||||
}
|
||||
|
||||
def checkDescribe(self):
|
||||
tdLog.info(f"check describe show full.")
|
||||
|
||||
# insert
|
||||
json = "cmdline/json/taosCli.json"
|
||||
db, stb, childCount, insertRows = self.insertBenchJson(json)
|
||||
sql = f"describe {db}.{stb};"
|
||||
# check result
|
||||
tdSql.query(sql)
|
||||
tdSql.checkRows(2 + 1000)
|
||||
|
||||
# run
|
||||
def run(self):
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
|
||||
# check show whole
|
||||
self.checkDescribe()
|
||||
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
||||
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
|
@ -17,9 +17,13 @@ import time
|
|||
import datetime
|
||||
import random
|
||||
import copy
|
||||
import json
|
||||
|
||||
import frame.eutil
|
||||
from frame.log import *
|
||||
from frame.sql import *
|
||||
from frame import *
|
||||
import frame
|
||||
|
||||
# test case base
|
||||
class TBase:
|
||||
|
@ -305,4 +309,77 @@ class TBase:
|
|||
if strs != "":
|
||||
strs += sepa
|
||||
strs += f"'{ls}'"
|
||||
return strs
|
||||
return strs
|
||||
|
||||
#
|
||||
# taosBenchmark
|
||||
#
|
||||
|
||||
# run taosBenchmark and check insert Result
|
||||
def insertBenchJson(self, jsonFile, options="", checkStep=False):
|
||||
# exe insert
|
||||
cmd = f"{options} -f {jsonFile}"
|
||||
frame.etool.benchMark(command = cmd)
|
||||
|
||||
#
|
||||
# check insert result
|
||||
#
|
||||
with open(jsonFile, "r") as file:
|
||||
data = json.load(file)
|
||||
|
||||
db = data["databases"][0]["dbinfo"]["name"]
|
||||
stb = data["databases"][0]["super_tables"][0]["name"]
|
||||
child_count = data["databases"][0]["super_tables"][0]["childtable_count"]
|
||||
insert_rows = data["databases"][0]["super_tables"][0]["insert_rows"]
|
||||
timestamp_step = data["databases"][0]["super_tables"][0]["timestamp_step"]
|
||||
|
||||
# drop
|
||||
try:
|
||||
drop = data["databases"][0]["dbinfo"]["drop"]
|
||||
except:
|
||||
drop = "yes"
|
||||
|
||||
# command is first
|
||||
if options.find("-Q") != -1:
|
||||
drop = "no"
|
||||
|
||||
# cachemodel
|
||||
try:
|
||||
cachemode = data["databases"][0]["dbinfo"]["cachemodel"]
|
||||
except:
|
||||
cachemode = None
|
||||
|
||||
# vgropus
|
||||
try:
|
||||
vgroups = data["databases"][0]["dbinfo"]["vgroups"]
|
||||
except:
|
||||
vgroups = None
|
||||
|
||||
tdLog.info(f"get json info: db={db} stb={stb} child_count={child_count} insert_rows={insert_rows} \n")
|
||||
|
||||
# all count insert_rows * child_table_count
|
||||
sql = f"select * from {db}.{stb}"
|
||||
tdSql.query(sql)
|
||||
tdSql.checkRows(child_count * insert_rows)
|
||||
|
||||
# timestamp step
|
||||
if checkStep:
|
||||
sql = f"select * from (select diff(ts) as dif from {db}.{stb} partition by tbname) where dif != {timestamp_step};"
|
||||
tdSql.query(sql)
|
||||
tdSql.checkRows(0)
|
||||
|
||||
if drop.lower() == "yes":
|
||||
# check database optins
|
||||
sql = f"select `vgroups`,`cachemodel` from information_schema.ins_databases where name='{db}';"
|
||||
tdSql.query(sql)
|
||||
|
||||
if cachemode != None:
|
||||
|
||||
value = frame.eutil.removeQuota(cachemode)
|
||||
tdLog.info(f" deal both origin={cachemode} after={value}")
|
||||
tdSql.checkData(0, 1, value)
|
||||
|
||||
if vgroups != None:
|
||||
tdSql.checkData(0, 0, vgroups)
|
||||
|
||||
return db, stb,child_count, insert_rows
|
|
@ -25,4 +25,13 @@ import psutil
|
|||
# cpu frequent as random
|
||||
def cpuRand(max):
|
||||
decimal = int(str(psutil.cpu_freq().current).split(".")[1])
|
||||
return decimal % max
|
||||
return decimal % max
|
||||
|
||||
# remove single and doulbe quotation
|
||||
def removeQuota(origin):
|
||||
value = ""
|
||||
for c in origin:
|
||||
if c != '\'' and c != '"':
|
||||
value += c
|
||||
|
||||
return value
|
Loading…
Reference in New Issue