github-actions[bot] commented on code in PR #17246:
URL: https://github.com/apache/doris/pull/17246#discussion_r1122638213
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -35,27 +39,67 @@
namespace doris {
+using ::testing::_;
+using ::testing::DoAll;
+using ::testing::Return;
+using ::testing::SetArgPointee;
+
static StorageEngine* k_engine = nullptr;
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
+
+class FileWriterMock : public io::FileWriter {
+public:
+ FileWriterMock(Path path) : io::FileWriter(std::move(path)) {}
+ ~FileWriterMock() {}
+
+ MOCK_METHOD0(close, Status());
+ MOCK_METHOD0(abort, Status());
+ MOCK_METHOD1(append, Status(const Slice& data));
+ MOCK_METHOD2(appendv, Status(const Slice* data, size_t data_cnt));
+ MOCK_METHOD2(write_at, Status(size_t offset, const Slice& data));
+ MOCK_METHOD0(finalize, Status());
+ MOCK_METHOD0(bytes_appended, size_t());
+ MOCK_METHOD0(fs, io::FileSystemSPtr());
+};
+
+class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id, io::FileSystemType
type)
+ : RemoteFileSystem(std::move(root_path), std::move(id), type) {}
+ ~RemoteFileSystemMock() {}
+
+ Status create_file(const Path& path, io::FileWriterPtr* writer) override {
+ *writer = std::make_unique<FileWriterMock>("test_path");
+ return Status::OK();
+ }
+ MOCK_METHOD3(open_file, Status(const Path& path, io::FileReaderSPtr*
reader, IOContext* io_ctx));
+ MOCK_METHOD1(delete_file, Status(const Path& path));
+ MOCK_METHOD1(create_directory, Status(const Path& path));
+ MOCK_METHOD1(delete_directory, Status(const Path& path));
+ MOCK_METHOD2(link_file, Status(const Path& src, const Path& dest));
+ MOCK_CONST_METHOD2(exists, Status(const Path& path, bool* res));
+ MOCK_CONST_METHOD2(file_size, Status(const Path& path, size_t* file_size));
+ MOCK_METHOD2(list, Status(const Path& path, std::vector<Path>* files));
+ MOCK_METHOD2(upload, Status(const Path& local_path, const Path&
dest_path));
+ MOCK_METHOD2(batch_upload, Status(const std::vector<Path>& local_paths,
+ const std::vector<Path>& dest_paths));
+ MOCK_METHOD1(batch_delete, Status(const std::vector<Path>& paths));
+ MOCK_METHOD0(connect, Status());
+};
+
class TabletCooldownTest : public testing::Test {
public:
static void SetUpTestSuite() {
- S3Conf s3_conf;
- s3_conf.ak = config::test_s3_ak;
- s3_conf.sk = config::test_s3_sk;
- s3_conf.endpoint = config::test_s3_endpoint;
- s3_conf.region = config::test_s3_region;
- s3_conf.bucket = config::test_s3_bucket;
- s3_conf.prefix = config::test_s3_prefix + "/tablet_cooldown_test";
- auto s3_fs = io::S3FileSystem::create(std::move(s3_conf),
std::to_string(kResourceId));
- ASSERT_TRUE(s3_fs->connect().ok());
- put_storage_resource(kResourceId, {s3_fs, 1});
+ s_fs.reset(new RemoteFileSystemMock("test_path",
std::to_string(kResourceId),
Review Comment:
warning: calling a private constructor of class
'doris::RemoteFileSystemMock' [clang-diagnostic-error]
```cpp
s_fs.reset(new RemoteFileSystemMock("test_path",
std::to_string(kResourceId),
^
```
**be/test/olap/tablet_cooldown_test.cpp:72:** implicitly declared private
here
```cpp
RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
Review Comment:
warning: no member named 'gmock_abort' in
'std::unique_ptr<doris::io::FileWriter>' [clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
^
```
expanded from here
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, append(_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, appendv(_,
_)).WillRepeatedly(Return(Status::OK()));
Review Comment:
warning: '_file_writer' is a private member of 'doris::TabletCooldownTest'
[clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer, appendv(_,
_)).WillRepeatedly(Return(Status::OK()));
^
```
**be/test/olap/tablet_cooldown_test.cpp:134:** declared private here
```cpp
static io::FileWriterPtr* _file_writer;
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, append(_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, appendv(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, write_at(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer,
finalize()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, bytes_appended()).WillRepeatedly(Return(1));
Review Comment:
warning: no member named 'gmock_bytes_appended' in 'doris::io::FileWriter'
[clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer, bytes_appended()).WillRepeatedly(Return(1));
^
```
expanded from here
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
Review Comment:
warning: '_file_writer' is a private member of 'doris::TabletCooldownTest'
[clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
^
```
**be/test/olap/tablet_cooldown_test.cpp:134:** declared private here
```cpp
static io::FileWriterPtr* _file_writer;
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, append(_)).WillRepeatedly(Return(Status::OK()));
Review Comment:
warning: '_file_writer' is a private member of 'doris::TabletCooldownTest'
[clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer,
append(_)).WillRepeatedly(Return(Status::OK()));
^
```
**be/test/olap/tablet_cooldown_test.cpp:134:** declared private here
```cpp
static io::FileWriterPtr* _file_writer;
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
Review Comment:
warning: no member named 'gmock_close' in
'std::unique_ptr<doris::io::FileWriter>' [clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
^
```
expanded from here
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, append(_)).WillRepeatedly(Return(Status::OK()));
Review Comment:
warning: no member named 'gmock_append' in
'std::unique_ptr<doris::io::FileWriter>' [clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer,
append(_)).WillRepeatedly(Return(Status::OK()));
^
```
expanded from here
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, append(_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, appendv(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, write_at(_,
_)).WillRepeatedly(Return(Status::OK()));
Review Comment:
warning: '_file_writer' is a private member of 'doris::TabletCooldownTest'
[clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer, write_at(_,
_)).WillRepeatedly(Return(Status::OK()));
^
```
**be/test/olap/tablet_cooldown_test.cpp:134:** declared private here
```cpp
static io::FileWriterPtr* _file_writer;
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, append(_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, appendv(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, write_at(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer,
finalize()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, bytes_appended()).WillRepeatedly(Return(1));
Review Comment:
warning: no member named 'gmock_bytes_appended' in
'std::unique_ptr<doris::io::FileWriter>'; did you mean to use '->' instead of
'.'? [clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer, bytes_appended()).WillRepeatedly(Return(1));
^
```
**thirdparty/installed/include/gmock/gmock-spec-builders.h:2035:** expanded
from macro 'EXPECT_CALL'
```cpp
GMOCK_ON_CALL_IMPL_(obj, InternalExpectedAt, call)
^
```
**thirdparty/installed/include/gmock/gmock-spec-builders.h:2027:** expanded
from macro 'GMOCK_ON_CALL_IMPL_'
```cpp
((mock_expr).gmock_##call)(::testing::internal::GetWithoutMatchers(), \
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
Review Comment:
warning: '_file_writer' is a private member of 'doris::TabletCooldownTest'
[clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
^
```
**be/test/olap/tablet_cooldown_test.cpp:134:** declared private here
```cpp
static io::FileWriterPtr* _file_writer;
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, append(_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, appendv(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, write_at(_,
_)).WillRepeatedly(Return(Status::OK()));
Review Comment:
warning: no member named 'gmock_write_at' in
'std::unique_ptr<doris::io::FileWriter>' [clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer, write_at(_,
_)).WillRepeatedly(Return(Status::OK()));
^
```
expanded from here
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, append(_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, appendv(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, write_at(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer,
finalize()).WillRepeatedly(Return(Status::OK()));
Review Comment:
warning: no member named 'gmock_finalize' in
'std::unique_ptr<doris::io::FileWriter>' [clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer,
finalize()).WillRepeatedly(Return(Status::OK()));
^
```
expanded from here
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, append(_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, appendv(_,
_)).WillRepeatedly(Return(Status::OK()));
Review Comment:
warning: no member named 'gmock_appendv' in
'std::unique_ptr<doris::io::FileWriter>' [clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer, appendv(_,
_)).WillRepeatedly(Return(Status::OK()));
^
```
expanded from here
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, append(_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, appendv(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, write_at(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer,
finalize()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, bytes_appended()).WillRepeatedly(Return(1));
Review Comment:
warning: '_file_writer' is a private member of 'doris::TabletCooldownTest'
[clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer, bytes_appended()).WillRepeatedly(Return(1));
^
```
**be/test/olap/tablet_cooldown_test.cpp:134:** declared private here
```cpp
static io::FileWriterPtr* _file_writer;
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, append(_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, appendv(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, write_at(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer,
finalize()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, bytes_appended()).WillRepeatedly(Return(1));
+ EXPECT_CALL(*_file_writer, fs()).WillRepeatedly(Return(s_fs))
Review Comment:
warning: '_file_writer' is a private member of 'doris::TabletCooldownTest'
[clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer, fs()).WillRepeatedly(Return(s_fs))
^
```
**be/test/olap/tablet_cooldown_test.cpp:134:** declared private here
```cpp
static io::FileWriterPtr* _file_writer;
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -146,9 +194,32 @@
}
TEST_F(TabletCooldownTest, normal) {
+ EXPECT_CALL(*_file_writer, close()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, abort()).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, append(_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, appendv(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer, write_at(_,
_)).WillRepeatedly(Return(Status::OK()));
+ EXPECT_CALL(*_file_writer,
finalize()).WillRepeatedly(Return(Status::OK()));
Review Comment:
warning: '_file_writer' is a private member of 'doris::TabletCooldownTest'
[clang-diagnostic-error]
```cpp
EXPECT_CALL(*_file_writer,
finalize()).WillRepeatedly(Return(Status::OK()));
^
```
**be/test/olap/tablet_cooldown_test.cpp:134:** declared private here
```cpp
static io::FileWriterPtr* _file_writer;
^
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]