Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions tests/client/test_client_multi_search_meilisearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from meilisearch.errors import MeilisearchApiError
from tests.common import INDEX_UID, REMOTE_MS_1, REMOTE_MS_2
from tests.test_utils import disable_sharding
from tests.test_utils import reset_network_config


def test_basic_multi_search(client, empty_index):
Expand Down Expand Up @@ -85,7 +85,6 @@ def test_multi_search_with_network(client, index_with_documents):
resp = client.add_or_update_networks(
{
"self": REMOTE_MS_1,
"sharding": True,
"remotes": {
REMOTE_MS_1: {
"url": "http://ms-1235.example.meilisearch.io",
Expand All @@ -112,4 +111,4 @@ def test_multi_search_with_network(client, index_with_documents):
assert response["hits"][0]["_federation"]["indexUid"] == INDEX_UID
assert response["hits"][0]["_federation"]["remote"] == REMOTE_MS_1
assert response["remoteErrors"] == {}
disable_sharding(client)
reset_network_config(client)
6 changes: 2 additions & 4 deletions tests/client/test_client_network.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from tests.common import REMOTE_MS_1, REMOTE_MS_2
from tests.test_utils import disable_sharding
from tests.test_utils import reset_network_config


@pytest.mark.usefixtures("enable_network_options")
Expand All @@ -17,7 +17,6 @@ def test_add_or_update_networks(client):
"""Tests upsert network remote instance."""
body = {
"self": REMOTE_MS_1,
"sharding": True,
"remotes": {
REMOTE_MS_1: {
"url": "http://localhost:7700",
Expand All @@ -35,9 +34,8 @@ def test_add_or_update_networks(client):

assert isinstance(response, dict)
assert response["self"] == REMOTE_MS_1
assert response["sharding"] is True
assert len(response["remotes"]) >= 2
assert REMOTE_MS_2 in response["remotes"]
assert REMOTE_MS_1 in response["remotes"]

disable_sharding(client)
reset_network_config(client)
6 changes: 2 additions & 4 deletions tests/client/test_client_sharding.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from tests.common import BASE_URL, REMOTE_MS_1
from tests.test_utils import disable_sharding
from tests.test_utils import reset_network_config


@pytest.mark.usefixtures("enable_network_options")
Expand All @@ -17,7 +17,6 @@ def test_update_and_get_network_settings(client):
"writeApiKey": "write-key-1",
}
},
"sharding": True,
}

client.add_or_update_networks(options)
Expand All @@ -33,5 +32,4 @@ def test_update_and_get_network_settings(client):
response["remotes"][instance_name]["writeApiKey"]
== options["remotes"][instance_name]["writeApiKey"]
)
assert response["sharding"] == options["sharding"]
disable_sharding(client)
reset_network_config(client)
4 changes: 2 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ def test_iso_to_date_time_invalid_format():


# Refactor to use the unified API to toggle experimental features
def disable_sharding(client):
client.add_or_update_networks(body={"sharding": False})
def reset_network_config(client):
client.add_or_update_networks(body={"remotes": {}, "leader": None})