File tree 4 files changed +24
-4
lines changed
4 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 1
- 4.1.0
1
+ 4.1.2
Original file line number Diff line number Diff line change @@ -88,8 +88,10 @@ def stub_class(self):
88
88
pass
89
89
90
90
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
93
95
94
96
def _gen_channel (self , options = None ):
95
97
target = self ._endpoint ()
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ exclude = '''
16
16
17
17
[tool .poetry ]
18
18
name = " pinecone-client"
19
- version = " 4.1.0 "
19
+ version = " 4.1.2 "
20
20
packages = [
21
21
{ include =" pinecone" , from =" ." },
22
22
]
Original file line number Diff line number Diff line change @@ -85,6 +85,24 @@ def test_config_passed_when_target_by_host(self):
85
85
assert index .grpc_client_config .reuse_channel == True
86
86
assert index .grpc_client_config .conn_timeout == 1
87
87
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
+
88
106
def test_config_passes_source_tag_when_set (self ):
89
107
pc = PineconeGRPC (api_key = "YOUR_API_KEY" , source_tag = "my_source_tag" )
90
108
index = pc .Index (name = "my-index" , host = "host" )
You can’t perform that action at this time.
0 commit comments