forked from facebookincubator/velox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
48 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,44 +168,44 @@ void readData(ReadFile* readFile) { | |
"ccccc"); | ||
} | ||
|
||
TEST_F(AbfsFileSystemTest, readFile) { | ||
auto hiveConfig = AbfsFileSystemTest::hiveConfig( | ||
{{"fs.azure.account.key.test.dfs.core.windows.net", | ||
azuriteServer->connectionStr()}}); | ||
AbfsFileSystem abfs{hiveConfig}; | ||
auto readFile = abfs.openFileForRead(fullFilePath); | ||
readData(readFile.get()); | ||
} | ||
|
||
TEST_F(AbfsFileSystemTest, openFileForReadWithOptions) { | ||
auto hiveConfig = AbfsFileSystemTest::hiveConfig( | ||
{{"fs.azure.account.key.test.dfs.core.windows.net", | ||
azuriteServer->connectionStr()}}); | ||
auto abfs = std::make_shared<filesystems::abfs::AbfsFileSystem>(hiveConfig); | ||
AbfsFileSystem abfs{hiveConfig}; | ||
FileOptions options; | ||
options.fileSize = 15 + kOneMB; | ||
auto readFile = abfs->openFileForRead(fullFilePath, options); | ||
auto readFile = abfs.openFileForRead(fullFilePath, options); | ||
readData(readFile.get()); | ||
} | ||
|
||
TEST_F(AbfsFileSystemTest, openFileForReadWithInvalidOptions) { | ||
auto hiveConfig = AbfsFileSystemTest::hiveConfig( | ||
{{"fs.azure.account.key.test.dfs.core.windows.net", | ||
azuriteServer->connectionStr()}}); | ||
auto abfs = std::make_shared<filesystems::abfs::AbfsFileSystem>(hiveConfig); | ||
AbfsFileSystem abfs{hiveConfig}; | ||
FileOptions options; | ||
options.fileSize = -kOneMB; | ||
VELOX_ASSERT_THROW( | ||
abfs->openFileForRead(fullFilePath, options), | ||
"Length must be non-negative"); | ||
} | ||
|
||
TEST_F(AbfsFileSystemTest, readFile) { | ||
auto hiveConfig = AbfsFileSystemTest::hiveConfig( | ||
{{"fs.azure.account.key.test.dfs.core.windows.net", | ||
azuriteServer->connectionStr()}}); | ||
auto abfs = std::make_shared<filesystems::abfs::AbfsFileSystem>(hiveConfig); | ||
auto readFile = abfs->openFileForRead(fullFilePath); | ||
readData(readFile.get()); | ||
abfs.openFileForRead(fullFilePath, options), | ||
"File size must be non-negative"); | ||
} | ||
|
||
TEST_F(AbfsFileSystemTest, multipleThreadsWithReadFile) { | ||
std::atomic<bool> startThreads = false; | ||
auto hiveConfig = AbfsFileSystemTest::hiveConfig( | ||
{{"fs.azure.account.key.test.dfs.core.windows.net", | ||
azuriteServer->connectionStr()}}); | ||
auto abfs = std::make_shared<filesystems::abfs::AbfsFileSystem>(hiveConfig); | ||
AbfsFileSystem abfs{hiveConfig}; | ||
|
||
std::vector<std::thread> threads; | ||
std::mt19937 generator(std::random_device{}()); | ||
|
@@ -220,7 +220,7 @@ TEST_F(AbfsFileSystemTest, multipleThreadsWithReadFile) { | |
} | ||
std::this_thread::sleep_for( | ||
std::chrono::microseconds(sleepTimesInMicroseconds[index])); | ||
auto readFile = abfs->openFileForRead(fullFilePath); | ||
auto readFile = abfs.openFileForRead(fullFilePath); | ||
readData(readFile.get()); | ||
}); | ||
threads.emplace_back(std::move(thread)); | ||
|
@@ -237,9 +237,9 @@ TEST_F(AbfsFileSystemTest, missingFile) { | |
azuriteServer->connectionStr()}}); | ||
const std::string abfsFile = | ||
facebook::velox::filesystems::test::AzuriteABFSEndpoint + "test.txt"; | ||
auto abfs = std::make_shared<filesystems::abfs::AbfsFileSystem>(hiveConfig); | ||
AbfsFileSystem abfs{hiveConfig}; | ||
VELOX_ASSERT_RUNTIME_THROW_CODE( | ||
abfs->openFileForRead(abfsFile), error_code::kFileNotFound, "404"); | ||
abfs.openFileForRead(abfsFile), error_code::kFileNotFound, "404"); | ||
} | ||
|
||
TEST_F(AbfsFileSystemTest, OpenFileForWriteTest) { | ||
|
@@ -286,56 +286,56 @@ TEST_F(AbfsFileSystemTest, renameNotImplemented) { | |
auto hiveConfig = AbfsFileSystemTest::hiveConfig( | ||
{{"fs.azure.account.key.test.dfs.core.windows.net", | ||
azuriteServer->connectionStr()}}); | ||
auto abfs = std::make_shared<filesystems::abfs::AbfsFileSystem>(hiveConfig); | ||
AbfsFileSystem abfs{hiveConfig}; | ||
VELOX_ASSERT_THROW( | ||
abfs->rename("text", "text2"), "rename for abfs not implemented"); | ||
abfs.rename("text", "text2"), "rename for abfs not implemented"); | ||
} | ||
|
||
TEST_F(AbfsFileSystemTest, removeNotImplemented) { | ||
auto hiveConfig = AbfsFileSystemTest::hiveConfig( | ||
{{"fs.azure.account.key.test.dfs.core.windows.net", | ||
azuriteServer->connectionStr()}}); | ||
auto abfs = std::make_shared<filesystems::abfs::AbfsFileSystem>(hiveConfig); | ||
VELOX_ASSERT_THROW(abfs->remove("text"), "remove for abfs not implemented"); | ||
AbfsFileSystem abfs{hiveConfig}; | ||
VELOX_ASSERT_THROW(abfs.remove("text"), "remove for abfs not implemented"); | ||
} | ||
|
||
TEST_F(AbfsFileSystemTest, existsNotImplemented) { | ||
auto hiveConfig = AbfsFileSystemTest::hiveConfig( | ||
{{"fs.azure.account.key.test.dfs.core.windows.net", | ||
azuriteServer->connectionStr()}}); | ||
auto abfs = std::make_shared<filesystems::abfs::AbfsFileSystem>(hiveConfig); | ||
VELOX_ASSERT_THROW(abfs->exists("text"), "exists for abfs not implemented"); | ||
AbfsFileSystem abfs{hiveConfig}; | ||
VELOX_ASSERT_THROW(abfs.exists("text"), "exists for abfs not implemented"); | ||
} | ||
|
||
TEST_F(AbfsFileSystemTest, listNotImplemented) { | ||
auto hiveConfig = AbfsFileSystemTest::hiveConfig( | ||
{{"fs.azure.account.key.test.dfs.core.windows.net", | ||
azuriteServer->connectionStr()}}); | ||
auto abfs = std::make_shared<filesystems::abfs::AbfsFileSystem>(hiveConfig); | ||
VELOX_ASSERT_THROW(abfs->list("dir"), "list for abfs not implemented"); | ||
AbfsFileSystem abfs{hiveConfig}; | ||
VELOX_ASSERT_THROW(abfs.list("dir"), "list for abfs not implemented"); | ||
} | ||
|
||
TEST_F(AbfsFileSystemTest, mkdirNotImplemented) { | ||
auto hiveConfig = AbfsFileSystemTest::hiveConfig( | ||
{{"fs.azure.account.key.test.dfs.core.windows.net", | ||
azuriteServer->connectionStr()}}); | ||
auto abfs = std::make_shared<filesystems::abfs::AbfsFileSystem>(hiveConfig); | ||
VELOX_ASSERT_THROW(abfs->mkdir("dir"), "mkdir for abfs not implemented"); | ||
AbfsFileSystem abfs{hiveConfig}; | ||
VELOX_ASSERT_THROW(abfs.mkdir("dir"), "mkdir for abfs not implemented"); | ||
} | ||
|
||
TEST_F(AbfsFileSystemTest, rmdirNotImplemented) { | ||
auto hiveConfig = AbfsFileSystemTest::hiveConfig( | ||
{{"fs.azure.account.key.test.dfs.core.windows.net", | ||
azuriteServer->connectionStr()}}); | ||
auto abfs = std::make_shared<filesystems::abfs::AbfsFileSystem>(hiveConfig); | ||
VELOX_ASSERT_THROW(abfs->rmdir("dir"), "rmdir for abfs not implemented"); | ||
AbfsFileSystem abfs{hiveConfig}; | ||
VELOX_ASSERT_THROW(abfs.rmdir("dir"), "rmdir for abfs not implemented"); | ||
} | ||
|
||
TEST_F(AbfsFileSystemTest, credNotFOund) { | ||
const std::string abfsFile = | ||
std::string("abfs://[email protected]/test"); | ||
auto hiveConfig = AbfsFileSystemTest::hiveConfig({}); | ||
auto abfs = std::make_shared<filesystems::abfs::AbfsFileSystem>(hiveConfig); | ||
AbfsFileSystem abfs{hiveConfig}; | ||
VELOX_ASSERT_THROW( | ||
abfs->openFileForRead(abfsFile), "Failed to find storage credentials"); | ||
abfs.openFileForRead(abfsFile), "Failed to find storage credentials"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters