Merge pull request #26075 from taosdata/fix/TD-30006-3.0
fix: case coverage add column
This commit is contained in:
commit
4dd17c30ea
|
@ -48,13 +48,6 @@ class TDTestCase(TBase):
|
|||
"bigint","bigint unsigned","timestamp","bool","float","double","binary(16)","nchar(16)",
|
||||
"varchar(16)","varbinary(16)"]
|
||||
|
||||
def combineValid(self, datatype, encode, compress):
|
||||
if datatype != "float" and datatype != "double":
|
||||
if compress == "tsz":
|
||||
return False
|
||||
return True
|
||||
|
||||
def genAllSqls(self, stbName, max):
|
||||
# encode
|
||||
encodes = [
|
||||
[["tinyint","tinyint unsigned","smallint","smallint unsigned","int","int unsigned","bigint","bigint unsigned"], ["simple8B"]],
|
||||
|
@ -63,6 +56,15 @@ class TDTestCase(TBase):
|
|||
[["float","double"], ["Delta-d"]]
|
||||
]
|
||||
|
||||
|
||||
def combineValid(self, datatype, encode, compress):
|
||||
if datatype != "float" and datatype != "double":
|
||||
if compress == "tsz":
|
||||
return False
|
||||
return True
|
||||
|
||||
def genAllSqls(self, stbName, max):
|
||||
|
||||
c = 0 # column number
|
||||
t = 0 # table number
|
||||
|
||||
|
@ -70,7 +72,7 @@ class TDTestCase(TBase):
|
|||
sql = ""
|
||||
|
||||
# loop append sqls
|
||||
for lines in encodes:
|
||||
for lines in self.encodes:
|
||||
for datatype in lines[0]:
|
||||
for encode in lines[1]:
|
||||
for compress in self.compresses:
|
||||
|
@ -218,6 +220,33 @@ class TDTestCase(TBase):
|
|||
]
|
||||
tdSql.errors(sqls)
|
||||
|
||||
# add column
|
||||
def checkAddColumn(self):
|
||||
c = 0
|
||||
tbname = f"{self.db}.tbadd"
|
||||
sql = f"create table {tbname}(ts timestamp, c0 int) tags(area int);"
|
||||
tdSql.execute(sql)
|
||||
|
||||
# loop append sqls
|
||||
for lines in self.encodes:
|
||||
for datatype in lines[0]:
|
||||
for encode in lines[1]:
|
||||
for compress in self.compresses:
|
||||
for level in self.levels:
|
||||
if self.combineValid(datatype, encode, compress):
|
||||
sql = f"alter table {tbname} add column col{c} {datatype} ENCODE '{encode}' COMPRESS '{compress}' LEVEL '{level}';"
|
||||
tdSql.execute(sql, 3, True)
|
||||
c += 1
|
||||
|
||||
# alter error
|
||||
sqls = [
|
||||
f"alter table {tbname} add column a1 int ENCODE 'simple8bAA';",
|
||||
f"alter table {tbname} add column a2 int COMPRESS 'AABB';",
|
||||
f"alter table {tbname} add column a3 bigint LEVEL 'high1';",
|
||||
f"alter table {tbname} add column a4 BINARY(12) ENCODE 'simple8b' LEVEL 'high2';",
|
||||
f"alter table {tbname} add column a5 VARCHAR(16) ENCODE 'simple8b' COMPRESS 'gzip' LEVEL 'high3';"
|
||||
]
|
||||
tdSql.errors(sqls)
|
||||
|
||||
def validCreate(self):
|
||||
sqls = self.genAllSqls(self.stb, 50)
|
||||
|
@ -238,6 +267,9 @@ class TDTestCase(TBase):
|
|||
# check alter and write
|
||||
self.checkAlter()
|
||||
|
||||
# check add column
|
||||
self.checkAddColumn()
|
||||
|
||||
def checkCorrect(self):
|
||||
# check data correct
|
||||
tbname = f"{self.db}.{self.stb}"
|
||||
|
|
Loading…
Reference in New Issue