diff --git a/tests/system-test/3-enterprise/restore/restore_basic.py b/tests/system-test/3-enterprise/restore/restoreBasic.py similarity index 88% rename from tests/system-test/3-enterprise/restore/restore_basic.py rename to tests/system-test/3-enterprise/restore/restoreBasic.py index 1a2cdef7fb2f4befef24c356ec065939ce6435db..0f91916a340e389d99fccc1ec036c07a5eb5f60e 100644 --- a/tests/system-test/3-enterprise/restore/restore_basic.py +++ b/tests/system-test/3-enterprise/restore/restoreBasic.py @@ -28,11 +28,10 @@ import shutil import time -class TDTestCase: +class RestoreBasic: # init def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) - tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor()) self.dnodes_num = 5 @@ -41,17 +40,15 @@ class TDTestCase: self.dnodes = cluster.dnodes num = len(self.dnodes) - if num != self.dnodes_num : - tdLog.exit(f" cluster dnode is not equal 5. num={num}") - return - - print(f" start dnode num={num} !") - for i in range(num): - dnode = self.dnodes[i] - print(f" dnode{i} dataDir={dnode.dataDir} ip={dnode.remoteIP} path={dnode.path}") - - print(" end !") + if num < self.dnodes_num : + tdLog.exit(f" cluster dnode is less than {self.dnodes_num}. num={num}") + # create data + self.dbname = "db" + self.stable = "st" + self.child_count = 100 + self.insert_rows = 10000 + self.create_data() # create data def create_data(self): @@ -97,8 +94,6 @@ class TDTestCase: tdLog.info("check vgroups status successfully.") return True - - # check data corrent def check_corrent(self): # check status @@ -226,29 +221,9 @@ class TDTestCase: tdLog.exit(f"qnode restore failed. qnode.json is not exist. {qfile}") else: tdLog.info(f"check qnode.json restore ok. {qfile}") - - # run - def run(self): - - # create data - self.dbname = "db" - self.stable = "st" - self.child_count = 10 - self.insert_rows = 1000 - self.create_data() - - # remove dnode - index = 1 - self.restore_dnode(2) - self.restore_mnode(3) - self.restore_vnode(4) - self.restore_qnode(5) - # stop def stop(self): tdSql.close() - tdLog.success("%s successfully executed" % __file__) -tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) + diff --git a/tests/system-test/3-enterprise/restore/restoreDnode.py b/tests/system-test/3-enterprise/restore/restoreDnode.py new file mode 100644 index 0000000000000000000000000000000000000000..b92c823764734bdac659abe2381f7bdc3d50598f --- /dev/null +++ b/tests/system-test/3-enterprise/restore/restoreDnode.py @@ -0,0 +1,41 @@ +################################################################### +# 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 + +from util.log import * +from util.cases import * +from util.sql import * +from util.common import * +sys.path.append("./3-enterprise/restore") +from restoreBasic import * + + +class TDTestCase: + # init + def init(self, conn, logSql, replicaVar=1): + tdLog.debug("start to execute %s" % __file__) + self.basic = RestoreBasic() + self.basic.init(conn, logSql, replicaVar) + + # run + def run(self): + self.basic.restore_dnode(2) + + # stop + def stop(self): + self.basic.stop() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/system-test/3-enterprise/restore/restoreMnode.py b/tests/system-test/3-enterprise/restore/restoreMnode.py new file mode 100644 index 0000000000000000000000000000000000000000..3f3ccb8a5ff7d25e0df817261196032d0f69dda9 --- /dev/null +++ b/tests/system-test/3-enterprise/restore/restoreMnode.py @@ -0,0 +1,42 @@ +################################################################### +# 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 + +from util.log import * +from util.cases import * +from util.sql import * +from util.common import * +sys.path.append("./3-enterprise/restore") +from restoreBasic import * + + + +class TDTestCase: + # init + def init(self, conn, logSql, replicaVar=1): + tdLog.debug("start to execute %s" % __file__) + self.basic = RestoreBasic() + self.basic.init(conn, logSql, replicaVar) + + # run + def run(self): + self.basic.restore_mnode(3) + + # stop + def stop(self): + self.basic.stop() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/system-test/3-enterprise/restore/restoreQnode.py b/tests/system-test/3-enterprise/restore/restoreQnode.py new file mode 100644 index 0000000000000000000000000000000000000000..d2136523e8fdded5e75a61f118731fc505047eb8 --- /dev/null +++ b/tests/system-test/3-enterprise/restore/restoreQnode.py @@ -0,0 +1,41 @@ +################################################################### +# 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 + +from util.log import * +from util.cases import * +from util.sql import * +from util.common import * +sys.path.append("./3-enterprise/restore") +from restoreBasic import * + + +class TDTestCase: + # init + def init(self, conn, logSql, replicaVar=1): + tdLog.debug("start to execute %s" % __file__) + self.basic = RestoreBasic() + self.basic.init(conn, logSql, replicaVar) + + # run + def run(self): + self.basic.restore_qnode(5) + + # stop + def stop(self): + self.basic.stop() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/system-test/3-enterprise/restore/restoreVnode.py b/tests/system-test/3-enterprise/restore/restoreVnode.py new file mode 100644 index 0000000000000000000000000000000000000000..57e95e34c3e46d3e447af57d04dee1e9791ac76f --- /dev/null +++ b/tests/system-test/3-enterprise/restore/restoreVnode.py @@ -0,0 +1,41 @@ +################################################################### +# 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 + +from util.log import * +from util.cases import * +from util.sql import * +from util.common import * +sys.path.append("./3-enterprise/restore") +from restoreBasic import * + + +class TDTestCase: + # init + def init(self, conn, logSql, replicaVar=1): + tdLog.debug("start to execute %s" % __file__) + self.basic = RestoreBasic() + self.basic.init(conn, logSql, replicaVar) + + # run + def run(self): + self.basic.restore_dnode(4) + + # stop + def stop(self): + self.basic.stop() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase())