Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay-ju committed Jun 24, 2024
1 parent 8d4baca commit d74163f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions be/test/io/s3_input_stream_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class S3InputStreamTest : public testing::Test {

std::unique_ptr<S3InputStream> new_random_access_file();

std::unique_ptr<S3InputStream> new_random_access_file_prefetch(int64_t read_ahead_size);

protected:
inline static const char* s_bucket_name = nullptr;
};
Expand Down Expand Up @@ -104,6 +106,10 @@ std::unique_ptr<S3InputStream> S3InputStreamTest::new_random_access_file() {
return std::make_unique<S3InputStream>(g_s3client, s_bucket_name, kObjectName);
}

std::unique_ptr<S3InputStream> S3InputStreamTest::new_random_access_file_prefetch(int64_t read_ahead_size) {
return std::make_unique<S3InputStream>(g_s3client, s_bucket_name, kObjectName, read_ahead_size);
}

void S3InputStreamTest::put_object(const std::string& object_content) {
std::shared_ptr<Aws::IOStream> stream = Aws::MakeShared<Aws::StringStream>("", object_content);

Expand Down Expand Up @@ -204,4 +210,10 @@ TEST_F(S3InputStreamTest, test_read_all) {
EXPECT_EQ(kObjectContent, s);
}

TEST_F(S3InputStreamTest, test_prefetch) {
auto f = new_random_access_file_prefetch(10);
char buf[60];
ASSIGN_OR_ABORT(auto r, f->read(buf, sizeof(buf)));
ASSERT_EQ("1234567", std::string_view(buf, r));
}
} // namespace starrocks::io

0 comments on commit d74163f

Please sign in to comment.