Skip to content

Commit

Permalink
add a test specifically for CloseAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
OliLay committed Aug 13, 2024
1 parent afa111b commit 48bc6be
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cpp/src/arrow/filesystem/azurefs_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,21 @@ class TestAzureFileSystem : public ::testing::Test {
buffers[0] + buffers[1] + buffers[2] + buffers[3]);
}

void TestOpenOutputStreamCloseAsync() {
ASSERT_OK_AND_ASSIGN(auto fs, AzureFileSystem::Make(options_));
auto data = SetUpPreexistingData();
const std::string path = data.ContainerPath("test-write-object");
constexpr auto payload = PreexistingData::kLoremIpsum;

ASSERT_OK_AND_ASSIGN(auto stream, fs->OpenOutputStream(path));
ASSERT_OK(stream->Write(payload));
auto close_fut = stream->CloseAsync();

ASSERT_OK(close_fut.MoveResult());

AssertObjectContents(fs.get(), path, payload);
}

void TestOpenOutputStreamCloseAsyncDestructor() {
ASSERT_OK_AND_ASSIGN(auto fs, AzureFileSystem::Make(options_));
auto data = SetUpPreexistingData();
Expand Down Expand Up @@ -2871,6 +2886,15 @@ TEST_F(TestAzuriteFileSystem, OpenOutputStreamClosed) {
ASSERT_RAISES(Invalid, output->Tell());
}

TEST_F(TestAzuriteFileSystem, OpenOutputStreamCloseAsync) {
TestOpenOutputStreamCloseAsync();
}

TEST_F(TestAzuriteFileSystem, OpenOutputStreamCloseAsyncBackgroundWrites) {
options_.background_writes = true;
TestOpenOutputStreamCloseAsync();
}

TEST_F(TestAzuriteFileSystem, OpenOutputStreamAsyncDestructor) {
TestOpenOutputStreamCloseAsyncDestructor();
}
Expand Down

0 comments on commit 48bc6be

Please sign in to comment.