Beispiel #1
0
 def test_index_collection_empty(self):
     """
     target: test index with empty collection
     method: Index on empty collection
     expected: no exception raised
     """
     c_name = cf.gen_unique_str(prefix)
     collection_w = self.init_collection_wrap(name=c_name)
     index, _ = self.index_wrap.init_index(collection_w.collection, default_field_name, default_index_params)
     # TODO: assert index
     cf.assert_equal_index(index, collection_w.collection.indexes[0])
Beispiel #2
0
 def test_index_drop(self):
     """
     target: test index.drop
     method: create index by `index`, and then drop it
     expected: no exception raised
     """
     c_name = cf.gen_unique_str(prefix)
     collection_w = self.init_collection_wrap(name=c_name)
     index, _ = self.index_wrap.init_index(collection_w.collection, default_field_name, default_index_params)
     cf.assert_equal_index(index, collection_w.collection.indexes[0])
     self.index_wrap.drop()
     assert len(collection_w.collection.indexes) == 0
Beispiel #3
0
 def test_index_params(self, get_valid_index_params):
     """
     target: test index with all index type/params
     method: input valid params
     expected: no exception raised
     """
     c_name = cf.gen_unique_str(prefix)
     collection_w = self.init_collection_wrap(name=c_name)
     data = cf.gen_default_list_data(ct.default_nb)
     collection_w.insert(data=data)
     index_params = get_valid_index_params
     index, _ = self.index_wrap.init_index(collection_w.collection, default_field_name, index_params)
     # TODO: assert index
     cf.assert_equal_index(index, collection_w.collection.indexes[0])
Beispiel #4
0
 def test_index_params_flush(self):
     """
     target: test index with all index type/params
     method: input valid params
     expected: no exception raised
     """
     c_name = cf.gen_unique_str(prefix)
     collection_w = self.init_collection_wrap(name=c_name)
     data = cf.gen_default_list_data(ct.default_nb)
     collection_w.insert(data=data)
     self._connect().flush([collection_w.name])
     index, _ = self.index_wrap.init_index(collection_w.collection, default_field_name, default_index_params)
     # TODO: assert index
     cf.assert_equal_index(index, collection_w.collection.indexes[0])
     assert collection_w.num_entities == ct.default_nb
Beispiel #5
0
 def test_index_drop_multi_collections(self):
     """
     target: test index.drop
     method: create indexes by `index`, and then drop it, assert there is one index left
     expected: exception raised
     """
     c_name = cf.gen_unique_str(prefix)
     c_name_2 = cf.gen_unique_str(prefix)
     cw = self.init_collection_wrap(name=c_name)
     cw2 = self.init_collection_wrap(name=c_name_2)
     iw_2 = ApiIndexWrapper()
     self.index_wrap.init_index(cw.collection, default_field_name, default_index_params)
     index_2, _ = iw_2.init_index(cw2.collection, default_field_name, default_index_params)
     self.index_wrap.drop()
     assert cf.assert_equal_index(index_2, cw2.collection.indexes[0])
     assert len(cw.collection.indexes) == 0