Add test cases of the new rules of index (#19933)

Signed-off-by: nico <cheng.yuan@zilliz.com>

Signed-off-by: nico <cheng.yuan@zilliz.com>
pull/19969/head
NicoYuan1986 2022-10-21 17:05:37 +08:00 committed by GitHub
parent 41483945be
commit 4a6880af78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 1 deletions

View File

@ -2537,6 +2537,18 @@ class TestLoadCollection(TestcaseBase):
check_items={"err_code": 15,
"err_msg": "collection not found, maybe not loaded"})
@pytest.mark.tags(CaseLabel.L1)
def test_load_collection_without_creating_index(self):
"""
target: test drop index after load without release
method: create a collection without index, then load
expected: raise exception
"""
collection_w = self.init_collection_general(prefix, True, is_index=True)[0]
collection_w.load(check_task=CheckTasks.err_res,
check_items={"err_code": 1,
"err_msg": "index not exist"})
class TestReleaseAdvanced(TestcaseBase):
@pytest.mark.tags(CaseLabel.L0)

View File

@ -1169,7 +1169,7 @@ class TestNewIndexBinary(TestcaseBase):
assert len(collection_w.indexes) == 0
class TestIndexInvalid(object):
class TestIndexInvalid(TestcaseBase):
"""
Test create / describe / drop index interfaces with invalid collection names
"""
@ -1221,6 +1221,23 @@ class TestIndexInvalid(object):
with pytest.raises(Exception) as e:
connect.create_index(collection, field_name, get_index)
@pytest.mark.tags(CaseLabel.L1)
def test_drop_index_without_release(self):
"""
target: test drop index after load without release
method: 1. create a collection and build an index then load
2. drop the index
expected: raise exception
"""
collection_w = self.init_collection_general(prefix, True, is_index=True)[0]
default_index = {"index_type": "IVF_FLAT", "params": {"nlist": 128}, "metric_type": "L2"}
collection_w.create_index("float_vector", default_index)
collection_w.load()
collection_w.drop_index(check_task=CheckTasks.err_res,
check_items={"err_code": 1,
"err_msg": "index cannot be dropped, collection is "
"loaded, please release it first"})
class TestNewIndexAsync(TestcaseBase):
@pytest.fixture(scope="function", params=[False, True])