Skip to content

Commit

Permalink
[testing] Add StopListening helper and BidiStream handler to XDS e2e …
Browse files Browse the repository at this point in the history
…test lib (grpc#35861)

As title. Pulling these additions out from a larger change.

Related: cl/563857636

Closes grpc#35861

COPYBARA_INTEGRATE_REVIEW=grpc#35861 from apolcyn:xds_test_changes a67f64d
PiperOrigin-RevId: 607728140
  • Loading branch information
apolcyn authored and copybara-github committed Feb 16, 2024
1 parent 6f406a7 commit b855423
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/cpp/end2end/xds/xds_end2end_test_lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ void XdsEnd2endTest::ServerThread::StopListeningAndSendGoaways() {
gpr_log(GPR_INFO, "%s done sending GOAWAYs", Type());
}

void XdsEnd2endTest::ServerThread::StopListening() {
gpr_log(GPR_INFO, "%s about to stop listening", Type());
{
grpc_core::ExecCtx exec_ctx;
auto* server = grpc_core::Server::FromC(server_->c_server());
server->StopListening();
}
gpr_log(GPR_INFO, "%s stopped listening", Type());
}

void XdsEnd2endTest::ServerThread::Serve(grpc_core::Mutex* mu,
grpc_core::CondVar* cond) {
// We need to acquire the lock here in order to prevent the notify_one
Expand Down
2 changes: 2 additions & 0 deletions test/cpp/end2end/xds/xds_end2end_test_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ class XdsEnd2endTest : public ::testing::TestWithParam<XdsTestType>,
allow_put_requests_ = allow_put_requests;
}

void StopListening();

void StopListeningAndSendGoaways();

private:
Expand Down

0 comments on commit b855423

Please sign in to comment.