| 216 | }; |
| 217 | |
| 218 | Result<Hierarchy> CreateHierarchy(std::shared_ptr<arrow::fs::FileSystem> fs) { |
| 219 | const char* const kTestFolders[] = { |
| 220 | "b", |
| 221 | "b/0", |
| 222 | "b/0/0", |
| 223 | "b/1", |
| 224 | "b/2", |
| 225 | // Create some additional folders that should not appear in any listing of b/ |
| 226 | "aa", |
| 227 | "ba", |
| 228 | "c", |
| 229 | }; |
| 230 | constexpr auto kFilesPerFolder = 2; |
| 231 | auto base_dir = internal::ConcatAbstractPath(PreexistingBucketPath(), "b"); |
| 232 | auto result = Hierarchy{base_dir, {}}; |
| 233 | for (const auto* f : kTestFolders) { |
| 234 | const auto folder = internal::ConcatAbstractPath(PreexistingBucketPath(), f); |
| 235 | RETURN_NOT_OK(fs->CreateDir(folder, true)); |
| 236 | result.contents.push_back(arrow::fs::Dir(folder)); |
| 237 | for (int i = 0; i != kFilesPerFolder; ++i) { |
| 238 | const auto filename = |
| 239 | internal::ConcatAbstractPath(folder, "test-file-" + std::to_string(i)); |
| 240 | CreateFile(fs.get(), filename, filename); |
| 241 | ARROW_ASSIGN_OR_RAISE(auto file_info, fs->GetFileInfo(filename)); |
| 242 | result.contents.push_back(std::move(file_info)); |
| 243 | } |
| 244 | } |
| 245 | return result; |
| 246 | } |
| 247 | |
| 248 | // Directories must appear without a trailing slash in the results. |
| 249 | std::vector<arrow::fs::FileInfo> static CleanupDirectoryNames( |
nothing calls this directly
no test coverage detected