From 32cbaa25a8c7c8f6897e5996a8b989784ee6871f Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Thu, 3 Nov 2022 17:48:16 +0800 Subject: [PATCH] test:add parameter for mixed deployed mnodes in testcase framework --- tests/pytest/util/cluster.py | 11 ++- tests/system-test/0-others/compa4096.json | 77 +++++++++++++++++++ tests/system-test/0-others/compatibility.py | 10 ++- .../6-cluster/5dnode3mnodeAdd1Ddnoe.py | 12 ++- .../6-cluster/5dnode3mnodeRecreateMnode.py | 13 ++-- .../5dnode3mnodeRestartDnodeInsertData.py | 13 ++-- ...5dnode3mnodeRestartDnodeInsertDataAsync.py | 13 ++-- .../5dnode3mnodeSep1VnodeStopDnodeCreateDb.py | 12 +-- ...5dnode3mnodeSep1VnodeStopDnodeCreateStb.py | 12 +-- ...dnode3mnodeSep1VnodeStopDnodeInsertData.py | 12 +-- .../5dnode3mnodeSep1VnodeStopMnodeCreateDb.py | 14 +--- ...ode3mnodeSep1VnodeStopMnodeCreateDbRep3.py | 12 +-- ...5dnode3mnodeSep1VnodeStopMnodeCreateStb.py | 12 +-- .../5dnode3mnodeSep1VnodeStopVnodeCreateDb.py | 12 +-- ...5dnode3mnodeSep1VnodeStopVnodeCreateStb.py | 12 +-- .../system-test/6-cluster/5dnode3mnodeStop.py | 17 ++-- .../6-cluster/5dnode3mnodeStop2Follower.py | 9 +-- .../6-cluster/5dnode3mnodeStopConnect.py | 14 ++-- .../5dnode3mnodeStopFollowerLeader.py | 14 ++-- .../6-cluster/5dnode3mnodeStopLoop.py | 10 +-- tests/system-test/test.py | 17 +++- 21 files changed, 185 insertions(+), 143 deletions(-) create mode 100644 tests/system-test/0-others/compa4096.json diff --git a/tests/pytest/util/cluster.py b/tests/pytest/util/cluster.py index 2b9af8de25..72b7e1fddf 100644 --- a/tests/pytest/util/cluster.py +++ b/tests/pytest/util/cluster.py @@ -36,7 +36,7 @@ class ConfigureyCluster: self.portStep = 100 self.mnodeNums = 0 - def configure_cluster(self ,dnodeNums=5,mnodeNums=0,startPort=6030,portStep=100,hostname="%s"%hostname): + def configure_cluster(self ,dnodeNums=5,mnodeNums=0,independentMnode=True,startPort=6030,portStep=100,hostname="%s"%hostname): self.startPort=int(startPort) self.portStep=int(portStep) self.hostname=hostname @@ -52,7 +52,7 @@ class ConfigureyCluster: dnode.addExtraCfg("secondEp", f"{hostname}:{startPort_sec}") # configure dnoe of independent mnodes - if num <= self.mnodeNums and self.mnodeNums != 0 : + if num <= self.mnodeNums and self.mnodeNums != 0 and independentMnode == True : dnode.addExtraCfg("supportVnodes", 0) # print(dnode) self.dnodes.append(dnode) @@ -67,6 +67,13 @@ class ConfigureyCluster: tdSql.execute(" create dnode '%s';"%dnode_id) + def create_mnode(self,conn,mnodeNums): + tdSql.init(conn.cursor()) + mnodeNums=int(mnodeNums) + for i in range(2,mnodeNums+1): + tdSql.execute(" create mnode on dnode %d;"%i) + + def check_dnode(self,conn): tdSql.init(conn.cursor()) diff --git a/tests/system-test/0-others/compa4096.json b/tests/system-test/0-others/compa4096.json new file mode 100644 index 0000000000..85b63ed35f --- /dev/null +++ b/tests/system-test/0-others/compa4096.json @@ -0,0 +1,77 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "localhost", + "port": 6030, + "rest_port": 6041, + "user": "root", + "password": "taosdata", + "thread_count": 100, + "create_table_thread_count": 24, + "result_file": "taosBenchmark_result.log", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "num_of_records_per_req": 100, + "max_sql_len": 1024000, + "databases": [ + { + "dbinfo": { + "name": "taosc_sql", + "drop": "yes", + "replica": 1, + "duration": 10, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp": 2, + "vgroups": 30 + }, + "super_tables": [ + { + "name": "stb0", + "child_table_exists": "no", + "childtable_count": 100, + "childtable_prefix": "ctb0", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 500, + "data_source": "rand", + "insert_mode": "taosc", + "rollup": null, + "interlace_rows": 0, + "line_protocol": null, + "tcp_transfer": "no", + "insert_rows": 10000, + "childtable_limit": 0, + "childtable_offset": 0, + "rows_per_tbl": 0, + "max_sql_len": 1048576, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2022-10-22 17:20:36", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ + { + "type": "INT", + "count": 4094 + } + ], + "tags": [ + { + "type": "TINYINT", + "count": 1 + } + ] + } + ] + } + ], + "prepare_rand": 10000, + "chinese": "no", + "streams": false, + "test_log": "/root/testlog/" +} diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index 619031fc29..827bb5906e 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -93,6 +93,7 @@ class TDTestCase: oldServerVersion=tdsqlF.queryResult[0][0] tdLog.info(f"Base server version is {oldServerVersion}") tdsqlF.query(f"SELECT CLIENT_VERSION();") + # the oldClientVersion can't be updated in the same python process,so the version is new compiled verison oldClientVersion=tdsqlF.queryResult[0][0] tdLog.info(f"Base client version is {oldClientVersion}") @@ -105,7 +106,14 @@ class TDTestCase: # tdsqlF.query(f"select count(*) from {stb}") # tdsqlF.checkData(0,0,tableNumbers*recordNumbers1) os.system("pkill taosd") - sleep(1) + sleep(2) + + print(f"start taosd: nohup taosd -c {cPath} & ") + os.system(f" nohup taosd -c {cPath} & " ) + sleep(2) + tdLog.info(f" LD_LIBRARY_PATH=/usr/lib taosBenchmark -f compa4096.json -y ") + + tdLog.printNoPrefix("==========step2:update new version ") self.buildTaosd(bPath) diff --git a/tests/system-test/6-cluster/5dnode3mnodeAdd1Ddnoe.py b/tests/system-test/6-cluster/5dnode3mnodeAdd1Ddnoe.py index f174975a8e..d084432a1a 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeAdd1Ddnoe.py +++ b/tests/system-test/6-cluster/5dnode3mnodeAdd1Ddnoe.py @@ -126,14 +126,12 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodeNumbers) - clusterComCheck.checkMnodeStatus(1) - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) + # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeRecreateMnode.py b/tests/system-test/6-cluster/5dnode3mnodeRecreateMnode.py index 1590a5948b..41082baa3d 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeRecreateMnode.py +++ b/tests/system-test/6-cluster/5dnode3mnodeRecreateMnode.py @@ -126,14 +126,11 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodeNumbers) - clusterComCheck.checkMnodeStatus(1) - - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) + # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertData.py b/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertData.py index 5af9e55472..94e02b77b3 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertData.py +++ b/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertData.py @@ -126,14 +126,11 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodeNumbers) - clusterComCheck.checkMnodeStatus(1) - - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) + # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py b/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py index 1c488cab5f..d6d06446a1 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py +++ b/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py @@ -126,14 +126,11 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodeNumbers) - clusterComCheck.checkMnodeStatus(1) - - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) + # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py index 93d60e6561..d3ec429bdb 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py @@ -120,14 +120,10 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodeNumbers) - clusterComCheck.checkMnodeStatus(1) - - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py index 62f4b248f9..3a2492c89d 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py @@ -94,14 +94,10 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodeNumbers) - clusterComCheck.checkMnodeStatus(1) - - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeInsertData.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeInsertData.py index 382144b69c..265000bdc9 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeInsertData.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeInsertData.py @@ -124,14 +124,10 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodeNumbers) - clusterComCheck.checkMnodeStatus(1) - - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py index 397c6f5ccc..a5f8810a25 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py @@ -95,16 +95,10 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodeNumbers) - clusterComCheck.checkMnodeStatus(1) - - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdLog.info("create mnode on dnode 2") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdLog.info("create mnode on dnode 3") - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDbRep3.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDbRep3.py index e8e3b217a1..98842e3358 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDbRep3.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDbRep3.py @@ -94,14 +94,10 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodeNumbers) - clusterComCheck.checkMnodeStatus(1) - - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py index e3f1a91de8..cb16059524 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py @@ -119,14 +119,10 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodeNumbers) - clusterComCheck.checkMnodeStatus(1) - - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py index 4ff6bffc07..a1ebef9709 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py @@ -96,14 +96,10 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodeNumbers) - clusterComCheck.checkMnodeStatus(1) - - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py index 4bd8628a66..dc8e600f29 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py @@ -119,14 +119,10 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodeNumbers) - clusterComCheck.checkMnodeStatus(1) - - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeStop.py b/tests/system-test/6-cluster/5dnode3mnodeStop.py index 531688710a..522ba4c2fc 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeStop.py +++ b/tests/system-test/6-cluster/5dnode3mnodeStop.py @@ -75,14 +75,17 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodenumbers) - clusterComCheck.checkMnodeStatus(1) + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + # # fisr add three mnodes; + # tdLog.info("check mnode status") + # # tdSql.execute("create mnode on dnode 2") + # clusterComCheck.checkMnodeStatus(2) + # # tdSql.execute("create mnode on dnode 3") + # clusterComCheck.checkMnodeStatus(3) # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeStop2Follower.py b/tests/system-test/6-cluster/5dnode3mnodeStop2Follower.py index 76ff746b2e..0596dd84ed 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeStop2Follower.py +++ b/tests/system-test/6-cluster/5dnode3mnodeStop2Follower.py @@ -75,14 +75,9 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodenumbers) - clusterComCheck.checkMnodeStatus(1) - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/6-cluster/5dnode3mnodeStopConnect.py b/tests/system-test/6-cluster/5dnode3mnodeStopConnect.py index 142f88c0d9..2c735ed9b6 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeStopConnect.py +++ b/tests/system-test/6-cluster/5dnode3mnodeStopConnect.py @@ -75,15 +75,11 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodenumbers) - clusterComCheck.checkMnodeStatus(1) - - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) - + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) + # add some error operations and tdLog.info("Confirm the status of the dnode again") tdSql.error("create mnode on dnode 2") diff --git a/tests/system-test/6-cluster/5dnode3mnodeStopFollowerLeader.py b/tests/system-test/6-cluster/5dnode3mnodeStopFollowerLeader.py index afa1c3dcc3..d7176e142f 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeStopFollowerLeader.py +++ b/tests/system-test/6-cluster/5dnode3mnodeStopFollowerLeader.py @@ -75,15 +75,11 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodenumbers) - clusterComCheck.checkMnodeStatus(1) - - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) - + + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) + # add some error operations and tdLog.info("Confirm the status of the dnode again") tdSql.error("create mnode on dnode 2") diff --git a/tests/system-test/6-cluster/5dnode3mnodeStopLoop.py b/tests/system-test/6-cluster/5dnode3mnodeStopLoop.py index 97134ac2d1..52d61fb529 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeStopLoop.py +++ b/tests/system-test/6-cluster/5dnode3mnodeStopLoop.py @@ -75,14 +75,10 @@ class TDTestCase: tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) clusterComCheck.checkDnodes(dnodenumbers) - clusterComCheck.checkMnodeStatus(1) - # fisr add three mnodes; - tdLog.info("fisr add three mnodes and check mnode status") - tdSql.execute("create mnode on dnode 2") - clusterComCheck.checkMnodeStatus(2) - tdSql.execute("create mnode on dnode 3") - clusterComCheck.checkMnodeStatus(3) + #check mnode status + tdLog.info("check mnode status") + clusterComCheck.checkMnodeStatus(mnodeNums) # add some error operations and tdLog.info("Confirm the status of the dnode again") diff --git a/tests/system-test/test.py b/tests/system-test/test.py index b25bda4a3b..e171baa656 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -73,8 +73,9 @@ if __name__ == "__main__": createDnodeNums = 1 restful = False replicaVar = 1 - opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RD:n:', [ - 'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy','createDnodeNums','restful','adaptercfgupdate','replicaVar']) + independentMnode = True + opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RD:n:i:', [ + 'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy','createDnodeNums','restful','adaptercfgupdate','replicaVar','independentMnode']) for key, value in opts: if key in ['-h', '--help']: tdLog.printNoPrefix( @@ -97,6 +98,8 @@ if __name__ == "__main__": tdLog.printNoPrefix('-R restful realization form') tdLog.printNoPrefix('-D taosadapter update cfg dict ') tdLog.printNoPrefix('-n the number of replicas') + tdLog.printNoPrefix('-i independentMnode Mnode') + sys.exit(0) if key in ['-r', '--restart']: @@ -158,6 +161,9 @@ if __name__ == "__main__": if key in ['-C', '--createDnodeNums']: createDnodeNums = value + if key in ['-i', '--independentMnode']: + independentMnode = value + if key in ['-R', '--restful']: restful = True @@ -313,7 +319,7 @@ if __name__ == "__main__": tdLog.exit(f"alter queryPolicy to {queryPolicy} failed") else : tdLog.debug("create an cluster with %s nodes and make %s dnode as independent mnode"%(dnodeNums,mnodeNums)) - dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums,mnodeNums=mnodeNums) + dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums, mnodeNums=mnodeNums, independentMnode=independentMnode) tdDnodes = ClusterDnodes(dnodeslist) tdDnodes.init(deployPath, masterIp) tdDnodes.setTestCluster(testCluster) @@ -339,6 +345,7 @@ if __name__ == "__main__": else: createDnodeNums=createDnodeNums cluster.create_dnode(conn,createDnodeNums) + cluster.create_mnode(conn,mnodeNums) try: if cluster.check_dnode(conn) : print("check dnode ready") @@ -446,7 +453,7 @@ if __name__ == "__main__": else : tdLog.debug("create an cluster with %s nodes and make %s dnode as independent mnode"%(dnodeNums,mnodeNums)) - dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums,mnodeNums=mnodeNums) + dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums, mnodeNums=mnodeNums, independentMnode=independentMnode) tdDnodes = ClusterDnodes(dnodeslist) tdDnodes.init(deployPath, masterIp) tdDnodes.setTestCluster(testCluster) @@ -472,6 +479,8 @@ if __name__ == "__main__": else: createDnodeNums=createDnodeNums cluster.create_dnode(conn,createDnodeNums) + cluster.create_mnode(conn,mnodeNums) + try: if cluster.check_dnode(conn) : print("check dnode ready")