diff --git a/tests/pytest/alter/alter_keep.py b/tests/pytest/alter/alter_keep.py index f73b8ce460b9c6613139bd29562bffb00ab397ce..a734c660e8db3c26a10d760def1240a06bd05e8e 100644 --- a/tests/pytest/alter/alter_keep.py +++ b/tests/pytest/alter/alter_keep.py @@ -23,84 +23,93 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def alterKeepCommunity(self): - ## community accepts both 1 paramater, 2 parmaters and 3 paramaters - ## but paramaters other than paramater 1 will be ignored - ## only paramater 1 will be used + tdLog.notice('running Keep Test, Community Version') + #testing keep parameter during create tdSql.query('show databases') - tdSql.checkData(0,7,'3650,3650,3650') + tdSql.checkData(0,7,'3650') + tdSql.execute('drop database db') - tdSql.execute('alter database db keep 10') + tdSql.execute('create database db keep 100') tdSql.query('show databases') - tdSql.checkData(0,7,'10,10,10') + tdSql.checkData(0,7,'100') + tdSql.execute('drop database db') - tdSql.execute('alter database db keep 50') - tdSql.query('show databases') - tdSql.checkData(0,7,'50,50,50') + tdSql.error('create database db keep ') + tdSql.error('create database db keep 0') + tdSql.error('create database db keep 10,20') + tdSql.error('create database db keep 10,20,30') + tdSql.error('create database db keep 20,30,40,50') - tdSql.execute('alter database db keep 20') - tdSql.query('show databases') - tdSql.checkData(0,7,'20,20,20') + #testing keep parameter during alter + tdSql.execute('create database db') - tdSql.execute('alter database db keep 100, 98 ,99') + tdSql.execute('alter database db keep 100') tdSql.query('show databases') - tdSql.checkData(0,7,'100,100,100') + tdSql.checkData(0,7,'100') - tdSql.execute('alter database db keep 99, 100 ,101') + tdSql.error('alter database db keep ') + tdSql.error('alter database db keep 0') + tdSql.error('alter database db keep 10,20') + tdSql.error('alter database db keep 10,20,30') + tdSql.error('alter database db keep 20,30,40,50') tdSql.query('show databases') - tdSql.checkData(0,7,'99,99,99') + tdSql.checkData(0,7,'100') - tdSql.execute('alter database db keep 200, 199 ,198') + def alterKeepEnterprise(self): + tdLog.notice('running Keep Test, Enterprise Version') + #testing keep parameter during create tdSql.query('show databases') - tdSql.checkData(0,7,'200,200,200') + tdSql.checkData(0,7,'3650,3650,3650') + tdSql.execute('drop database db') - tdSql.execute('alter database db keep 4000,4001') + tdSql.execute('create database db keep 100') tdSql.query('show databases') - tdSql.checkData(0,7,'4000,4000,4000') + tdSql.checkData(0,7,'100,100,100') + tdSql.execute('drop database db') - tdSql.execute('alter database db keep 5000,50') + tdSql.execute('create database db keep 20, 30') tdSql.query('show databases') - tdSql.checkData(0,7,'5000,5000,5000') + tdSql.checkData(0,7,'20,30,30') + tdSql.execute('drop database db') - tdSql.execute('alter database db keep 50,5000') + tdSql.execute('create database db keep 30,40,50') tdSql.query('show databases') - tdSql.checkData(0,7,'50,50,50') + tdSql.checkData(0,7,'30,40,50') + tdSql.execute('drop database db') + tdSql.error('create database db keep ') + tdSql.error('create database db keep 20,30,40,50') + tdSql.error('create database db keep 0') + tdSql.error('create database db keep 100,50') + tdSql.error('create database db keep 100,40,50') + tdSql.error('create database db keep 20,100,50') + tdSql.error('create database db keep 50,60,20') - def alterKeepEnterprise(self): - ## enterprise only accept three inputs - ## does not accept 1 paramaters nor 3 paramaters - tdSql.query('show databases') - tdSql.checkData(0,7,'3650,3650,3650') + #testing keep parameter during alter + tdSql.execute('create database db') tdSql.execute('alter database db keep 10') tdSql.query('show databases') tdSql.checkData(0,7,'10,10,10') - ## the order for altering keep is keep(D), keep0, keep1. - ## if the order is changed, please modify the following test - ## to make sure the the test is accurate - - tdSql.execute('alter database db keep 10, 10 ,10') - tdSql.query('show databases') - tdSql.checkData(0,7,'10,10,10') - - tdSql.error('alter database db keep 100, 98 ,99') + tdSql.execute('alter database db keep 20,30') tdSql.query('show databases') - tdSql.checkData(0,7,'10,10,10') + tdSql.checkData(0,7,'20,30,30') - tdSql.execute('alter database db keep 200, 200 ,200') + tdSql.execute('alter database db keep 100,200,300') tdSql.query('show databases') - tdSql.checkData(0,7,'200,200,200') + tdSql.checkData(0,7,'100,200,300') - tdSql.execute('alter database db keep 198, 199 ,200') + tdSql.error('alter database db keep ') + tdSql.error('alter database db keep 20,30,40,50') + tdSql.error('alter database db keep 0') + tdSql.error('alter database db keep 100,50') + tdSql.error('alter database db keep 100,40,50') + tdSql.error('alter database db keep 20,100,50') + tdSql.error('alter database db keep 50,60,20') tdSql.query('show databases') - tdSql.checkData(0,7,'198,199,200') + tdSql.checkData(0,7,'100,200,300') - # tdSql.execute('alter database db keep 3650,3650,3650') - # tdSql.error('alter database db keep 4000,3640') - # tdSql.error('alter database db keep 10,10') - # tdSql.query('show databases') - # tdSql.checkData(0,7,'3650,3650,3650') def run(self): tdSql.prepare() @@ -112,7 +121,8 @@ class TDTestCase: else: tdLog.debug('running community test') self.alterKeepCommunity() - + + tdSql.prepare() ##TODO: need to wait for TD-4445 to implement the following ## tests