[TD-4505]<test>: add test case for last_row()
This commit is contained in:
parent
ecbc610839
commit
15aecd4882
|
@ -25,7 +25,7 @@ class TDTestCase:
|
||||||
|
|
||||||
self.tables = 10
|
self.tables = 10
|
||||||
self.rows = 20
|
self.rows = 20
|
||||||
self.columns = 50
|
self.columns = 5
|
||||||
self.perfix = 't'
|
self.perfix = 't'
|
||||||
self.ts = 1601481600000
|
self.ts = 1601481600000
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class TDTestCase:
|
||||||
sql = "create table st(ts timestamp, "
|
sql = "create table st(ts timestamp, "
|
||||||
for i in range(self.columns - 1):
|
for i in range(self.columns - 1):
|
||||||
sql += "c%d int, " % (i + 1)
|
sql += "c%d int, " % (i + 1)
|
||||||
sql += "c50 int) tags(t1 int)"
|
sql += "c5 int) tags(t1 int)"
|
||||||
tdSql.execute(sql)
|
tdSql.execute(sql)
|
||||||
|
|
||||||
for i in range(self.tables):
|
for i in range(self.tables):
|
||||||
|
@ -152,11 +152,34 @@ class TDTestCase:
|
||||||
print("============== alter last cache")
|
print("============== alter last cache")
|
||||||
tdSql.execute("alter database test1 cachelast 1")
|
tdSql.execute("alter database test1 cachelast 1")
|
||||||
self.executeQueries2()
|
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.stop(1)
|
||||||
tdDnodes.start(1)
|
tdDnodes.start(1)
|
||||||
self.executeQueries2()
|
self.executeQueries2()
|
||||||
|
|
||||||
tdSql.execute("alter database test1 cachelast 0")
|
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 3")
|
||||||
self.executeQueries2()
|
self.executeQueries2()
|
||||||
tdDnodes.stop(1)
|
tdDnodes.stop(1)
|
||||||
tdDnodes.start(1)
|
tdDnodes.start(1)
|
||||||
|
@ -173,6 +196,18 @@ class TDTestCase:
|
||||||
tdDnodes.start(1)
|
tdDnodes.start(1)
|
||||||
self.executeQueries2()
|
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")
|
tdSql.execute("alter database test2 cachelast 0")
|
||||||
self.executeQueries2()
|
self.executeQueries2()
|
||||||
tdDnodes.stop(1)
|
tdDnodes.stop(1)
|
||||||
|
@ -185,6 +220,21 @@ class TDTestCase:
|
||||||
tdDnodes.start(1)
|
tdDnodes.start(1)
|
||||||
self.executeQueries2()
|
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):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
tdLog.success("%s successfully executed" % __file__)
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
Loading…
Reference in New Issue