Skip to content

Commit

Permalink
Nit(tests): add some tests to pass CI
Browse files Browse the repository at this point in the history
Signed-off-by: zztaki <[email protected]>
  • Loading branch information
zztaki authored and wuhongsong committed Jan 2, 2024
1 parent 35846be commit d28d29e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/client/client_metric_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,5 +383,10 @@ TEST(MetricTest, MetricHelperTest) {
ASSERT_NO_THROW(MetricHelper::IncremSlowRequestNum(nullptr));
}

TEST(MetricTest, CollectMetricsTest) {
InterfaceMetric interface("curve_client", "test");
ASSERT_NO_THROW(CollectMetrics(&interface, 1, 1));
}

} // namespace client
} // namespace curve
3 changes: 3 additions & 0 deletions test/client/libcbd_ext4_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ TEST(TestLibcbdExt4, AioReadWriteTest) {

ret = cbd_lib_fini();
ASSERT_EQ(ret, 0);

ret = cbd_lib_filesize("no_exist_file");
ASSERT_EQ(ret, -1);
}

TEST(TestLibcbdExt4, IncreaseEpochTest) {
Expand Down
9 changes: 9 additions & 0 deletions test/client/libcurve_client_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ TEST_F(CurveClientTest, TestAioWrite) {
}
}

TEST_F(CurveClientTest, TestIncreaseEpoch) {
{
EXPECT_CALL(*mockFileClient_, IncreaseEpoch(_)).Times(0);

ASSERT_EQ(-LIBCURVE_ERROR::FAILED,
client_.IncreaseEpoch(kWrongFileName));
}
}

} // namespace client
} // namespace curve

Expand Down
1 change: 1 addition & 0 deletions test/client/mock/mock_file_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class MockFileClient : public FileClient {
MOCK_METHOD4(ReOpen, int(const std::string&, const std::string&,
const UserInfo&, std::string*));
MOCK_METHOD3(Extend, int(const std::string&, const UserInfo&, uint64_t));
MOCK_METHOD1(IncreaseEpoch, int(const std::string &));
};

} // namespace client
Expand Down

0 comments on commit d28d29e

Please sign in to comment.