File tree Expand file tree Collapse file tree 4 files changed +24
-4
lines changed
Expand file tree Collapse file tree 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):
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 ()
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ exclude = '''
1616
1717[tool .poetry ]
1818name = " pinecone-client"
19- version = " 4.1.0 "
19+ version = " 4.1.2 "
2020packages = [
2121 { include =" pinecone" , from =" ." },
2222]
Original file line number Diff line number Diff 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" )
You can’t perform that action at this time.
0 commit comments