From a2f64ab8588c8d007aef3ad1c3d676db035d882e Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 25 Feb 2025 16:55:10 +0800 Subject: [PATCH] fix: ws can not support varbinary and geometry --- .../taosdump/native/json/insertFullType.json | 8 +-- .../taosdump/native/json/insertOther.json | 70 +++++++++++++++++++ .../taosdump/native/taosdumpCommandline.py | 35 +++++++--- 3 files changed, 96 insertions(+), 17 deletions(-) create mode 100644 tests/army/tools/taosdump/native/json/insertOther.json diff --git a/tests/army/tools/taosdump/native/json/insertFullType.json b/tests/army/tools/taosdump/native/json/insertFullType.json index 5bdecef72b..a121670c37 100644 --- a/tests/army/tools/taosdump/native/json/insertFullType.json +++ b/tests/army/tools/taosdump/native/json/insertFullType.json @@ -41,9 +41,7 @@ { "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} + { "type": "varchar", "name": "vac", "len": 8} ], "tags":[ { "type": "bool", "name": "tbc"}, @@ -59,9 +57,7 @@ { "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} + { "type": "varchar", "name": "tvac", "len": 8} ] } ] diff --git a/tests/army/tools/taosdump/native/json/insertOther.json b/tests/army/tools/taosdump/native/json/insertOther.json new file mode 100644 index 0000000000..bd6bb12bec --- /dev/null +++ b/tests/army/tools/taosdump/native/json/insertOther.json @@ -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":"testother", + "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} + ] + } + ] + } + ] +} diff --git a/tests/army/tools/taosdump/native/taosdumpCommandline.py b/tests/army/tools/taosdump/native/taosdumpCommandline.py index f475d0eb63..c43ea0e9e7 100644 --- a/tests/army/tools/taosdump/native/taosdumpCommandline.py +++ b/tests/army/tools/taosdump/native/taosdumpCommandline.py @@ -121,7 +121,6 @@ class TDTestCase(TBase): else: tdLog.exit(f"{aggfun} source db:{sum1} import db:{sum2} not equal.") - def verifyResult(self, db, newdb, json): # compare with insert json self.checkCorrectWithJson(json, newdb) @@ -129,7 +128,6 @@ class TDTestCase(TBase): # compare sum(pk) stb = "meters" self.checkSame(db, newdb, stb, "sum(fc)") - self.checkSame(db, newdb, stb, "avg(dc)") self.checkSame(db, newdb, stb, "sum(ti)") self.checkSame(db, newdb, stb, "sum(si)") self.checkSame(db, newdb, stb, "sum(ic)") @@ -160,7 +158,7 @@ class TDTestCase(TBase): 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: 205 row(s) dumped out!"]], + [f"-h 127.0.0.1 -P 6030 -uroot -ptaosdata -A -N -o {tmpdir}", ["OK: Database test dumped"]], [f"-r result -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: 205 row(s) dumped out!"]], [f"-L -D test -o {tmpdir}", ["OK: Database test dumped", "OK: 205 row(s) dumped out!"]], @@ -179,13 +177,14 @@ class TDTestCase(TBase): # executes for item in checkItems: + self.clearPath(tmpdir) command = item[0] results = item[1] rlist = self.taosdump(command) for result in results: self.checkListString(rlist, result) # clear tmp - self.clearPath(tmpdir) + # check except def checkExcept(self, command): @@ -224,19 +223,33 @@ class TDTestCase(TBase): # insert data with taosBenchmark db, stb, childCount, insertRows = self.insertData(json) - newdb = "new" + db - - # basic commandline - self.basicCommandLine(tmpdir) - - # except commandline - self.exceptCommandLine(taosdump, db, stb, tmpdir) # dumpInOut modes = ["", "-R" , "--cloud=http://localhost:6041"] for mode in modes: self.dumpInOutMode(mode, db , json, tmpdir) + tdLog.info("1. native rest ws dumpIn Out .......................... [Passed]") + + # basic commandline + self.basicCommandLine(tmpdir) + tdLog.info("2. basic command line .................................. [Passed]") + + # except commandline + self.exceptCommandLine(taosdump, db, stb, tmpdir) + tdLog.info("3. except command line ................................. [Passed]") + + # + # varbinary and geometry for native + # + json = "./tools/taosdump/native/json/insertOther.json" + # insert + db, stb, childCount, insertRows = self.insertData(json) + # dump in/out + self.dumpInOutMode("", db , json, tmpdir) + tdLog.info("4. native varbinary geometry ........................... [Passed]") + + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__)