From 15aecd488241f00822440920605d17bcd9f5fc3e Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Fri, 4 Jun 2021 16:52:18 +0800 Subject: [PATCH] [TD-4505]: add test case for last_row() --- tests/pytest/query/last_row_cache.py | 60 +++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/tests/pytest/query/last_row_cache.py b/tests/pytest/query/last_row_cache.py index a0e8147709..4aae4ce487 100644 --- a/tests/pytest/query/last_row_cache.py +++ b/tests/pytest/query/last_row_cache.py @@ -25,7 +25,7 @@ class TDTestCase: self.tables = 10 self.rows = 20 - self.columns = 50 + self.columns = 5 self.perfix = 't' self.ts = 1601481600000 @@ -34,7 +34,7 @@ class TDTestCase: sql = "create table st(ts timestamp, " for i in range(self.columns - 1): sql += "c%d int, " % (i + 1) - sql += "c50 int) tags(t1 int)" + sql += "c5 int) tags(t1 int)" tdSql.execute(sql) for i in range(self.tables): @@ -148,15 +148,38 @@ class TDTestCase: self.executeQueries() self.insertData2() self.executeQueries2() - + print("============== alter last cache") tdSql.execute("alter database test1 cachelast 1") self.executeQueries2() + + tdSql.execute("alter database test1 cachelast 2") + self.executeQueries2() + + tdSql.execute("alter database test1 cachelast 3") + self.executeQueries2() + + + print("============== alter last cache") + tdSql.execute("alter database test1 cachelast 0") + self.executeQueries2() + tdDnodes.stop(1) + tdDnodes.start(1) + self.executeQueries2() + + tdSql.execute("alter database test1 cachelast 1") + self.executeQueries2() + tdDnodes.stop(1) + tdDnodes.start(1) + self.executeQueries2() + + tdSql.execute("alter database test1 cachelast 2") + self.executeQueries2() tdDnodes.stop(1) tdDnodes.start(1) self.executeQueries2() - tdSql.execute("alter database test1 cachelast 0") + tdSql.execute("alter database test1 cachelast 3") self.executeQueries2() tdDnodes.stop(1) tdDnodes.start(1) @@ -174,10 +197,22 @@ class TDTestCase: self.executeQueries2() tdSql.execute("alter database test2 cachelast 0") + self.executeQueries2() + + tdSql.execute("alter database test2 cachelast 1") + self.executeQueries2() + + tdSql.execute("alter database test2 cachelast 2") + self.executeQueries2() + + tdSql.execute("alter database test2 cachelast 3") self.executeQueries2() + + tdSql.execute("alter database test2 cachelast 0") + self.executeQueries2() tdDnodes.stop(1) tdDnodes.start(1) - self.executeQueries2() + self.executeQueries2() tdSql.execute("alter database test2 cachelast 1") self.executeQueries2() @@ -185,6 +220,21 @@ class TDTestCase: tdDnodes.start(1) self.executeQueries2() + tdSql.execute("alter database test2 cachelast 2") + self.executeQueries2() + tdDnodes.stop(1) + tdDnodes.start(1) + self.executeQueries2() + + tdSql.execute("alter database test2 cachelast 3") + self.executeQueries2() + tdDnodes.stop(1) + tdDnodes.start(1) + self.executeQueries2() + + tdSql.query("select last_row(*) from st group by tbname") + tdSql.checkRows(10) + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) -- GitLab