|
|
|
@ -74,6 +74,26 @@ constexpr int kNumExchangedMessages = 100; |
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
TEST_F(EventEngineServerTest, CannotBindAfterStarted) { |
|
|
|
|
std::shared_ptr<EventEngine> engine(this->NewEventEngine()); |
|
|
|
|
ChannelArgsEndpointConfig config; |
|
|
|
|
auto listener = engine->CreateListener( |
|
|
|
|
[](std::unique_ptr<Endpoint>, grpc_core::MemoryAllocator) {}, |
|
|
|
|
[](absl::Status) {}, config, |
|
|
|
|
std::make_unique<grpc_core::MemoryQuota>("foo")); |
|
|
|
|
// Bind an initial port to ensure normal listener startup
|
|
|
|
|
auto resolved_addr = URIToResolvedAddress(absl::StrCat( |
|
|
|
|
"ipv6:[::1]:", std::to_string(grpc_pick_unused_port_or_die()))); |
|
|
|
|
ASSERT_TRUE(resolved_addr.ok()); |
|
|
|
|
ASSERT_TRUE((*listener)->Bind(*resolved_addr).ok()); |
|
|
|
|
ASSERT_TRUE((*listener)->Start().ok()); |
|
|
|
|
// A subsequent bind, which should fail
|
|
|
|
|
auto resolved_addr2 = URIToResolvedAddress(absl::StrCat( |
|
|
|
|
"ipv6:[::1]:", std::to_string(grpc_pick_unused_port_or_die()))); |
|
|
|
|
ASSERT_TRUE(resolved_addr2.ok()); |
|
|
|
|
ASSERT_FALSE((*listener)->Bind(*resolved_addr2).ok()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Create a connection using the oracle EventEngine to a listener created
|
|
|
|
|
// by the Test EventEngine and exchange bi-di data over the connection.
|
|
|
|
|
// For each data transfer, verify that data written at one end of the stream
|
|
|
|
|