Skip to content

Commit 54b5e34

Browse files
authored
Merge pull request #1184 from orbin123/main
Fix tests: adapt network tests for Meilisearch v1.30 HA changes
2 parents a5c6fe3 + 692dff2 commit 54b5e34

5 files changed

Lines changed: 9 additions & 14 deletions

File tree

tests/client/test_client_multi_search_meilisearch.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from meilisearch.errors import MeilisearchApiError
44
from tests.common import INDEX_UID, REMOTE_MS_1, REMOTE_MS_2
5-
from tests.test_utils import disable_sharding
5+
from tests.test_utils import reset_network_config
66

77

88
def test_basic_multi_search(client, empty_index):
@@ -85,7 +85,6 @@ def test_multi_search_with_network(client, index_with_documents):
8585
resp = client.add_or_update_networks(
8686
{
8787
"self": REMOTE_MS_1,
88-
"sharding": True,
8988
"remotes": {
9089
REMOTE_MS_1: {
9190
"url": "http://ms-1235.example.meilisearch.io",
@@ -112,4 +111,4 @@ def test_multi_search_with_network(client, index_with_documents):
112111
assert response["hits"][0]["_federation"]["indexUid"] == INDEX_UID
113112
assert response["hits"][0]["_federation"]["remote"] == REMOTE_MS_1
114113
assert response["remoteErrors"] == {}
115-
disable_sharding(client)
114+
reset_network_config(client)

tests/client/test_client_network.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

33
from tests.common import REMOTE_MS_1, REMOTE_MS_2
4-
from tests.test_utils import disable_sharding
4+
from tests.test_utils import reset_network_config
55

66

77
@pytest.mark.usefixtures("enable_network_options")
@@ -17,7 +17,6 @@ def test_add_or_update_networks(client):
1717
"""Tests upsert network remote instance."""
1818
body = {
1919
"self": REMOTE_MS_1,
20-
"sharding": True,
2120
"remotes": {
2221
REMOTE_MS_1: {
2322
"url": "http://localhost:7700",
@@ -35,9 +34,8 @@ def test_add_or_update_networks(client):
3534

3635
assert isinstance(response, dict)
3736
assert response["self"] == REMOTE_MS_1
38-
assert response["sharding"] is True
3937
assert len(response["remotes"]) >= 2
4038
assert REMOTE_MS_2 in response["remotes"]
4139
assert REMOTE_MS_1 in response["remotes"]
4240

43-
disable_sharding(client)
41+
reset_network_config(client)

tests/client/test_client_sharding.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

33
from tests.common import BASE_URL, REMOTE_MS_1
4-
from tests.test_utils import disable_sharding
4+
from tests.test_utils import reset_network_config
55

66

77
@pytest.mark.usefixtures("enable_network_options")
@@ -17,7 +17,6 @@ def test_update_and_get_network_settings(client):
1717
"writeApiKey": "write-key-1",
1818
}
1919
},
20-
"sharding": True,
2120
}
2221

2322
client.add_or_update_networks(options)
@@ -33,5 +32,4 @@ def test_update_and_get_network_settings(client):
3332
response["remotes"][instance_name]["writeApiKey"]
3433
== options["remotes"][instance_name]["writeApiKey"]
3534
)
36-
assert response["sharding"] == options["sharding"]
37-
disable_sharding(client)
35+
reset_network_config(client)

tests/settings/test_settings_embedders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def test_huggingface_embedder_format(empty_index):
9595
}
9696
}
9797
response = index.update_embedders(huggingface_embedder)
98-
index.wait_for_task(response.task_uid)
98+
index.wait_for_task(response.task_uid, timeout_in_ms=60000) # embedder config can take longer.
9999
embedders = index.get_embedders()
100100
assert embedders.embedders["huggingface"].source == "huggingFace"
101101
assert embedders.embedders["huggingface"].model == "BAAI/bge-base-en-v1.5"

tests/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ def test_iso_to_date_time_invalid_format():
3434

3535

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

0 commit comments

Comments
 (0)