Skip to content

Commit

Permalink
migrate platform test case to io_handle_impl_test
Browse files Browse the repository at this point in the history
Signed-off-by: Yuchen Dai <[email protected]>
  • Loading branch information
lambdai committed Feb 16, 2021
1 parent 9465670 commit 389dc5a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
12 changes: 0 additions & 12 deletions test/extensions/io_socket/user_space/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,3 @@ envoy_extension_cc_test(
"//test/mocks/event:event_mocks",
],
)

envoy_extension_cc_test(
name = "io_handle_impl_platform_test",
srcs = ["io_handle_impl_platform_test.cc"],
extension_name = "envoy.io_socket.user_space",
deps = [
"//source/common/common:utility_lib",
"//source/common/network:address_lib",
"//source/extensions/io_socket/user_space:io_handle_impl_lib",
"//test/mocks/event:event_mocks",
],
)
14 changes: 14 additions & 0 deletions test/extensions/io_socket/user_space/io_handle_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,19 @@ TEST_F(IoHandleImplTest, LastRoundtripTimeNullOpt) {
ASSERT_EQ(absl::nullopt, io_handle_->lastRoundTripTime());
}

// IoHandleImpl can support EmulatedEdge trigger type but not level trigger type.
TEST_F(IoHandleImplTest, CreatePlatformDefaultTriggerTypeFailOnWindows) {
// schedulable_cb will be destroyed by IoHandle.
auto schedulable_cb = new Event::MockSchedulableCallback(&dispatcher_);
EXPECT_CALL(*schedulable_cb, enabled());
EXPECT_CALL(*schedulable_cb, cancel());
io_handle_->initializeFileEvent(
dispatcher_, [this](uint32_t events) { cb_.called(events); },
Event::PlatformDefaultTriggerType, Event::FileReadyType::Read);
io_handle_->close();
io_handle_peer_->close();
}

class IoHandleImplNotImplementedTest : public testing::Test {
public:
IoHandleImplNotImplementedTest() {
Expand Down Expand Up @@ -1102,6 +1115,7 @@ TEST_F(IoHandleImplNotImplementedTest, ErrorOnSetOption) {
TEST_F(IoHandleImplNotImplementedTest, ErrorOnGetOption) {
EXPECT_THAT(io_handle_->getOption(0, 0, nullptr, nullptr), IsNotSupportedResult());
}

} // namespace
} // namespace UserSpace
} // namespace IoSocket
Expand Down

0 comments on commit 389dc5a

Please sign in to comment.