-
Notifications
You must be signed in to change notification settings - Fork 91
Add Or Update Networks #1097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
brunoocasali
merged 15 commits into
meilisearch:main
from
MuddyHope:remote_fedarated_search
Jun 20, 2025
Merged
Add Or Update Networks #1097
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
cce408b
Add Or Update Networks
MuddyHope edd7579
mypy fixes
MuddyHope 1c0c993
Adding Test cases for remote-search
MuddyHope 73e7e6a
Adding Test cases for remote-search
MuddyHope 9c4124c
Adding Test cases for remote-search
MuddyHope 1c8a010
adding fixes
MuddyHope 3d12d2c
adding fixes for test cases
MuddyHope da0cb29
fixes
MuddyHope 4a52d18
fixes
MuddyHope ca2111a
fixes
MuddyHope 0ffd4e3
fixes
MuddyHope cf61cf1
Update meilisearch/client.py
MuddyHope 7dcf7d0
Merge branch 'main' into remote_fedarated_search
MuddyHope 17f1ecd
Merge branch 'main' into remote_fedarated_search
brunoocasali bd9f808
Fix pylint/black
brunoocasali File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,30 @@ | ||
import pytest | ||
|
||
from tests.common import REMOTE_MS_1, REMOTE_MS_2 | ||
|
||
|
||
@pytest.mark.usefixtures("enable_network_options") | ||
def test_get_all_networks(client): | ||
"""Tests get all network in MS""" | ||
response = client.get_all_networks() | ||
|
||
assert isinstance(response, dict) | ||
|
||
|
||
@pytest.mark.usefixtures("enable_network_options") | ||
def test_add_or_update_networks(client): | ||
"""Tests upsert network remote instance.""" | ||
body = { | ||
"self": REMOTE_MS_1, | ||
"remotes": { | ||
REMOTE_MS_1: {"url": "http://localhost:7700", "searchApiKey": "xxxxxxxxxxxxxx"}, | ||
REMOTE_MS_2: {"url": "http://localhost:7720", "searchApiKey": "xxxxxxxxxxxxxxx"}, | ||
}, | ||
} | ||
response = client.add_or_update_networks(body=body) | ||
|
||
assert isinstance(response, dict) | ||
assert response["self"] == REMOTE_MS_1 | ||
assert len(response["remotes"]) >= 2 | ||
assert REMOTE_MS_2 in response["remotes"] | ||
assert REMOTE_MS_1 in response["remotes"] | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Consider adding edge case tests
The happy path test looks good, but consider adding tests for edge cases such as:
Also, ensure that the test URLs don't point to actual production services. The current localhost URLs look good, but it's worth verifying these are test environments only.
🏁 Script executed:
Length of output: 1884
Enhance
test_add_or_update_networks
with edge‐case coverageWhile the happy-path for upserting networks looks solid, please add tests for these scenarios in tests/client/test_client_network.py:
remotes
dictionary (what should the response be? error vs. no-ops)htp://…
) or missing/invalid API keysself
value not included in theremotes
payloadNote: this test already uses only
localhost
endpoints, so there’s no risk of hitting production services here.🤖 Prompt for AI Agents