Skip to content

Commit 8e55a96

Browse files
committed
Merge branch 'main' into release-candidate/2024-07
2 parents 9002584 + 8b7e7de commit 8e55a96

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

pinecone/__version__

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.1.0
1+
4.1.2

pinecone/grpc/base.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ def stub_class(self):
8888
pass
8989

9090
def _endpoint(self):
91-
grpcHost = self.config.host.replace("https://", "")
92-
return self._endpoint_override if self._endpoint_override else f"{grpcHost}:443"
91+
grpc_host = self.config.host.replace("https://", "")
92+
if ":" not in grpc_host:
93+
grpc_host = f"{grpc_host}:443"
94+
return self._endpoint_override if self._endpoint_override else grpc_host
9395

9496
def _gen_channel(self, options=None):
9597
target = self._endpoint()

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exclude = '''
1616

1717
[tool.poetry]
1818
name = "pinecone-client"
19-
version = "4.1.0"
19+
version = "4.1.2"
2020
packages = [
2121
{ include="pinecone", from="." },
2222
]

tests/unit_grpc/test_grpc_index_initialization.py

+18
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,24 @@ def test_config_passed_when_target_by_host(self):
8585
assert index.grpc_client_config.reuse_channel == True
8686
assert index.grpc_client_config.conn_timeout == 1
8787

88+
# Endpoint port defaults to 443
89+
assert index._endpoint() == "myhost:443"
90+
91+
def test_config_passed_when_target_by_host_and_port(self):
92+
pc = PineconeGRPC(api_key="YOUR_API_KEY")
93+
config = GRPCClientConfig(timeout=5, secure=False)
94+
index = pc.Index(host="myhost:4343", grpc_config=config)
95+
96+
assert index.grpc_client_config.timeout == 5
97+
assert index.grpc_client_config.secure == False
98+
99+
# Unset fields still get default values
100+
assert index.grpc_client_config.reuse_channel == True
101+
assert index.grpc_client_config.conn_timeout == 1
102+
103+
# Endpoint calculation does not override port
104+
assert index._endpoint() == "myhost:4343"
105+
88106
def test_config_passes_source_tag_when_set(self):
89107
pc = PineconeGRPC(api_key="YOUR_API_KEY", source_tag="my_source_tag")
90108
index = pc.Index(name="my-index", host="host")

0 commit comments

Comments
 (0)