Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ std::unique_ptr<MockAsyncBidiWriteObjectStream> MakeCommonAppendStream(
response.mutable_resource()->set_size(persisted_size + 1024);
return std::make_optional(std::move(response));
});
})
// The third `Read()` call returns EOF.
.WillOnce([&] {
return sequencer.PushBack("Read(EOF)").then([](auto) {
return std::optional<google::storage::v2::BidiWriteObjectResponse>();
});
});

EXPECT_CALL(*stream, Cancel).Times(1);
Expand Down Expand Up @@ -304,6 +310,12 @@ TEST_F(AsyncConnectionImplAppendableTest, StartAppendableObjectUploadSuccess) {
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Read(FinalObject)");
next.first.set_value(true);
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Read(EOF)");
next.first.set_value(true);
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Finish");
next.first.set_value(true);

auto response = w2.get();
ASSERT_STATUS_OK(response);
Expand All @@ -312,9 +324,6 @@ TEST_F(AsyncConnectionImplAppendableTest, StartAppendableObjectUploadSuccess) {
EXPECT_EQ(response->size(), 1024);

writer.reset();
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Finish");
next.first.set_value(true);
}

TEST_F(AsyncConnectionImplAppendableTest, ResumeAppendableObjectUploadSuccess) {
Expand Down Expand Up @@ -370,15 +379,18 @@ TEST_F(AsyncConnectionImplAppendableTest, ResumeAppendableObjectUploadSuccess) {
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Read(FinalObject)");
next.first.set_value(true);
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Read(EOF)");
next.first.set_value(true);
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Finish");
next.first.set_value(true);

auto response = w2.get();
ASSERT_STATUS_OK(response);
EXPECT_EQ(response->size(), kPersistedSize + 1024);

writer.reset();
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Finish");
next.first.set_value(true);
}

TEST_F(AsyncConnectionImplAppendableTest, AppendableUploadTooManyTransients) {
Expand Down Expand Up @@ -517,6 +529,12 @@ TEST_F(AsyncConnectionImplAppendableTest, AppendableUploadRedirect) {
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Read(FinalObject)");
next.first.set_value(true);
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Read(EOF)");
next.first.set_value(true);
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Finish");
next.first.set_value(true);

auto response = w2.get();
ASSERT_STATUS_OK(response);
Expand All @@ -525,9 +543,6 @@ TEST_F(AsyncConnectionImplAppendableTest, AppendableUploadRedirect) {
EXPECT_EQ(response->size(), 1024 + 1024);

writer.reset();
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Finish");
next.first.set_value(true);
}

TEST_F(AsyncConnectionImplAppendableTest, AppendableUploadRedirectNoHandle) {
Expand Down Expand Up @@ -614,6 +629,12 @@ TEST_F(AsyncConnectionImplAppendableTest, AppendableUploadRedirectNoHandle) {
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Read(FinalObject)");
next.first.set_value(true);
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Read(EOF)");
next.first.set_value(true);
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Finish");
next.first.set_value(true);

auto response = w2.get();
ASSERT_STATUS_OK(response);
Expand All @@ -622,9 +643,6 @@ TEST_F(AsyncConnectionImplAppendableTest, AppendableUploadRedirectNoHandle) {
EXPECT_EQ(response->size(), 1024 + 1024);

writer.reset();
next = sequencer.PopFrontWithName();
EXPECT_EQ(next.second, "Finish");
next.first.set_value(true);
}
} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Loading
Loading