@@ -44,23 +44,10 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestServiceSpecificEndpoints)
4444 ASSERT_TRUE (globalEndpoint.has_value ());
4545 ASSERT_STREQ (" https://global.example.com" , globalEndpoint->c_str ());
4646
47- // Test service-specific endpoints
48- auto s3Endpoint = Profile::GetServiceEndpointUrl (profile, loader.GetServices (), " s3" );
49- ASSERT_TRUE (s3Endpoint.has_value ());
50- ASSERT_STREQ (" http://localhost:9000" , s3Endpoint->c_str ());
51-
52- auto dynamoEndpoint = Profile::GetServiceEndpointUrl (profile, loader.GetServices (), " dynamodb" );
53- ASSERT_TRUE (dynamoEndpoint.has_value ());
54- ASSERT_STREQ (" http://localhost:8000" , dynamoEndpoint->c_str ());
55-
56- // Test case insensitive service lookup
57- auto s3EndpointUpper = Profile::GetServiceEndpointUrl (profile, loader.GetServices (), " S3" );
58- ASSERT_TRUE (s3EndpointUpper.has_value ());
59- ASSERT_STREQ (" http://localhost:9000" , s3EndpointUpper->c_str ());
60-
61- // Test non-existent service
62- auto nonExistent = Profile::GetServiceEndpointUrl (profile, loader.GetServices (), " nonexistent" );
63- ASSERT_FALSE (nonExistent.has_value ());
47+ // Test services name is parsed correctly
48+ auto servicesName = profile.GetServicesName ();
49+ ASSERT_TRUE (servicesName.has_value ());
50+ ASSERT_STREQ (" myservices" , servicesName->c_str ());
6451
6552}
6653
@@ -85,15 +72,10 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestServiceSpecificEndpointsOnly)
8572 auto globalEndpoint = profile.GetEndpointUrl ();
8673 ASSERT_FALSE (globalEndpoint.has_value ());
8774
88- // Test service-specific endpoint
89- auto s3Endpoint = Profile::GetServiceEndpointUrl (profile, loader.GetServices (), " s3" );
90- ASSERT_TRUE (s3Endpoint.has_value ());
91- ASSERT_STREQ (" https://play.min.io:9000" , s3Endpoint->c_str ());
92-
93- // Test case insensitive lookup
94- auto s3EndpointUpper = Profile::GetServiceEndpointUrl (profile, loader.GetServices (), " S3" );
95- ASSERT_TRUE (s3EndpointUpper.has_value ());
96- ASSERT_STREQ (" https://play.min.io:9000" , s3EndpointUpper->c_str ());
75+ // Test services name is parsed correctly
76+ auto servicesName = profile.GetServicesName ();
77+ ASSERT_TRUE (servicesName.has_value ());
78+ ASSERT_STREQ (" s3-minio" , servicesName->c_str ());
9779}
9880
9981TEST_F (ServiceEndpointsConfigFileLoaderTest, TestGlobalEndpointOnly)
@@ -115,9 +97,9 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestGlobalEndpointOnly)
11597 ASSERT_TRUE (globalEndpoint.has_value ());
11698 ASSERT_STREQ (" https://play.min.io:9000" , globalEndpoint->c_str ());
11799
118- // Test that service-specific endpoint is null when not set
119- auto s3Endpoint = Profile::GetServiceEndpointUrl ( profile, loader. GetServices (), " s3 " );
120- ASSERT_FALSE (s3Endpoint .has_value ());
100+ // Test that services name is not set
101+ auto servicesName = profile. GetServicesName ( );
102+ ASSERT_FALSE (servicesName .has_value ());
121103}
122104
123105TEST_F (ServiceEndpointsConfigFileLoaderTest, TestServiceSpecificAndGlobalEndpoints)
@@ -138,19 +120,15 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestServiceSpecificAndGlobalEndpoin
138120 auto profiles = loader.GetProfiles ();
139121 const auto & profile = profiles[" dev-s3-specific-and-global" ];
140122
141- // Test service-specific S3 endpoint
142- auto s3Endpoint = Profile::GetServiceEndpointUrl ( profile, loader. GetServices (), " s3 " );
143- ASSERT_TRUE (s3Endpoint .has_value ());
144- ASSERT_STREQ (" https://play.min.io:9000 " , s3Endpoint ->c_str ());
123+ // Test services name is parsed correctly
124+ auto servicesName = profile. GetServicesName ( );
125+ ASSERT_TRUE (servicesName .has_value ());
126+ ASSERT_STREQ (" s3-specific-and-global " , servicesName ->c_str ());
145127
146- // Test global endpoint for other services
128+ // Test global endpoint
147129 auto globalEndpoint = profile.GetEndpointUrl ();
148130 ASSERT_TRUE (globalEndpoint.has_value ());
149131 ASSERT_STREQ (" http://localhost:1234" , globalEndpoint->c_str ());
150-
151- // Test that non-configured service returns null (would fall back to global)
152- auto dynamoEndpoint = Profile::GetServiceEndpointUrl (profile, loader.GetServices (), " dynamodb" );
153- ASSERT_FALSE (dynamoEndpoint.has_value ());
154132}
155133
156134TEST_F (ServiceEndpointsConfigFileLoaderTest, TestMultipleServicesInDefinition)
@@ -172,20 +150,10 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestMultipleServicesInDefinition)
172150 auto profiles = loader.GetProfiles ();
173151 const auto & profile = profiles[" dev" ];
174152
175- // Test S3 endpoint
176- auto s3Endpoint = Profile::GetServiceEndpointUrl (profile, loader.GetServices (), " s3" );
177- ASSERT_TRUE (s3Endpoint.has_value ());
178- ASSERT_STREQ (" http://localhost:4567" , s3Endpoint->c_str ());
179-
180- // Test Elastic Beanstalk endpoint with normalized service ID
181- auto ebEndpoint = Profile::GetServiceEndpointUrl (profile, loader.GetServices (), " Elastic Beanstalk" );
182- ASSERT_TRUE (ebEndpoint.has_value ());
183- ASSERT_STREQ (" http://localhost:8000" , ebEndpoint->c_str ());
184-
185- // Test direct normalized lookup
186- auto ebEndpointDirect = Profile::GetServiceEndpointUrl (profile, loader.GetServices (), " elastic_beanstalk" );
187- ASSERT_TRUE (ebEndpointDirect.has_value ());
188- ASSERT_STREQ (" http://localhost:8000" , ebEndpointDirect->c_str ());
153+ // Test services name is parsed correctly
154+ auto servicesName = profile.GetServicesName ();
155+ ASSERT_TRUE (servicesName.has_value ());
156+ ASSERT_STREQ (" testing-s3-and-eb" , servicesName->c_str ());
189157}
190158
191159TEST_F (ServiceEndpointsConfigFileLoaderTest, TestIgnoreGlobalEndpointInServicesSection)
@@ -208,9 +176,10 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestIgnoreGlobalEndpointInServicesS
208176 auto globalEndpoint = profile.GetEndpointUrl ();
209177 ASSERT_FALSE (globalEndpoint.has_value ());
210178
211- // Test that service-specific endpoints return null (no services configured)
212- auto s3Endpoint = Profile::GetServiceEndpointUrl (profile, loader.GetServices (), " s3" );
213- ASSERT_FALSE (s3Endpoint.has_value ());
179+ // Test that services name is parsed correctly
180+ auto servicesName = profile.GetServicesName ();
181+ ASSERT_TRUE (servicesName.has_value ());
182+ ASSERT_STREQ (" bad-service-definition" , servicesName->c_str ());
214183}
215184
216185TEST_F (ServiceEndpointsConfigFileLoaderTest, TestSourceProfileEndpointIsolation)
@@ -236,10 +205,10 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestSourceProfileEndpointIsolation)
236205 const auto & profileB = profiles[" B" ];
237206 const auto & profileA = profiles[" A" ];
238207
239- // Test that profile B gets EC2 endpoint from its own services definition
240- auto ec2Endpoint = Profile::GetServiceEndpointUrl ( profileB, loader. GetServices (), " ec2 " );
241- ASSERT_TRUE (ec2Endpoint .has_value ());
242- ASSERT_STREQ (" https://profile-b-ec2-endpoint.aws " , ec2Endpoint ->c_str ());
208+ // Test that profile B has services name
209+ auto servicesBName = profileB. GetServicesName ( );
210+ ASSERT_TRUE (servicesBName .has_value ());
211+ ASSERT_STREQ (" profileB " , servicesBName ->c_str ());
243212
244213 // Test that profile B has no global endpoint (doesn't inherit from profile A)
245214 auto globalEndpointB = profileB.GetEndpointUrl ();
@@ -250,9 +219,9 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestSourceProfileEndpointIsolation)
250219 ASSERT_TRUE (globalEndpointA.has_value ());
251220 ASSERT_STREQ (" https://profile-a-endpoint.aws/" , globalEndpointA->c_str ());
252221
253- // Test that other services in profile B return null ( no chaining to profile A)
254- auto s3Endpoint = Profile::GetServiceEndpointUrl (profileB, loader. GetServices (), " s3 " );
255- ASSERT_FALSE (s3Endpoint .has_value ());
222+ // Test that profile A has no services name
223+ auto servicesAName = profileA. GetServicesName ( );
224+ ASSERT_FALSE (servicesAName .has_value ());
256225}
257226TEST_F (ServiceEndpointsConfigFileLoaderTest, TestIgnoreConfiguredEndpointUrls)
258227{
0 commit comments