def testCreateTableNameEmpty(self): """ table名为空 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table, name='') retStatus = jobHelper.run(failonerror=False) self.assertFalse(retStatus)
def testCreateTableNameIllegal(self): """ table名有特殊字符 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table, name='ill_*/.&@#') retStatus = jobHelper.run(failonerror=False) self.assertTrue(retStatus)
def testCreateTableTableIdEmpty(self): """ table_id配空 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table, tid=0) retStatus = jobHelper.run(failonerror=False) self.assertFalse(retStatus)
def testCreateTablePidEmpty(self): """ pid配空 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table, pid=1) retStatus = jobHelper.run(failonerror=False) self.assertTrue(retStatus)
def testCreateTableTableIdDuplicate(self): """ 已经存在的table_id,再次执行create操作失败 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table, tid='123456') jobHelper.append(jobHelper.rtidbClient.create_table, tid='123456') retStatus = jobHelper.run(failonerror=False) self.assertFalse(retStatus)
def testCreateTablePid0(self): """ pid=0 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table, pid=0) jobHelper.append(jobHelper.rtidbClient.put) jobHelper.append(jobHelper.rtidbClient.scan) retStatus = jobHelper.run() self.assertTrue(retStatus)
def testDropTableTidInvalid(self): """ 不存在的table_id进行drop """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table, tid=123) jobHelper.append(jobHelper.rtidbClient.scan, tid=123) jobHelper.append(jobHelper.rtidbClient.drop_table, tid=123456) retStatus = jobHelper.run(failonerror=False, autoidentity=False) self.assertFalse(retStatus)
def testScanCommon(self): """ scan操作,正确处理 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put) jobHelper.append(jobHelper.rtidbClient.scan) retStatus = jobHelper.run() self.assertTrue(retStatus)
def testDropTableRedo(self): """ 已经drop的表再次执行drop """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.drop_table) jobHelper.append(jobHelper.rtidbClient.drop_table) retStatus = jobHelper.run(failonerror=False) self.assertFalse(retStatus)
def testCreateTableNameDuplicate(self): """ 已经存在的table名,再次执行create操作失败 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table, name='table_duplacate') jobHelper.append(jobHelper.rtidbClient.create_table, name='table_duplacate') retStatus = jobHelper.run(failonerror=False) self.assertFalse(retStatus)
def testCreateTablePidMax(self): """ pid=max """ jobHelper = JobHelper() import sys jobHelper.append(jobHelper.rtidbClient.create_table, pid=sys.maxint) jobHelper.append(jobHelper.rtidbClient.put, pid=sys.maxint) jobHelper.append(jobHelper.rtidbClient.scan, pid=sys.maxint) retStatus = jobHelper.run() self.assertTrue(retStatus)
def testScanPkInvalid(self): """ 不存在的partition_key进行scan """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put, pk='123') jobHelper.append(jobHelper.rtidbClient.scan, pk='456') retStatus = jobHelper.run(failonerror=False, autoidentity=False) self.assertTrue(retStatus) self.assertEqual(0, len(jobHelper.scanout_message()))
def testScanTidInvalid(self): """ table_id不存在的表进行scan """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table, tid=123) jobHelper.append(jobHelper.rtidbClient.put, tid=123) jobHelper.append(jobHelper.rtidbClient.scan, tid=456) retStatus = jobHelper.run(autoidentity=False, logcheck=False) self.assertTrue(retStatus) self.assertEqual(0, len(jobHelper.scanout_message()))
def testScanEtimeEmpty(self): """ timestamp_end为空 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put) jobHelper.append(jobHelper.rtidbClient.scan, etime=0) retStatus = jobHelper.run(failonerror=False, autoidentity=False) self.assertTrue(retStatus) self.assertEqual(1, len(jobHelper.scanout_message()))
def testPutValueEmpty(self): """ value是空 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put, value='') jobHelper.append(jobHelper.rtidbClient.scan) retStatus = jobHelper.run() self.assertTrue(retStatus)
def testPutTid0(self): """ table_id=0 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table, tid=0) jobHelper.append(jobHelper.rtidbClient.put, tid=0) jobHelper.append(jobHelper.rtidbClient.scan) retStatus = jobHelper.run(failonerror=False, autoidentity=False) self.assertFalse(retStatus)
def testPutValueBig(self): """ value是1M string """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put, value='a' * 1024 * 1025) jobHelper.append(jobHelper.rtidbClient.scan) retStatus = jobHelper.run() self.assertTrue(retStatus)
def testPutValueEncode(self): """ value是特殊编码数据 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put, value='ボールト') jobHelper.append(jobHelper.rtidbClient.scan) retStatus = jobHelper.run() self.assertTrue(retStatus)
def testPutValueInit(self): """ value是int数据 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put, value=123) jobHelper.append(jobHelper.rtidbClient.scan) retStatus = jobHelper.run() self.assertTrue(retStatus)
def testPutPkEmpty(self): """ partition_key为空 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put, pk='') jobHelper.append(jobHelper.rtidbClient.scan) retStatus = jobHelper.run(autoidentity=False) self.assertTrue(retStatus) self.assertEqual(0, len(jobHelper.scanout_message()))
def testPutTidEmpty(self): """ table_id为空 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put, tid='') jobHelper.append(jobHelper.rtidbClient.scan) retStatus = jobHelper.run(failonerror=False, autoidentity=False) self.assertFalse(retStatus) self.assertEqual(0, len(jobHelper.scanout_message()))
def testPutDropedTable(self): """ 已经drop的表执行put """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.drop_table) jobHelper.append(jobHelper.rtidbClient.put) jobHelper.append(jobHelper.rtidbClient.scan) retStatus = jobHelper.run(failonerror=False, autoidentity=False) self.assertFalse(retStatus)
def testPutInvalidTid(self): """ 不存在的table_id执行put """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table, tid=123) jobHelper.append(jobHelper.rtidbClient.put, tid=456) jobHelper.append(jobHelper.rtidbClient.scan, tid=123) retStatus = jobHelper.run(failonerror=False, autoidentity=False) self.assertFalse(retStatus) self.assertEqual(0, len(jobHelper.scanout_message()))
def testPutValueNone(self): """ value是空 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put, value=None) jobHelper.append(jobHelper.rtidbClient.scan) retStatus = jobHelper.run(failonerror=False, autoidentity=False) self.assertTrue(retStatus) self.assertEqual(1, len(jobHelper.scanout_message()))
def testPutTimeStampInvalid(self): """ timestamp为空 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put, time=0) jobHelper.append(jobHelper.rtidbClient.scan) retStatus = jobHelper.run(failonerror=False, autoidentity=False) self.assertTrue(retStatus) self.assertEqual(0, len(jobHelper.scanout_message()))
def testDropTableLoop(self): """ 相同名称已经id的表,连续执行create -> drop -> create -> drop """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.drop_table) jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.drop_table) jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.drop_table) retStatus = jobHelper.run(failonerror=False) self.assertTrue(retStatus)
def testScanDroped(self): """ 已经drop的表进行scan """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put) jobHelper.append(jobHelper.rtidbClient.drop_table) jobHelper.append(jobHelper.rtidbClient.scan) retStatus = jobHelper.run(failonerror=False, autoidentity=False, logcheck=False) self.assertTrue(retStatus) self.assertEqual(0, len(jobHelper.scanout_message()))
def testCreateTableSameToken(self): """ table名,table_id,partion_id,segment_count配相同数字 """ jobHelper = JobHelper() import sys jobHelper.append(jobHelper.rtidbClient.create_table, name='123', tid=123, pid=123) jobHelper.append(jobHelper.rtidbClient.put, tid=123, pid=123) jobHelper.append(jobHelper.rtidbClient.scan, tid=123, pid=123) retStatus = jobHelper.run() self.assertTrue(retStatus)
def testScanMiss(self): """ scan时间段内无数据 """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put, time=1494496520) jobHelper.append(jobHelper.rtidbClient.put, time=1494496521) jobHelper.append(jobHelper.rtidbClient.put, time=1494496522) jobHelper.append(jobHelper.rtidbClient.put, time=1494496523) jobHelper.append(jobHelper.rtidbClient.scan, stime=1494496511, etime=1494496512) retStatus = jobHelper.run(autoidentity=False) self.assertTrue(retStatus) self.assertEqual(0, len(jobHelper.scanout_message()))
def testScanTimeDisorderly(self): """ timestamp_start < timestamp_end """ jobHelper = JobHelper() jobHelper.append(jobHelper.rtidbClient.create_table) jobHelper.append(jobHelper.rtidbClient.put, time=1494496520) jobHelper.append(jobHelper.rtidbClient.put, time=1494496521) jobHelper.append(jobHelper.rtidbClient.put, time=1494496522) jobHelper.append(jobHelper.rtidbClient.put, time=1494496523) jobHelper.append(jobHelper.rtidbClient.scan, stime=1494496521, etime=1494496522) retStatus = jobHelper.run(autoidentity=False) self.assertTrue(retStatus) self.assertEqual(0, len(jobHelper.scanout_message()))