Skip to content

Commit 1ab39dd

Browse files
committed
Fix object_descriptor_impl_test
1 parent e58c325 commit 1ab39dd

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

google/cloud/storage/internal/async/object_descriptor_impl_test.cc

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,10 @@ TEST(ObjectDescriptorImpl, ReadWithSubsequentStream) {
12861286

12871287
// Mock factory for subsequent streams
12881288
MockFactory factory;
1289-
EXPECT_CALL(factory, Call).WillOnce([&](Request const&) {
1289+
EXPECT_CALL(factory, Call).WillOnce([&](Request const& request) {
1290+
EXPECT_TRUE(request.read_object_spec().has_read_handle());
1291+
EXPECT_EQ(request.read_object_spec().read_handle().handle(),
1292+
"handle-12345");
12901293
auto stream_result = OpenStreamResult{
12911294
std::make_shared<OpenStream>(std::move(stream2)), Response{}};
12921295
return make_ready_future(make_status_or(std::move(stream_result)));
@@ -1330,16 +1333,18 @@ TEST(ObjectDescriptorImpl, ReadWithSubsequentStream) {
13301333
EXPECT_EQ(next.second, "Read[1.eos]");
13311334
next.first.set_value(true);
13321335

1333-
// The first stream should be finishing now.
1336+
// Create and switch to a new stream. This happens before the first
1337+
// stream is finished.
1338+
tested->MakeSubsequentStream();
1339+
1340+
// The events are interleaved. Based on the log, Finish[1] comes first.
13341341
auto finish1 = sequencer.PopFrontWithName();
13351342
EXPECT_EQ(finish1.second, "Finish[1]");
1336-
finish1.first.set_value(true);
1337-
1338-
// Create and switch to a new stream
1339-
tested->MakeSubsequentStream();
13401343

13411344
auto read2 = sequencer.PopFrontWithName();
13421345
EXPECT_EQ(read2.second, "Read[2]");
1346+
finish1.first.set_value(true);
1347+
13431348
// Start a read on the second stream
13441349
auto reader2 = tested->Read({200, 200});
13451350
auto future2 = reader2->Read();

0 commit comments

Comments
 (0)