Open ggallani-chwy opened 1 year ago
I have the following folder structure for my file-based S3Mock:
Searching my bucket with the "2020/12/30/" prefix returns one common prefix instead of 2.
api = new S3Mock.Builder() .withFileBackend("src/test/resources/s3") .withPort(8001) .build(); api.start(); ... @Test public void test_s3_setup() { SdkHttpClient httpClient = UrlConnectionHttpClient.builder() .connectionTimeout(Duration.ofSeconds(10)) .socketTimeout(Duration.ofSeconds(10)) .build(); S3Configuration config = S3Configuration.builder() .pathStyleAccessEnabled(true) .build(); S3Client client = S3Client.builder() .endpointOverride(URI.create("http://localhost:8001")) .credentialsProvider(AnonymousCredentialsProvider.create()) .httpClient(httpClient) .serviceConfiguration(config) .build(); ListObjectsRequest listObjectsRequest = ListObjectsRequest .builder() .bucket(BUCKET_NAME) .prefix("2020/12/30/") .delimiter("/") .build(); ListObjectsRequest listObjectsRequestB = ListObjectsRequest .builder() .bucket(BUCKET_NAME) .prefix("2020/12/30/BASELINE/") .delimiter("/") .build(); ListObjectsRequest listObjectsRequestT = ListObjectsRequest .builder() .bucket(BUCKET_NAME) .prefix("2020/12/30/TEST/") .delimiter("/") .build(); List<String> buckets = client.listBuckets().buckets().stream().map(Bucket::name).collect(Collectors.toList()); assertTrue(buckets.contains(BUCKET_NAME)); // works List<String> baseline = client.listObjects(listObjectsRequestB).commonPrefixes().stream() .map(CommonPrefix::prefix).collect(Collectors.toList()); assertThat(baseline) .isEqualTo(List.of("2020/12/30/BASELINE/BATCH_PRICING_INFO/")); // works List<String> test = client.listObjects(listObjectsRequestT).commonPrefixes().stream() .map(CommonPrefix::prefix).collect(Collectors.toList()); assertThat(test) .isEqualTo(List.of("2020/12/30/TEST/BATCH_PRICING_INFO/")); // works List<String> envs = client.listObjects(listObjectsRequest).commonPrefixes().stream() .map(CommonPrefix::prefix).collect(Collectors.toList()); assertThat(envs) .isEqualTo(List.of("2020/12/30/BASELINE/", "2020/12/30/TEST/")); // fails, the response only contains "2020/12/30/BASELINE/" }
I have the following folder structure for my file-based S3Mock:![image](https://github.com/findify/s3mock/assets/92734744/a5d1f75a-61c8-400f-897c-720eb3c64036)
Searching my bucket with the "2020/12/30/" prefix returns one common prefix instead of 2.