Example #1
0
 def test_drop_partition_create(self, connect, collection):
     """
     target: test drop partition, and create again, check status
     method: create partitions first, then call function: drop_partition, create_partition
     expected: status not ok, partition in db
     """
     connect.create_partition(collection, default_tag)
     assert ut.compare_list_elements(connect.list_partitions(collection), [default_tag, '_default'])
     connect.drop_partition(collection, default_tag)
     assert ut.compare_list_elements(connect.list_partitions(collection), ['_default'])
     time.sleep(2)
     connect.create_partition(collection, default_tag)
     assert ut.compare_list_elements(connect.list_partitions(collection), [default_tag, '_default'])
Example #2
0
 def test_list_partitions_no_partition(self, connect, collection):
     """
     target: test show partitions with collection name, check status and partitions returned
     method: call function: list_partitions
     expected: status ok, partitions correct
     """
     res = connect.list_partitions(collection)
     assert ut.compare_list_elements(res, ['_default'])
Example #3
0
 def test_list_partitions(self, connect, collection):
     """
     target: test show partitions, check status and partitions returned
     method: create partition first, then call function: list_partitions
     expected: status ok, partition correct
     """
     connect.create_partition(collection, default_tag)
     assert ut.compare_list_elements(connect.list_partitions(collection), [default_tag, '_default'])
Example #4
0
 def test_create_different_partition_names(self, connect, collection):
     """
     target: test create partition twice with different names
     method: call function: create_partition, and again
     expected: status ok
     """
     connect.create_partition(collection, default_tag)
     tag_name = ut.gen_unique_str()
     connect.create_partition(collection, tag_name)
     assert ut.compare_list_elements(connect.list_partitions(collection), [default_tag, tag_name, '_default'])
Example #5
0
 def test_show_multi_partitions(self, connect, collection):
     """
     target: test show partitions, check status and partitions returned
     method: create partitions first, then call function: list_partitions
     expected: status ok, partitions correct
     """
     tag_new = ut.gen_unique_str()
     connect.create_partition(collection, default_tag)
     connect.create_partition(collection, tag_new)
     res = connect.list_partitions(collection)
     assert ut.compare_list_elements(res, [default_tag, tag_new, '_default'])
Example #6
0
 def test_create_partition_repeat(self, connect, collection):
     """
     target: test create partition, check status returned
     method: call function: create_partition
     expected: status ok
     """
     connect.create_partition(collection, default_tag)
     try:
         connect.create_partition(collection, default_tag)
     except Exception as e:
         code = getattr(e, 'code', "The exception does not contain the field of code.")
         assert code == 1
         message = getattr(e, 'message', "The exception does not contain the field of message.")
         assert message == "create partition failed: partition name = %s already exists" % default_tag
     assert ut.compare_list_elements(connect.list_partitions(collection), [default_tag, '_default'])