@@ -46,11 +46,13 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestServiceSpecificEndpoints)
4646 ASSERT_TRUE (globalEndpoint.has_value ());
4747 ASSERT_STREQ (" https://global.example.com" , globalEndpoint->c_str ());
4848
49- // Test services name is parsed correctly
50- auto servicesName = profile.GetServicesName ();
51- ASSERT_TRUE (servicesName.has_value ());
52- ASSERT_STREQ (" myservices" , servicesName->c_str ());
53-
49+ // Test services endpoints are parsed correctly
50+ const auto & services = profile.GetServiceEndpoints ();
51+ ASSERT_TRUE (services.IsSet ());
52+ const auto & endpoints = services.GetEndpoints ();
53+ ASSERT_EQ (2u , endpoints.size ());
54+ ASSERT_EQ (" http://localhost:9000" , endpoints.at (" S3" ));
55+ ASSERT_EQ (" http://localhost:8000" , endpoints.at (" DYNAMODB" ));
5456}
5557
5658TEST_F (ServiceEndpointsConfigFileLoaderTest, TestServiceSpecificEndpointsOnly)
@@ -76,10 +78,12 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestServiceSpecificEndpointsOnly)
7678 auto globalEndpoint = profile.GetEndpointUrl ();
7779 ASSERT_FALSE (globalEndpoint.has_value ());
7880
79- // Test services name is parsed correctly
80- auto servicesName = profile.GetServicesName ();
81- ASSERT_TRUE (servicesName.has_value ());
82- ASSERT_STREQ (" s3-minio" , servicesName->c_str ());
81+ // Test services endpoints are parsed correctly
82+ const auto & services = profile.GetServiceEndpoints ();
83+ ASSERT_TRUE (services.IsSet ());
84+ const auto & endpoints = services.GetEndpoints ();
85+ ASSERT_EQ (1u , endpoints.size ());
86+ ASSERT_EQ (" https://play.min.io:9000" , endpoints.at (" S3" ));
8387}
8488
8589TEST_F (ServiceEndpointsConfigFileLoaderTest, TestGlobalEndpointOnly)
@@ -103,9 +107,9 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestGlobalEndpointOnly)
103107 ASSERT_TRUE (globalEndpoint.has_value ());
104108 ASSERT_STREQ (" https://play.min.io:9000" , globalEndpoint->c_str ());
105109
106- // Test that services name is not set
107- auto servicesName = profile.GetServicesName ();
108- ASSERT_FALSE (servicesName. has_value ());
110+ // Test that services endpoints are not set
111+ const auto & services = profile.GetServiceEndpoints ();
112+ ASSERT_FALSE (services. IsSet ());
109113}
110114
111115TEST_F (ServiceEndpointsConfigFileLoaderTest, TestServiceSpecificAndGlobalEndpoints)
@@ -128,10 +132,12 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestServiceSpecificAndGlobalEndpoin
128132 ASSERT_NE (profiles.end (), profileIt);
129133 const auto & profile = profileIt->second ;
130134
131- // Test services name is parsed correctly
132- auto servicesName = profile.GetServicesName ();
133- ASSERT_TRUE (servicesName.has_value ());
134- ASSERT_STREQ (" s3-specific-and-global" , servicesName->c_str ());
135+ // Test services endpoints are parsed correctly
136+ const auto & services = profile.GetServiceEndpoints ();
137+ ASSERT_TRUE (services.IsSet ());
138+ const auto & endpoints = services.GetEndpoints ();
139+ ASSERT_EQ (1u , endpoints.size ());
140+ ASSERT_EQ (" https://play.min.io:9000" , endpoints.at (" S3" ));
135141
136142 // Test global endpoint
137143 auto globalEndpoint = profile.GetEndpointUrl ();
@@ -160,10 +166,13 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestMultipleServicesInDefinition)
160166 ASSERT_NE (profiles.end (), profileIt);
161167 const auto & profile = profileIt->second ;
162168
163- // Test services name is parsed correctly
164- auto servicesName = profile.GetServicesName ();
165- ASSERT_TRUE (servicesName.has_value ());
166- ASSERT_STREQ (" testing-s3-and-eb" , servicesName->c_str ());
169+ // Test services endpoints are parsed correctly
170+ const auto & services = profile.GetServiceEndpoints ();
171+ ASSERT_TRUE (services.IsSet ());
172+ const auto & endpoints = services.GetEndpoints ();
173+ ASSERT_EQ (2u , endpoints.size ());
174+ ASSERT_EQ (" http://localhost:4567" , endpoints.at (" S3" ));
175+ ASSERT_EQ (" http://localhost:8000" , endpoints.at (" ELASTIC_BEANSTALK" ));
167176}
168177
169178TEST_F (ServiceEndpointsConfigFileLoaderTest, TestIgnoreGlobalEndpointInServicesSection)
@@ -188,10 +197,11 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestIgnoreGlobalEndpointInServicesS
188197 auto globalEndpoint = profile.GetEndpointUrl ();
189198 ASSERT_FALSE (globalEndpoint.has_value ());
190199
191- // Test that services name is parsed correctly
192- auto servicesName = profile.GetServicesName ();
193- ASSERT_TRUE (servicesName.has_value ());
194- ASSERT_STREQ (" bad-service-definition" , servicesName->c_str ());
200+ // Test that services endpoints are empty (global endpoint_url ignored)
201+ const auto & services = profile.GetServiceEndpoints ();
202+ ASSERT_TRUE (services.IsSet ());
203+ const auto & endpoints = services.GetEndpoints ();
204+ ASSERT_EQ (0u , endpoints.size ());
195205}
196206
197207TEST_F (ServiceEndpointsConfigFileLoaderTest, TestSourceProfileEndpointIsolation)
@@ -221,10 +231,12 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestSourceProfileEndpointIsolation)
221231 ASSERT_NE (profiles.end (), profileAIt);
222232 const auto & profileA = profileAIt->second ;
223233
224- // Test that profile B has services name
225- auto servicesBName = profileB.GetServicesName ();
226- ASSERT_TRUE (servicesBName.has_value ());
227- ASSERT_STREQ (" profileB" , servicesBName->c_str ());
234+ // Test that profile B has services endpoints
235+ const auto & servicesB = profileB.GetServiceEndpoints ();
236+ ASSERT_TRUE (servicesB.IsSet ());
237+ const auto & endpointsB = servicesB.GetEndpoints ();
238+ ASSERT_EQ (1u , endpointsB.size ());
239+ ASSERT_EQ (" https://profile-b-ec2-endpoint.aws" , endpointsB.at (" EC2" ));
228240
229241 // Test that profile B has no global endpoint (doesn't inherit from profile A)
230242 auto globalEndpointB = profileB.GetEndpointUrl ();
@@ -236,9 +248,10 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestSourceProfileEndpointIsolation)
236248 ASSERT_STREQ (" https://profile-a-endpoint.aws/" , globalEndpointA->c_str ());
237249
238250 // Test that profile A has no services name
239- auto servicesAName = profileA.GetServicesName ();
240- ASSERT_FALSE (servicesAName. has_value ());
251+ const auto & servicesA = profileA.GetServiceEndpoints ();
252+ ASSERT_FALSE (servicesA. IsSet ());
241253}
254+
242255TEST_F (ServiceEndpointsConfigFileLoaderTest, TestIgnoreConfiguredEndpointUrls)
243256{
244257 TempFile configFile (std::ios_base::out | std::ios_base::trunc);
@@ -285,8 +298,10 @@ TEST_F(ServiceEndpointsConfigFileLoaderTest, TestMultipleServicesDefinitions)
285298 ASSERT_NE (profiles.end (), profileIt);
286299 const auto & profile = profileIt->second ;
287300
288- // Test services name is parsed correctly
289- auto servicesName = profile.GetServicesName ();
290- ASSERT_TRUE (servicesName.has_value ());
291- ASSERT_STREQ (" foo" , servicesName->c_str ());
301+ // Test services endpoints are parsed correctly
302+ const auto & services = profile.GetServiceEndpoints ();
303+ ASSERT_TRUE (services.IsSet ());
304+ const auto & endpoints = services.GetEndpoints ();
305+ ASSERT_EQ (1u , endpoints.size ());
306+ ASSERT_EQ (" http://foo.com" , endpoints.at (" S3" ));
292307}
0 commit comments