fix: commandline.py for taosdump
This commit is contained in:
parent
50e88765b5
commit
100aa30eab
|
@ -282,8 +282,13 @@ class TBase:
|
|||
#
|
||||
# run bin file
|
||||
#
|
||||
def taos(self, command, show = True):
|
||||
return frame.etool.runBinFile("taos", command, show)
|
||||
# taos
|
||||
def taos(self, command, show = True, checkRun = False):
|
||||
return frame.etool.runBinFile("taos", command, show, checkRun)
|
||||
|
||||
def taosdump(self, command, show = True, checkRun = True):
|
||||
return frame.etool.runBinFile("taosdump", command, show, checkRun)
|
||||
|
||||
|
||||
#
|
||||
# util
|
||||
|
@ -420,7 +425,7 @@ class TBase:
|
|||
if vgroups != None:
|
||||
tdSql.checkData(0, 0, vgroups)
|
||||
|
||||
return db, stb,child_count, insert_rows
|
||||
return db, stb, child_count, insert_rows
|
||||
|
||||
|
||||
# tmq
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
"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": 2,
|
||||
"insert_rows":100,
|
||||
"timestamp_step":1000,
|
||||
"start_timestamp":"2022-10-01 00:00:00.000",
|
||||
"columns":[
|
||||
{ "type": "bool", "name": "bc"},
|
||||
{ "type": "float", "name": "fc", "max": 1, "min": 0 },
|
||||
{ "type": "double", "name": "dc", "max": 10, "min": 0 },
|
||||
{ "type": "tinyint", "name": "ti", "max": 100, "min": -100 },
|
||||
{ "type": "smallint", "name": "si", "max": 100, "min": -50 },
|
||||
{ "type": "int", "name": "ic", "max": 1000, "min": -1000 },
|
||||
{ "type": "bigint", "name": "bi", "max": 100, "min": -1000 },
|
||||
{ "type": "utinyint", "name": "uti", "max": 100, "min": 0 },
|
||||
{ "type": "usmallint", "name": "usi", "max": 100, "min": 0 },
|
||||
{ "type": "uint", "name": "ui", "max": 1000, "min": 0 },
|
||||
{ "type": "ubigint", "name": "ubi", "max": 10000, "min": 0 },
|
||||
{ "type": "binary", "name": "bin", "len": 4},
|
||||
{ "type": "nchar", "name": "nch", "len": 8},
|
||||
{ "type": "varbinary", "name": "vab", "len": 8},
|
||||
{ "type": "varchar", "name": "vac", "len": 8},
|
||||
{ "type": "geometry", "name": "geo", "len": 32}
|
||||
],
|
||||
"tags":[
|
||||
{ "type": "bool", "name": "tbc"},
|
||||
{ "type": "float", "name": "tfc", "max": 1, "min": 0 },
|
||||
{ "type": "double", "name": "tdc", "max": 10, "min": 0 },
|
||||
{ "type": "tinyint", "name": "tti", "max": 100, "min": -100 },
|
||||
{ "type": "smallint", "name": "tsi", "max": 100, "min": -50 },
|
||||
{ "type": "int", "name": "tic", "max": 1000, "min": -1000 },
|
||||
{ "type": "bigint", "name": "tbi", "max": 100, "min": -1000 },
|
||||
{ "type": "utinyint", "name": "tuti", "max": 100, "min": 0 },
|
||||
{ "type": "usmallint", "name": "tusi", "max": 100, "min": 0 },
|
||||
{ "type": "uint", "name": "tui", "max": 1000, "min": 0 },
|
||||
{ "type": "ubigint", "name": "tubi", "max": 10000, "min": 0 },
|
||||
{ "type": "binary", "name": "tbin", "len": 4},
|
||||
{ "type": "nchar", "name": "tnch", "len": 8},
|
||||
{ "type": "varbinary", "name": "tvab", "len": 8},
|
||||
{ "type": "varchar", "name": "tvac", "len": 8},
|
||||
{ "type": "geometry", "name": "tgeo", "len": 32}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -97,9 +97,9 @@ class TDTestCase(TBase):
|
|||
self.exec(cmd)
|
||||
self.checkCorrectWithJson(jsonFile)
|
||||
|
||||
def insertData(self, benchmark, json, db):
|
||||
def insertData(self, json):
|
||||
# insert super table
|
||||
self.testBenchmarkJson(benchmark, json)
|
||||
db, stb, child_count, insert_rows = self.insertBenchJson(json)
|
||||
|
||||
# normal table
|
||||
sqls = [
|
||||
|
@ -113,6 +113,8 @@ class TDTestCase(TBase):
|
|||
for sql in sqls:
|
||||
tdSql.execute(sql)
|
||||
|
||||
return db, stb, child_count, insert_rows
|
||||
|
||||
def dumpOut(self, taosdump, db , outdir):
|
||||
# dump out
|
||||
self.exec(f"{taosdump} -D {db} -o {outdir}")
|
||||
|
@ -152,9 +154,34 @@ class TDTestCase(TBase):
|
|||
|
||||
|
||||
# basic commandline
|
||||
def basicCommandLine(self, taosdump, tmpdir):
|
||||
# -h -P -u -p -o
|
||||
self.exec(taosdump + f" -h 127.0.0.1 -P 6030 -uroot -ptaosdata -A -N -o {tmpdir}")
|
||||
def basicCommandLine(self, tmpdir):
|
||||
#command and check result
|
||||
checkItems = [
|
||||
f"-h 127.0.0.1 -P 6030 -uroot -ptaosdata -A -N -o {tmpdir}", ["OK: Database test dumped", "OK: 200 row(s) dumped out!"],
|
||||
f"-r result -gg -a -e test d0 -o {tmpdir}", ["OK: table: d0 dumped", "OK: 100 row(s) dumped out!"],
|
||||
f"-n -D test -o {tmpdir}", ["OK: Database test dumped", "OK: 200 row(s) dumped out!"],
|
||||
f"-L -D test -o {tmpdir}", ["OK: Database test dumped", "OK: 200 row(s) dumped out!"],
|
||||
f"-s -D test -o {tmpdir}", ["dumping out schema: 1 from meters.d0", "OK: Database test dumped", "OK: 0 row(s) dumped out!"],
|
||||
f"-N -d deflate -S '2022-10-01 00:00:50.000' test meters -o {tmpdir}",["OK: table: meters dumped", "OK: 100 row(s) dumped out!"],
|
||||
f"-N -d lzma -S '2022-10-01 00:00:50.000' test meters -o {tmpdir}",["OK: table: meters dumped", "OK: 100 row(s) dumped out!"],
|
||||
f"-N -d snappy -S '2022-10-01 00:00:50.000' test meters -o {tmpdir}",["OK: table: meters dumped", "OK: 100 row(s) dumped out!"],
|
||||
f" -S '2022-10-01 00:00:50.000' -E '2022-10-01 00:00:60.000' test meters -o {tmpdir}",["OK: table: meters dumped", "OK: 100 row(s) dumped out!"],
|
||||
f"-T 2 -B 1000 -S '2022-10-01 00:00:50.000' -E '2022-10-01 00:00:60.000' test meters -o {tmpdir}", ["OK: table: meters dumped", "OK: 22 row(s) dumped out!"],
|
||||
f"-g -E '2022-10-01 00:00:60.000' test -o {tmpdir}", ["OK: Database test dumped", "OK: 122 row(s) dumped out!"],
|
||||
f"--help", ["Report bugs to"],
|
||||
f"-?", ["Report bugs to"],
|
||||
f"-V", ["version:"],
|
||||
f"--usage", ["taosdump [OPTION...] -o outpath"]
|
||||
]
|
||||
|
||||
# executes
|
||||
for item in checkItems:
|
||||
command = item[0]
|
||||
results = item[1]
|
||||
rlist = self.taosdump(command)
|
||||
for result in results:
|
||||
self.checkListString(result)
|
||||
# clear tmp
|
||||
self.clearPath(tmpdir)
|
||||
|
||||
# check except
|
||||
|
@ -178,28 +205,29 @@ class TDTestCase(TBase):
|
|||
self.checkExcept(taosdump + " -A -o ")
|
||||
self.checkExcept(taosdump + " -A -o ./noexistpath/")
|
||||
self.checkExcept(taosdump + f" -d invalidAVRO -o {tmpdir}")
|
||||
self.checkExcept(taosdump + f" -d unknown -o {tmpdir}")
|
||||
self.checkExcept(taosdump + f" -P invalidport")
|
||||
self.checkExcept(taosdump + f" -D")
|
||||
self.checkExcept(taosdump + f" -P 65536")
|
||||
self.checkExcept(taosdump + f" -t 2 -k 2 -z 1 -C https://not-exist.com:80/cloud -D test -o {tmpdir}")
|
||||
self.checkExcept(taosdump + f" -P 65536")
|
||||
|
||||
# run
|
||||
def run(self):
|
||||
# database
|
||||
db = "pridb"
|
||||
newdb = "npridb"
|
||||
|
||||
# find
|
||||
taosdump, benchmark, tmpdir = self.findPrograme()
|
||||
json = "./tools/taosdump/ws/json/primaryKey.json"
|
||||
json = "./tools/taosdump/native/json/insertFullType.json"
|
||||
|
||||
# insert data with taosBenchmark
|
||||
self.insertData(benchmark, json, db)
|
||||
db, stb, child_count, insert_rows = self.insertData(benchmark, json)
|
||||
newdb = "new" + db
|
||||
|
||||
# basic commandline
|
||||
self.basicCommandLine(taosdump, tmpdir)
|
||||
self.basicCommandLine(db, stb, tmpdir)
|
||||
|
||||
# except commandline
|
||||
self.exceptCommandLine(taosdump, tmpdir)
|
||||
self.exceptCommandLine(db, stb, tmpdir)
|
||||
|
||||
# dump out
|
||||
#self.dumpOut(taosdump, db, tmpdir)
|
||||
|
|
Loading…
Reference in New Issue