testing with locks in ws

Remove no_logging and add missing mu locks
pull/22169/head
Yash Tibrewal 5 years ago
parent ee03496701
commit c6fa7eefb9
  1. 2
      CMakeLists.txt
  2. 2
      Makefile
  3. 1
      gRPC-Core.podspec
  4. 2
      grpc.gyp
  5. 13
      src/core/ext/filters/client_channel/client_channel.cc
  6. 2
      src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
  7. 2
      src/core/ext/filters/client_channel/lb_policy/xds/xds.cc
  8. 67
      src/core/ext/filters/client_channel/subchannel.cc
  9. 35
      src/core/ext/filters/client_channel/subchannel.h
  10. 2
      src/core/lib/transport/connectivity_state.cc
  11. 8
      test/core/end2end/end2end_nosec_tests.cc
  12. 8
      test/core/end2end/end2end_tests.cc
  13. 2
      test/core/end2end/gen_build_yaml.py
  14. 1
      test/core/end2end/generate_tests.bzl
  15. 697
      test/cpp/end2end/BUILD
  16. 12
      test/cpp/end2end/xds_end2end_test.cc
  17. 761
      tools/run_tests/generated/tests.json
  18. 1
      tools/run_tests/python_utils/jobset.py

@ -6109,7 +6109,6 @@ add_library(end2end_tests
test/core/end2end/tests/max_message_length.cc
test/core/end2end/tests/negative_deadline.cc
test/core/end2end/tests/no_error_on_hotpath.cc
test/core/end2end/tests/no_logging.cc
test/core/end2end/tests/no_op.cc
test/core/end2end/tests/payload.cc
test/core/end2end/tests/ping.cc
@ -6230,7 +6229,6 @@ add_library(end2end_nosec_tests
test/core/end2end/tests/max_message_length.cc
test/core/end2end/tests/negative_deadline.cc
test/core/end2end/tests/no_error_on_hotpath.cc
test/core/end2end/tests/no_logging.cc
test/core/end2end/tests/no_op.cc
test/core/end2end/tests/payload.cc
test/core/end2end/tests/ping.cc

@ -8885,7 +8885,6 @@ LIBEND2END_TESTS_SRC = \
test/core/end2end/tests/max_message_length.cc \
test/core/end2end/tests/negative_deadline.cc \
test/core/end2end/tests/no_error_on_hotpath.cc \
test/core/end2end/tests/no_logging.cc \
test/core/end2end/tests/no_op.cc \
test/core/end2end/tests/payload.cc \
test/core/end2end/tests/ping.cc \
@ -9002,7 +9001,6 @@ LIBEND2END_NOSEC_TESTS_SRC = \
test/core/end2end/tests/max_message_length.cc \
test/core/end2end/tests/negative_deadline.cc \
test/core/end2end/tests/no_error_on_hotpath.cc \
test/core/end2end/tests/no_logging.cc \
test/core/end2end/tests/no_op.cc \
test/core/end2end/tests/payload.cc \
test/core/end2end/tests/ping.cc \

@ -1440,7 +1440,6 @@ Pod::Spec.new do |s|
'test/core/end2end/tests/max_message_length.cc',
'test/core/end2end/tests/negative_deadline.cc',
'test/core/end2end/tests/no_error_on_hotpath.cc',
'test/core/end2end/tests/no_logging.cc',
'test/core/end2end/tests/no_op.cc',
'test/core/end2end/tests/payload.cc',
'test/core/end2end/tests/ping.cc',

@ -2616,7 +2616,6 @@
'test/core/end2end/tests/max_message_length.cc',
'test/core/end2end/tests/negative_deadline.cc',
'test/core/end2end/tests/no_error_on_hotpath.cc',
'test/core/end2end/tests/no_logging.cc',
'test/core/end2end/tests/no_op.cc',
'test/core/end2end/tests/payload.cc',
'test/core/end2end/tests/ping.cc',
@ -2706,7 +2705,6 @@
'test/core/end2end/tests/max_message_length.cc',
'test/core/end2end/tests/negative_deadline.cc',
'test/core/end2end/tests/no_error_on_hotpath.cc',
'test/core/end2end/tests/no_logging.cc',
'test/core/end2end/tests/no_op.cc',
'test/core/end2end/tests/payload.cc',
'test/core/end2end/tests/ping.cc',

@ -1059,9 +1059,14 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
: parent_(std::move(parent)),
state_(new_state),
connected_subchannel_(std::move(connected_subchannel)) {
gpr_log(GPR_ERROR, "updater run %p", parent_->mu());
running_exec_ctx_ = ExecCtx::Get();
parent_->parent_->chand_->work_serializer_->Run(
[this]() { ApplyUpdateInControlPlaneWorkSerializer(); },
DEBUG_LOCATION);
if (!run_inline_) {
gpr_mu_unlock(parent_->mu()->get());
}
}
private:
@ -1075,6 +1080,11 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
parent_->parent_->subchannel_, connected_subchannel_.get(),
ConnectivityStateName(state_), parent_->watcher_.get());
}
if (ExecCtx::Get() == running_exec_ctx_) {
// Running inline
gpr_mu_unlock(parent_->mu()->get());
run_inline_ = true;
}
// Ignore update if the parent WatcherWrapper has been replaced
// since this callback was scheduled.
if (parent_->watcher_ == nullptr) return;
@ -1088,6 +1098,9 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
RefCountedPtr<WatcherWrapper> parent_;
grpc_connectivity_state state_;
RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
bool run_inline_ = false;
/* This can be replaced with something like getting the thread id */
ExecCtx* running_exec_ctx_ = nullptr;
};
std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>

@ -44,7 +44,7 @@
namespace grpc_core {
TraceFlag grpc_lb_round_robin_trace(false, "round_robin");
TraceFlag grpc_lb_round_robin_trace(true, "round_robin");
namespace {

@ -67,7 +67,7 @@
namespace grpc_core {
TraceFlag grpc_lb_xds_trace(false, "xds");
TraceFlag grpc_lb_xds_trace(true, "xds");
namespace {

@ -364,33 +364,53 @@ class Subchannel::ConnectedSubchannelStateWatcher
// Asynchronously notifies the \a watcher of a change in the connectvity state
// of \a subchannel to the current \a state. Deletes itself when done.
class Subchannel::AsyncWatcherNotifier {
class Subchannel::AsyncWatcherNotifierLocked {
public:
AsyncWatcherNotifier(
AsyncWatcherNotifierLocked(
RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface> watcher,
Subchannel* subchannel, grpc_connectivity_state state)
: watcher_(std::move(watcher)), state_(state) {
if (state_ == GRPC_CHANNEL_READY) {
connected_subchannel_ = subchannel->connected_subchannel_;
: subchannel_(subchannel), watcher_(std::move(watcher)) {
gpr_log(GPR_ERROR, "pushing connectivity state change %d", state);
{
MutexLock(watcher_->mu());
watcher_->PushConnectivityStateChangeLocked(state);
}
ExecCtx::Run(DEBUG_LOCATION,
GRPC_CLOSURE_INIT(
&closure_,
[](void* arg, grpc_error* /*error*/) {
auto* self = static_cast<AsyncWatcherNotifier*>(arg);
self->watcher_->OnConnectivityStateChange(
self->state_,
std::move(self->connected_subchannel_));
delete self;
},
this, nullptr),
GRPC_ERROR_NONE);
ExecCtx::Run(
DEBUG_LOCATION,
GRPC_CLOSURE_INIT(
&closure_,
[](void* arg, grpc_error* /*error*/) {
auto* self = static_cast<AsyncWatcherNotifierLocked*>(arg);
while (true) {
grpc_connectivity_state state;
RefCountedPtr<ConnectedSubchannel> connected_subchannel;
gpr_log(GPR_ERROR, "lock %p", self->watcher_->mu());
gpr_mu_lock(self->watcher_->mu()->get());
{
if (!self->watcher_->PopConnectivityStateChangeLocked(
&state)) {
gpr_mu_unlock(self->watcher_->mu()->get());
break;
}
gpr_log(GPR_ERROR, "popping connectivity state change %d",
state);
if (state == GRPC_CHANNEL_READY) {
connected_subchannel =
self->subchannel_->connected_subchannel_;
}
}
self->watcher_->OnConnectivityStateChange(
state, std::move(connected_subchannel));
}
delete self;
},
this, nullptr),
GRPC_ERROR_NONE);
}
private:
Subchannel* subchannel_;
RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface> watcher_;
RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
grpc_connectivity_state state_;
grpc_closure closure_;
};
@ -411,7 +431,8 @@ void Subchannel::ConnectivityStateWatcherList::RemoveWatcherLocked(
void Subchannel::ConnectivityStateWatcherList::NotifyLocked(
Subchannel* subchannel, grpc_connectivity_state state) {
for (const auto& p : watchers_) {
new AsyncWatcherNotifier(p.second, subchannel, state);
gpr_log(GPR_ERROR, "AsyncWatcherNotifierLocked");
new AsyncWatcherNotifierLocked(p.second, subchannel, state);
}
}
@ -450,7 +471,8 @@ class Subchannel::HealthWatcherMap::HealthWatcher
grpc_connectivity_state initial_state,
RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface> watcher) {
if (state_ != initial_state) {
new AsyncWatcherNotifier(watcher, subchannel_, state_);
gpr_log(GPR_ERROR, "AsyncWatcherNotifierLocked");
new AsyncWatcherNotifierLocked(watcher, subchannel_, state_);
}
watcher_list_.AddWatcherLocked(std::move(watcher));
}
@ -811,7 +833,8 @@ void Subchannel::WatchConnectivityState(
}
if (health_check_service_name == nullptr) {
if (state_ != initial_state) {
new AsyncWatcherNotifier(watcher, this, state_);
gpr_log(GPR_ERROR, "AsyncWatcherNotifierLocked");
new AsyncWatcherNotifierLocked(watcher, this, state_);
}
watcher_list_.AddWatcherLocked(std::move(watcher));
} else {

@ -21,6 +21,8 @@
#include <grpc/support/port_platform.h>
#include <deque>
#include "src/core/ext/filters/client_channel/client_channel_channelz.h"
#include "src/core/ext/filters/client_channel/connector.h"
#include "src/core/ext/filters/client_channel/subchannel_pool_interface.h"
@ -194,6 +196,37 @@ class Subchannel {
= 0;
virtual grpc_pollset_set* interested_parties() = 0;
// TODO(yashkt): This is currently needed to send the state updates in the
// right order when asynchronously notifying. This will no longer be
// necessary when we have access to EventManager. Enqueues connectivity
// state change notifications. Does NOT
void PushConnectivityStateChangeLocked(grpc_connectivity_state state) {
connectivity_state_queue_.push_back(state);
}
// Dequeues connectivity state change notifications. If the queue is empty,
// it returns false, otherwise returns true and sets \a state to the popped
// state change.
bool PopConnectivityStateChangeLocked(grpc_connectivity_state* state) {
if (connectivity_state_queue_.empty()) {
return false;
} else {
*state = connectivity_state_queue_.front();
connectivity_state_queue_.pop_front();
return true;
}
}
Mutex* mu() { return &mu_; }
private:
// Keeps track of the updates that the watcher instance must be notified of.
// TODO(yashkt): This is currently needed to send the state updates in the
// right order when asynchronously notifying. This will no longer be
// necessary when we have access to EventManager.
std::deque<grpc_connectivity_state> connectivity_state_queue_;
Mutex mu_; // protects the queue
};
// The ctor and dtor are not intended to use directly.
@ -332,7 +365,7 @@ class Subchannel {
class ConnectedSubchannelStateWatcher;
class AsyncWatcherNotifier;
class AsyncWatcherNotifierLocked;
// Sets the subchannel's connectivity state to \a state.
void SetConnectivityStateLocked(grpc_connectivity_state state);

@ -31,7 +31,7 @@
namespace grpc_core {
TraceFlag grpc_connectivity_state_trace(false, "connectivity_state");
TraceFlag grpc_connectivity_state_trace(true, "connectivity_state");
const char* ConnectivityStateName(grpc_connectivity_state state) {
switch (state) {

@ -101,8 +101,6 @@ extern void negative_deadline(grpc_end2end_test_config config);
extern void negative_deadline_pre_init(void);
extern void no_error_on_hotpath(grpc_end2end_test_config config);
extern void no_error_on_hotpath_pre_init(void);
extern void no_logging(grpc_end2end_test_config config);
extern void no_logging_pre_init(void);
extern void no_op(grpc_end2end_test_config config);
extern void no_op_pre_init(void);
extern void payload(grpc_end2end_test_config config);
@ -223,7 +221,6 @@ void grpc_end2end_tests_pre_init(void) {
max_message_length_pre_init();
negative_deadline_pre_init();
no_error_on_hotpath_pre_init();
no_logging_pre_init();
no_op_pre_init();
payload_pre_init();
ping_pre_init();
@ -309,7 +306,6 @@ void grpc_end2end_tests(int argc, char **argv,
max_message_length(config);
negative_deadline(config);
no_error_on_hotpath(config);
no_logging(config);
no_op(config);
payload(config);
ping(config);
@ -498,10 +494,6 @@ void grpc_end2end_tests(int argc, char **argv,
no_error_on_hotpath(config);
continue;
}
if (0 == strcmp("no_logging", argv[i])) {
no_logging(config);
continue;
}
if (0 == strcmp("no_op", argv[i])) {
no_op(config);
continue;

@ -103,8 +103,6 @@ extern void negative_deadline(grpc_end2end_test_config config);
extern void negative_deadline_pre_init(void);
extern void no_error_on_hotpath(grpc_end2end_test_config config);
extern void no_error_on_hotpath_pre_init(void);
extern void no_logging(grpc_end2end_test_config config);
extern void no_logging_pre_init(void);
extern void no_op(grpc_end2end_test_config config);
extern void no_op_pre_init(void);
extern void payload(grpc_end2end_test_config config);
@ -226,7 +224,6 @@ void grpc_end2end_tests_pre_init(void) {
max_message_length_pre_init();
negative_deadline_pre_init();
no_error_on_hotpath_pre_init();
no_logging_pre_init();
no_op_pre_init();
payload_pre_init();
ping_pre_init();
@ -313,7 +310,6 @@ void grpc_end2end_tests(int argc, char **argv,
max_message_length(config);
negative_deadline(config);
no_error_on_hotpath(config);
no_logging(config);
no_op(config);
payload(config);
ping(config);
@ -506,10 +502,6 @@ void grpc_end2end_tests(int argc, char **argv,
no_error_on_hotpath(config);
continue;
}
if (0 == strcmp("no_logging", argv[i])) {
no_logging(config);
continue;
}
if (0 == strcmp("no_op", argv[i])) {
no_op(config);
continue;

@ -228,8 +228,6 @@ END2END_TESTS = {
default_test_options,
'no_error_on_hotpath':
default_test_options._replace(proxyable=False),
'no_logging':
default_test_options._replace(traceable=False),
'no_op':
default_test_options,
'payload':

@ -243,7 +243,6 @@ END2END_TESTS = {
"max_message_length": _test_options(),
"negative_deadline": _test_options(),
"no_error_on_hotpath": _test_options(proxyable = False),
"no_logging": _test_options(traceable = False),
"no_op": _test_options(),
"payload": _test_options(),
# TODO(juanlishen): This is disabled for now because it depends on some generated functions in

@ -61,439 +61,6 @@ grpc_cc_library(
],
)
grpc_cc_test(
name = "async_end2end_test",
srcs = ["async_end2end_test.cc"],
external_deps = [
"gtest",
],
tags = ["no_test_ios"],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/health/v1:health_proto",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "time_change_test",
srcs = ["time_change_test.cc"],
data = [
":client_crash_test_server",
],
external_deps = [
"gtest",
],
tags = [
"no_test_android", # android_cc_test doesn't work with data dependency.
"no_test_ios",
"no_windows",
],
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "client_crash_test",
srcs = ["client_crash_test.cc"],
data = [
":client_crash_test_server",
],
external_deps = [
"gtest",
],
tags = [
"no_test_android", # android_cc_test doesn't work with data dependency.
"no_test_ios",
"no_windows",
],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_binary(
name = "client_crash_test_server",
testonly = True,
srcs = ["client_crash_test_server.cc"],
external_deps = [
"gflags",
"gtest",
],
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_config",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "client_callback_end2end_test",
srcs = ["client_callback_end2end_test.cc"],
external_deps = [
"gtest",
],
deps = [
":interceptors_util",
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing:simple_messages_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "delegating_channel_test",
srcs = ["delegating_channel_test.cc"],
external_deps = [
"gtest",
],
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "client_interceptors_end2end_test",
srcs = ["client_interceptors_end2end_test.cc"],
external_deps = [
"gtest",
],
deps = [
":interceptors_util",
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_library(
name = "end2end_test_lib",
testonly = True,
srcs = ["end2end_test.cc"],
external_deps = [
"gtest",
],
deps = [
":interceptors_util",
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
alwayslink = 1,
)
grpc_cc_test(
name = "channelz_service_test",
srcs = ["channelz_service_test.cc"],
external_deps = [
"gtest",
],
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//:grpcpp_channelz",
"//src/proto/grpc/channelz:channelz_proto",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "server_early_return_test",
srcs = ["server_early_return_test.cc"],
external_deps = [
"gtest",
],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "end2end_test",
size = "large",
tags = ["no_test_ios"],
deps = [
":end2end_test_lib",
# DO NOT REMOVE THE grpc++ dependence below since the internal build
# system uses it to specialize targets
"//:grpc++",
],
)
grpc_cc_test(
name = "exception_test",
srcs = ["exception_test.cc"],
external_deps = [
"gtest",
],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "filter_end2end_test",
srcs = ["filter_end2end_test.cc"],
external_deps = [
"gtest",
],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "generic_end2end_test",
srcs = ["generic_end2end_test.cc"],
external_deps = [
"gtest",
],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "health_service_end2end_test",
srcs = ["health_service_end2end_test.cc"],
external_deps = [
"gtest",
],
deps = [
":test_health_check_service_impl",
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/health/v1:health_proto",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "hybrid_end2end_test",
srcs = ["hybrid_end2end_test.cc"],
external_deps = [
"gtest",
],
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "raw_end2end_test",
srcs = ["raw_end2end_test.cc"],
external_deps = [
"gtest",
],
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "mock_test",
srcs = ["mock_test.cc"],
external_deps = [
"gtest",
],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//:grpc++_test",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "nonblocking_test",
srcs = ["nonblocking_test.cc"],
external_deps = [
"gtest",
],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "client_lb_end2end_test",
srcs = ["client_lb_end2end_test.cc"],
external_deps = [
"gtest",
],
tags = ["no_windows"], # TODO(jtattermusch): fix test on windows
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//src/proto/grpc/testing/xds:orca_load_report_for_test_proto",
"//test/core/util:grpc_test_util",
"//test/core/util:test_lb_policies",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "service_config_end2end_test",
srcs = ["service_config_end2end_test.cc"],
external_deps = [
"gtest",
],
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "grpclb_end2end_test",
srcs = ["grpclb_end2end_test.cc"],
external_deps = [
"gtest",
],
tags = ["no_windows"], # TODO(jtattermusch): fix test on windows
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//:grpc_resolver_fake",
"//src/proto/grpc/lb/v1:load_balancer_proto",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "xds_end2end_test",
size = "large",
@ -525,267 +92,3 @@ grpc_cc_test(
],
)
grpc_cc_test(
name = "proto_server_reflection_test",
srcs = ["proto_server_reflection_test.cc"],
external_deps = [
"gtest",
"gflags",
],
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//:grpc++_reflection",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:grpc++_proto_reflection_desc_db",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "server_builder_plugin_test",
srcs = ["server_builder_plugin_test.cc"],
external_deps = [
"gtest",
],
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "server_crash_test",
srcs = ["server_crash_test.cc"],
data = [
":server_crash_test_client",
],
external_deps = [
"gtest",
],
tags = [
"no_test_android", # android_cc_test doesn't work with data dependency.
"no_test_ios",
"no_windows",
],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_binary(
name = "server_crash_test_client",
testonly = True,
srcs = ["server_crash_test_client.cc"],
external_deps = [
"gflags",
"gtest",
],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_config",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "server_interceptors_end2end_test",
srcs = ["server_interceptors_end2end_test.cc"],
external_deps = [
"gtest",
],
deps = [
":interceptors_util",
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "server_load_reporting_end2end_test",
srcs = ["server_load_reporting_end2end_test.cc"],
external_deps = [
"gtest",
],
tags = [
"no_test_ios",
"no_windows",
],
deps = [
"//:grpcpp_server_load_reporting",
"//src/proto/grpc/testing:echo_proto",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "flaky_network_test",
srcs = ["flaky_network_test.cc"],
external_deps = [
"gtest",
],
tags = [
"manual",
"no_test_ios",
],
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "shutdown_test",
srcs = ["shutdown_test.cc"],
external_deps = [
"gtest",
],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "streaming_throughput_test",
srcs = ["streaming_throughput_test.cc"],
external_deps = [
"gtest",
],
tags = ["no_windows"],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "thread_stress_test",
size = "large",
srcs = ["thread_stress_test.cc"],
external_deps = [
"gtest",
],
shard_count = 5,
tags = ["no_windows"], # TODO(jtattermusch): fix test on windows
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "cfstream_test",
srcs = ["cfstream_test.cc"],
external_deps = [
"gtest",
],
tags = [
"manual",
"no_test_android",
"no_test_ios",
], # test requires root, won't work with bazel RBE
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing:simple_messages_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "message_allocator_end2end_test",
srcs = ["message_allocator_end2end_test.cc"],
external_deps = [
"gtest",
],
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing:simple_messages_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "port_sharing_end2end_test",
srcs = ["port_sharing_end2end_test.cc"],
external_deps = [
"gtest",
],
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
)

@ -218,10 +218,8 @@ class CountedService : public ServiceType {
response_count_ = 0;
}
protected:
grpc_core::Mutex mu_;
private:
grpc_core::Mutex mu_;
size_t request_count_ = 0;
size_t response_count_ = 0;
};
@ -267,7 +265,6 @@ class BackendServiceImpl : public BackendService {
clients_.insert(client);
}
grpc_core::Mutex mu_;
grpc_core::Mutex clients_mu_;
std::set<grpc::string> clients_;
};
@ -975,7 +972,12 @@ class XdsEnd2endTest : public ::testing::TestWithParam<TestType> {
bool SeenAllBackends(size_t start_index = 0, size_t stop_index = 0) {
if (stop_index == 0) stop_index = backends_.size();
for (size_t i = start_index; i < stop_index; ++i) {
if (backends_[i]->backend_service()->request_count() == 0) return false;
if (backends_[i]->backend_service()->request_count() == 0)
return false;
else {
gpr_log(GPR_INFO, "backend %d with request count %lu", i,
backends_[i]->backend_service()->request_count());
}
}
return true;
}

File diff suppressed because it is too large Load Diff

@ -130,6 +130,7 @@ def message(tag, msg, explanatory_text=None, do_newline=False):
try:
if platform_string() == 'windows' or not sys.stdout.isatty():
if explanatory_text:
print(explanatory_text)
logging.info(explanatory_text)
logging.info('%s: %s', tag, msg)
else:

Loading…
Cancel
Save