Skip to content

Commit

Permalink
Adjust handling of missing credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-Newton committed Nov 7, 2023
1 parent 4d114aa commit 7fe94f1
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions cpp/src/arrow/filesystem/azurefs_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class AzureFileSystemTest : public ::testing::Test {
void SetUp() override {
auto options = MakeOptions();
if (options.ok()) {
options_ = options.ValueOrDie();
options_ = *options;
} else {
suite_skipped_ = true;
GTEST_SKIP() << options.status().message();
Expand Down Expand Up @@ -255,10 +255,10 @@ class AzuriteFileSystemTest : public AzureFileSystemTest {
class AzureFlatNamespaceFileSystemTest : public AzureFileSystemTest {
Result<AzureOptions> MakeOptions() override {
AzureOptions options;
if (const auto account_name = std::getenv("AZURE_FLAT_NAMESPACE_ACCOUNT_NAME")) {
const auto account_key = std::getenv("AZURE_FLAT_NAMESPACE_ACCOUNT_KEY");
EXPECT_THAT(account_key, NotNull());
ARROW_EXPECT_OK(options.ConfigureAccountKeyCredentials(account_name, account_key));
const auto account_key = std::getenv("AZURE_FLAT_NAMESPACE_ACCOUNT_KEY");
const auto account_name = std::getenv("AZURE_FLAT_NAMESPACE_ACCOUNT_NAME");
if (account_key && account_name) {
RETURN_NOT_OK(options.ConfigureAccountKeyCredentials(account_name, account_key));
return options;
}
return Status::Cancelled(
Expand All @@ -270,14 +270,14 @@ class AzureFlatNamespaceFileSystemTest : public AzureFileSystemTest {
class AzureHierarchicalNamespaceFileSystemTest : public AzureFileSystemTest {
Result<AzureOptions> MakeOptions() override {
AzureOptions options;
if (const auto account_name = std::getenv("AZURE_HIERARCHICAL_NAMESPACE_ACCOUNT_NAME")) {
const auto account_key = std::getenv("AZURE_HIERARCHICAL_NAMESPACE_ACCOUNT_KEY");
EXPECT_THAT(account_key, NotNull());
ARROW_EXPECT_OK(options.ConfigureAccountKeyCredentials(account_name, account_key));
const auto account_key = std::getenv("AZURE_HIERARCHICAL_NAMESPACE_ACCOUNT_KEY");
const auto account_name = std::getenv("AZURE_HIERARCHICAL_NAMESPACE_ACCOUNT_NAME");
if (account_key && account_name) {
RETURN_NOT_OK(options.ConfigureAccountKeyCredentials(account_name, account_key));
return options;
}
return Status::Cancelled(
"Connection details not provided for a real hierachical namespace "
"Connection details not provided for a real hierarchical namespace "
"account.");
}
};
Expand Down Expand Up @@ -382,10 +382,9 @@ void AzureFileSystemTest::RunGetFileInfoObjectTest() {
.GetProperties()
.Value;

AssertFileInfo(
fs_.get(), PreexistingObjectPath(), FileType::File,
std::chrono::system_clock::time_point(object_properties.LastModified),
static_cast<int64_t>(object_properties.BlobSize));
AssertFileInfo(fs_.get(), PreexistingObjectPath(), FileType::File,
std::chrono::system_clock::time_point(object_properties.LastModified),
static_cast<int64_t>(object_properties.BlobSize));

// URI
ASSERT_RAISES(Invalid, fs_->GetFileInfo("abfs://" + PreexistingObjectName()));
Expand Down

0 comments on commit 7fe94f1

Please sign in to comment.