-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update default channel pool options when creating grpc channels (#887)
* Updating channel pool so that it doesn't limit message size for a channel and will bypass proxies when target address is on the localhost. * Brad's feedback. * Formatting to conform to style guide.
- Loading branch information
1 parent
e3ca88b
commit 4bb38e9
Showing
4 changed files
with
80 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Unit tests for ni_measurement_plugin_sdk_service.grpc.""" |
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 @@ | ||
"""Unit tests for ni_measurement_plugin_sdk_service.grpc.channelpool.""" |
32 changes: 32 additions & 0 deletions
32
packages/service/tests/unit/grpc/channelpool/test_channel_pool.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,32 @@ | ||
import pytest | ||
|
||
from ni_measurement_plugin_sdk_service.grpc.channelpool import GrpcChannelPool | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"target,expected_result", | ||
[ | ||
("127.0.0.1", False), # Port must be specified explicitly | ||
("[::1]", False), # Port must be specified explicitly | ||
("localhost", False), # Port must be specified explicitly | ||
("127.0.0.1:100", True), | ||
("[::1]:100", True), | ||
("localhost:100", True), | ||
("http://127.0.0.1", False), # Port must be specified explicitly | ||
("http://[::1]", False), # Port must be specified explicitly | ||
("http://localhost", False), # Port must be specified explicitly | ||
("http://127.0.0.1:100", True), | ||
("http://[::1]:100", True), | ||
("http://localhost:100", True), | ||
("1.1.1.1:100", False), | ||
("http://www.google.com:80", False), | ||
], | ||
) | ||
def test___channel_pool___is_local___returns_expected_result( | ||
target: str, expected_result: bool | ||
) -> None: | ||
channel_pool = GrpcChannelPool() | ||
|
||
result = channel_pool._is_local(target) | ||
|
||
assert result == expected_result |