[channel] Remove test only feature (#35465)

It's not clear to me that this one unit test of very marginal importance warrants 8 bytes per channel.

Closes #35465

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35465 from ctiller:we-dont-need-this-really e7ee62ccb2
PiperOrigin-RevId: 596091614
pull/35468/head
Craig Tiller 1 year ago committed by Copybara-Service
parent c112dd7054
commit 2694f87c23
  1. 1
      include/grpcpp/test/channel_test_peer.h
  2. 1
      src/core/lib/surface/channel.cc
  3. 6
      src/core/lib/surface/channel.h
  4. 5
      src/cpp/client/channel_test_peer.cc
  5. 2
      test/cpp/end2end/end2end_test.cc

@ -32,7 +32,6 @@ class ChannelTestPeer {
/// Provide the gRPC Core channel
grpc_channel* channel() const { return channel_->c_channel_; }
int registered_calls() const;
int registration_attempts() const;
private:
Channel* channel_; // not owned

@ -376,7 +376,6 @@ namespace grpc_core {
RegisteredCall* Channel::RegisterCall(const char* method, const char* host) {
MutexLock lock(&registration_table_.mu);
registration_table_.method_registration_attempts++;
auto key = std::make_pair(std::string(host != nullptr ? host : ""),
std::string(method != nullptr ? method : ""));
auto rc_posn = registration_table_.map.find(key);

@ -103,7 +103,6 @@ struct CallRegistrationTable {
// C++ or other wrapped language Channel that registered these calls).
std::map<std::pair<std::string, std::string>, RegisteredCall> map
ABSL_GUARDED_BY(mu);
int method_registration_attempts ABSL_GUARDED_BY(mu) = 0;
};
class Channel : public RefCounted<Channel>,
@ -150,11 +149,6 @@ class Channel : public RefCounted<Channel>,
return registration_table_.map.size();
}
int TestOnlyRegistrationAttempts() {
MutexLock lock(&registration_table_.mu);
return registration_table_.method_registration_attempts;
}
grpc_event_engine::experimental::EventEngine* event_engine() const {
return channel_stack_->EventEngine();
}

@ -29,10 +29,5 @@ int ChannelTestPeer::registered_calls() const {
->TestOnlyRegisteredCalls();
}
int ChannelTestPeer::registration_attempts() const {
return grpc_core::Channel::FromC(channel_->c_channel_)
->TestOnlyRegistrationAttempts();
}
} // namespace testing
} // namespace grpc

@ -862,12 +862,10 @@ TEST_P(End2endTest, ManyStubs) {
ResetStub();
ChannelTestPeer peer(channel_.get());
int registered_calls_pre = peer.registered_calls();
int registration_attempts_pre = peer.registration_attempts();
for (int i = 0; i < 1000; ++i) {
grpc::testing::EchoTestService::NewStub(channel_);
}
EXPECT_EQ(peer.registered_calls(), registered_calls_pre);
EXPECT_GT(peer.registration_attempts(), registration_attempts_pre);
}
TEST_P(End2endTest, EmptyBinaryMetadata) {

Loading…
Cancel
Save