From f7181a5e04a1e67df735e568f5b974122b514b88 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 21 May 2020 18:05:29 +0800 Subject: [PATCH] add function to delete data files. --- tests/pytest/random-test/random-test.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/pytest/random-test/random-test.py b/tests/pytest/random-test/random-test.py index 7caa07e5d2..4e1e6ac2fa 100644 --- a/tests/pytest/random-test/random-test.py +++ b/tests/pytest/random-test/random-test.py @@ -108,6 +108,18 @@ class Test: tdDnodes.start(1) tdSql.prepare() + def delete_datafiles(self): + tdLog.info("delete data files") + dnodesDir = tdDnodes.getDnodesRootDir() + dataDir = dnodesDir + '/dnode1/*' + deleteCmd = 'rm -rf %s' % dataDir + os.system(deleteCmd) + + self.current_tb = "" + self.last_tb = "" + self.written = 0 + tdDnodes.start(1) + tdSql.prepare() class TDTestCase: def init(self, conn, logSql): @@ -129,10 +141,11 @@ class TDTestCase: 7: test.drop_table, 8: test.reset_query_cache, 9: test.reset_database, + 10: test.delete_datafiles, } for x in range(1, 100): - r = random.randint(1, 9) + r = random.randint(1, 10) tdLog.notice("iteration %d run func %d" % (x, r)) switch.get(r, lambda: "ERROR")() -- GitLab