|
30 | 30 | import io.quarkus.test.junit.TestProfile;
|
31 | 31 | import java.io.IOException;
|
32 | 32 | import java.io.InputStream;
|
| 33 | +import java.net.InetAddress; |
33 | 34 | import java.net.URI;
|
34 | 35 | import java.util.List;
|
35 | 36 | import java.util.Map;
|
@@ -223,19 +224,24 @@ public void testCreateTable(boolean pathStyle) throws IOException {
|
223 | 224 | }
|
224 | 225 |
|
225 | 226 | @Test
|
226 |
| - public void testInternalEndpoints() throws IOException { |
| 227 | + public void testInternalEndpoints() throws Exception { |
| 228 | + // Note: this test passed "before", although it should have always failed, because |
| 229 | + // 's3.example.com' cannot be resolved. |
| 230 | + |
| 231 | + // Here, we replace 'localhost' with the IP address. |
| 232 | + var uri = URI.create(endpoint); |
| 233 | + var address = InetAddress.getByName(uri.getHost()).getHostAddress(); |
| 234 | + var endpointByAddress = |
| 235 | + new URI(uri.getScheme(), null, address, uri.getPort(), "/", null, null).toString(); |
227 | 236 | try (RESTCatalog restCatalog =
|
228 | 237 | createCatalog(
|
229 |
| - Optional.of("http://s3.example.com"), |
230 |
| - Optional.of(endpoint), |
231 |
| - false, |
232 |
| - Optional.of(endpoint))) { |
| 238 | + Optional.of(endpointByAddress), Optional.of(endpoint), false, Optional.of(endpoint))) { |
233 | 239 | LoadTableResponse loadTableResponse = doTestCreateTable(restCatalog);
|
234 |
| - assertThat(loadTableResponse.config()).containsEntry("s3.endpoint", "http://s3.example.com"); |
| 240 | + assertThat(loadTableResponse.config()).containsEntry("s3.endpoint", endpointByAddress); |
235 | 241 | }
|
236 | 242 | }
|
237 | 243 |
|
238 |
| - public LoadTableResponse doTestCreateTable(RESTCatalog restCatalog) throws IOException { |
| 244 | + public LoadTableResponse doTestCreateTable(RESTCatalog restCatalog) { |
239 | 245 | catalogApi.createNamespace(catalogName, "test-ns");
|
240 | 246 | TableIdentifier id = TableIdentifier.of("test-ns", "t1");
|
241 | 247 | Table table = restCatalog.createTable(id, SCHEMA);
|
|
0 commit comments