-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Python [FT.DROPINDEX] Added command --------- Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
- Loading branch information
1 parent
b255189
commit 23a180b
Showing
6 changed files
with
116 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
python/python/tests/tests_server_modules/search/test_ft_dropindex.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import uuid | ||
from typing import List | ||
|
||
import pytest | ||
from glide.async_commands.server_modules import ft | ||
from glide.async_commands.server_modules.ft_options.ft_create_options import ( | ||
DataType, | ||
Field, | ||
FtCreateOptions, | ||
TextField, | ||
) | ||
from glide.config import ProtocolVersion | ||
from glide.constants import OK, TEncodable | ||
from glide.exceptions import RequestError | ||
from glide.glide_client import GlideClusterClient | ||
|
||
|
||
@pytest.mark.asyncio | ||
class TestFtDropIndex: | ||
@pytest.mark.parametrize("cluster_mode", [True]) | ||
@pytest.mark.parametrize("protocol", [ProtocolVersion.RESP2, ProtocolVersion.RESP3]) | ||
async def test_ft_dropindex(self, glide_client: GlideClusterClient): | ||
# Index name for the index to be dropped. | ||
indexName = str(uuid.uuid4()) | ||
|
||
fields: List[Field] = [] | ||
textFieldTitle: TextField = TextField("$title") | ||
fields.append(textFieldTitle) | ||
prefixes: List[TEncodable] = [] | ||
prefixes.append("blog:post:") | ||
|
||
# Create an index with multiple fields with Hash data type. | ||
result = await ft.create( | ||
glide_client, indexName, fields, FtCreateOptions(DataType.HASH, prefixes) | ||
) | ||
assert result == OK | ||
|
||
# Drop the index. Expects "OK" as a response. | ||
result = await ft.dropindex(glide_client, indexName) | ||
assert result == OK | ||
|
||
# Drop a non existent index. Expects a RequestError. | ||
with pytest.raises(RequestError): | ||
await ft.dropindex(glide_client, indexName) |