MCPcopy Create free account
hub / github.com/apache/arrow / TestCreateDir

Method TestCreateDir

cpp/src/arrow/filesystem/test_util.cc:236–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234}
235
236void GenericFileSystemTest::TestCreateDir(FileSystem* fs) {
237 ASSERT_OK(fs->CreateDir("AB"));
238 ASSERT_OK(fs->CreateDir("AB/CD/EF")); // Recursive
239 if (!have_implicit_directories()) {
240 // Non-recursive, parent doesn't exist
241 ASSERT_RAISES(IOError, fs->CreateDir("AB/GH/IJ", false /* recursive */));
242 }
243 ASSERT_OK(fs->CreateDir("AB/GH", false /* recursive */));
244 ASSERT_OK(fs->CreateDir("AB/GH/IJ", false /* recursive */));
245 // Idempotency
246 ASSERT_OK(fs->CreateDir("AB/GH/IJ", false /* recursive */));
247 ASSERT_OK(fs->CreateDir("XY"));
248
249 AssertAllDirs(fs, {"AB", "AB/CD", "AB/CD/EF", "AB/GH", "AB/GH/IJ", "XY"});
250 AssertAllFiles(fs, {});
251
252 // Cannot create a directory as child of a file
253 CreateFile(fs, "AB/def", "");
254 ASSERT_RAISES(IOError, fs->CreateDir("AB/def/EF/GH", true /* recursive */));
255 ASSERT_RAISES(IOError, fs->CreateDir("AB/def/EF", false /* recursive */));
256
257 // Cannot create a directory when there is already a file with the same name
258 ASSERT_RAISES(IOError, fs->CreateDir("AB/def"));
259
260 AssertAllDirs(fs, {"AB", "AB/CD", "AB/CD/EF", "AB/GH", "AB/GH/IJ", "XY"});
261 AssertAllFiles(fs, {"AB/def"});
262}
263
264void GenericFileSystemTest::TestDeleteDir(FileSystem* fs) {
265 if (have_flaky_directory_tree_deletion()) GTEST_SKIP() << "Flaky directory deletion";

Callers

nothing calls this directly

Calls 5

AssertAllDirsFunction · 0.85
AssertAllFilesFunction · 0.85
CreateFileFunction · 0.85
CreateDirMethod · 0.45

Tested by

no test coverage detected