pull/37104/head
Esun Kim 8 months ago
parent 2a6f41c5e3
commit 7b905869b8
  1. 2
      src/core/handshaker/http_connect/http_connect_handshaker.cc
  2. 2
      src/core/lib/gprpp/status_helper.cc
  3. 2
      src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
  4. 2
      src/cpp/server/server_cc.cc
  5. 2
      test/core/event_engine/test_suite/posix/oracle_event_engine_posix.cc
  6. 2
      test/core/event_engine/test_suite/posix/oracle_event_engine_posix.h
  7. 2
      test/cpp/end2end/mock_test.cc
  8. 2
      test/cpp/end2end/test_service_impl.cc
  9. 2
      test/cpp/end2end/test_service_impl.h
  10. 3
      test/cpp/ext/otel/otel_test_library.cc
  11. 2
      test/cpp/interop/stress_test.cc
  12. 4
      test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong_chaotic_good.cc
  13. 4
      test/cpp/microbenchmarks/fullstack_fixtures.h
  14. 2
      test/cpp/qps/driver.cc
  15. 4
      test/cpp/util/grpc_tool.cc

@ -189,7 +189,7 @@ bool HttpConnectHandshaker::OnReadDoneLocked(absl::Status error) {
// Add buffer to parser. // Add buffer to parser.
while (args_->read_buffer.Count() > 0) { while (args_->read_buffer.Count() > 0) {
Slice slice = args_->read_buffer.TakeFirst(); Slice slice = args_->read_buffer.TakeFirst();
if (slice.length() > 0) { if (!slice.empty()) {
size_t body_start_offset = 0; size_t body_start_offset = 0;
error = grpc_http_parser_parse(&http_parser_, slice.c_slice(), error = grpc_http_parser_parse(&http_parser_, slice.c_slice(),
&body_start_offset); &body_start_offset);

@ -342,7 +342,7 @@ google_rpc_Status* StatusToProto(const absl::Status& status, upb_Arena* arena) {
PercentEncodingType::Compatible); PercentEncodingType::Compatible);
char* message_percent = reinterpret_cast<char*>( char* message_percent = reinterpret_cast<char*>(
upb_Arena_Malloc(arena, message_percent_slice.length())); upb_Arena_Malloc(arena, message_percent_slice.length()));
if (message_percent_slice.length() > 0) { if (!message_percent_slice.empty()) {
memcpy(message_percent, message_percent_slice.data(), memcpy(message_percent, message_percent_slice.data(),
message_percent_slice.length()); message_percent_slice.length());
} }

@ -539,7 +539,7 @@ void MaybeAddToBody(const char* field_name, const char* field,
grpc_error_handle LoadTokenFile(const char* path, grpc_slice* token) { grpc_error_handle LoadTokenFile(const char* path, grpc_slice* token) {
auto slice = LoadFile(path, /*add_null_terminator=*/true); auto slice = LoadFile(path, /*add_null_terminator=*/true);
if (!slice.ok()) return slice.status(); if (!slice.ok()) return slice.status();
if (slice->length() == 0) { if (slice->empty()) {
LOG(ERROR) << "Token file " << path << " is empty"; LOG(ERROR) << "Token file " << path << " is empty";
return GRPC_ERROR_CREATE("Token file is empty."); return GRPC_ERROR_CREATE("Token file is empty.");
} }

@ -111,7 +111,7 @@ gpr_once g_once_init_callbacks = GPR_ONCE_INIT;
void InitGlobalCallbacks() { void InitGlobalCallbacks() {
if (!g_callbacks) { if (!g_callbacks) {
g_callbacks.reset(new DefaultGlobalCallbacks()); g_callbacks = std::make_shared<DefaultGlobalCallbacks>();
} }
} }

@ -185,7 +185,7 @@ int WriteBytes(int sockfd, int& saved_errno, std::string write_bytes) {
return ret; return ret;
} }
write_bytes = write_bytes.substr(ret, std::string::npos); write_bytes = write_bytes.substr(ret, std::string::npos);
} while (write_bytes.length() > 0); } while (!write_bytes.empty());
return original_write_length; return original_write_length;
} }
} // namespace } // namespace

@ -92,7 +92,7 @@ class PosixOracleEndpoint : public EventEngine::Endpoint {
absl::AnyInvocable<void(absl::Status)>&& on_complete) absl::AnyInvocable<void(absl::Status)>&& on_complete)
: bytes_to_write_(ExtractSliceBufferIntoString(buffer)), : bytes_to_write_(ExtractSliceBufferIntoString(buffer)),
on_complete_(std::move(on_complete)) {} on_complete_(std::move(on_complete)) {}
bool IsValid() { return bytes_to_write_.length() > 0; } bool IsValid() { return !bytes_to_write_.empty(); }
std::string GetBytesToWrite() const { return bytes_to_write_; } std::string GetBytesToWrite() const { return bytes_to_write_; }
void operator()(absl::Status status) { void operator()(absl::Status status) {
if (on_complete_ != nullptr) { if (on_complete_ != nullptr) {

@ -167,7 +167,7 @@ class CallbackTestServiceImpl : public EchoTestService::CallbackService {
// adding this variance in Status return value just to improve coverage in // adding this variance in Status return value just to improve coverage in
// this test. // this test.
auto* reactor = context->DefaultReactor(); auto* reactor = context->DefaultReactor();
if (request->message().length() > 0) { if (!request->message().empty()) {
response->set_message(request->message()); response->set_message(request->message());
reactor->Finish(Status::OK); reactor->Finish(Status::OK);
} else { } else {

@ -290,7 +290,7 @@ ServerUnaryReactor* CallbackTestServiceImpl::Echo(
} }
} }
if (req_->has_param() && if (req_->has_param() &&
(req_->param().expected_client_identity().length() > 0 || (!req_->param().expected_client_identity().empty() ||
req_->param().check_auth_context())) { req_->param().check_auth_context())) {
internal::CheckServerAuthContext( internal::CheckServerAuthContext(
ctx_, req_->param().expected_transport_security_type(), ctx_, req_->param().expected_transport_security_type(),

@ -256,7 +256,7 @@ class TestMultipleServiceImpl : public RpcService {
} }
} }
if (request->has_param() && if (request->has_param() &&
(request->param().expected_client_identity().length() > 0 || (!request->param().expected_client_identity().empty() ||
request->param().check_auth_context())) { request->param().check_auth_context())) {
internal::CheckServerAuthContext( internal::CheckServerAuthContext(
context, request->param().expected_transport_security_type(), context, request->param().expected_transport_security_type(),

@ -19,6 +19,7 @@
#include "test/cpp/ext/otel/otel_test_library.h" #include "test/cpp/ext/otel/otel_test_library.h"
#include <atomic> #include <atomic>
#include <memory>
#include "absl/functional/any_invocable.h" #include "absl/functional/any_invocable.h"
#include "gmock/gmock.h" #include "gmock/gmock.h"
@ -289,7 +290,7 @@ OpenTelemetryPluginEnd2EndTest::ConfigureOTBuilder(
if (options.use_meter_provider) { if (options.use_meter_provider) {
auto meter_provider = auto meter_provider =
std::make_shared<opentelemetry::sdk::metrics::MeterProvider>(); std::make_shared<opentelemetry::sdk::metrics::MeterProvider>();
reader.reset(new grpc::testing::MockMetricReader); reader = std::make_shared<grpc::testing::MockMetricReader>();
meter_provider->AddMetricReader(reader); meter_provider->AddMetricReader(reader);
ot_builder->SetMeterProvider(std::move(meter_provider)); ot_builder->SetMeterProvider(std::move(meter_provider));
} }

@ -253,7 +253,7 @@ int main(int argc, char** argv) {
server_addresses); server_addresses);
// Parse test cases and weights // Parse test cases and weights
if (absl::GetFlag(FLAGS_test_cases).length() == 0) { if (absl::GetFlag(FLAGS_test_cases).empty()) {
LOG(ERROR) << "No test cases supplied"; LOG(ERROR) << "No test cases supplied";
return 1; return 1;
} }

@ -35,7 +35,7 @@ class ChaoticGoodFixture : public BaseFixture {
const FixtureConfiguration& config = FixtureConfiguration()) { const FixtureConfiguration& config = FixtureConfiguration()) {
auto address = MakeAddress(&port_); auto address = MakeAddress(&port_);
ServerBuilder b; ServerBuilder b;
if (address.length() > 0) { if (!address.empty()) {
b.AddListeningPort(address, ChaoticGoodInsecureServerCredentials()); b.AddListeningPort(address, ChaoticGoodInsecureServerCredentials());
} }
cq_ = b.AddCompletionQueue(true); cq_ = b.AddCompletionQueue(true);
@ -44,7 +44,7 @@ class ChaoticGoodFixture : public BaseFixture {
server_ = b.BuildAndStart(); server_ = b.BuildAndStart();
ChannelArguments args; ChannelArguments args;
config.ApplyCommonChannelArguments(&args); config.ApplyCommonChannelArguments(&args);
if (address.length() > 0) { if (!address.empty()) {
channel_ = grpc::CreateCustomChannel( channel_ = grpc::CreateCustomChannel(
address, ChaoticGoodInsecureChannelCredentials(), args); address, ChaoticGoodInsecureChannelCredentials(), args);
} else { } else {

@ -77,7 +77,7 @@ class FullstackFixture : public BaseFixture {
FullstackFixture(Service* service, const FixtureConfiguration& config, FullstackFixture(Service* service, const FixtureConfiguration& config,
const std::string& address) { const std::string& address) {
ServerBuilder b; ServerBuilder b;
if (address.length() > 0) { if (!address.empty()) {
b.AddListeningPort(address, InsecureServerCredentials()); b.AddListeningPort(address, InsecureServerCredentials());
} }
cq_ = b.AddCompletionQueue(true); cq_ = b.AddCompletionQueue(true);
@ -86,7 +86,7 @@ class FullstackFixture : public BaseFixture {
server_ = b.BuildAndStart(); server_ = b.BuildAndStart();
ChannelArguments args; ChannelArguments args;
config.ApplyCommonChannelArguments(&args); config.ApplyCommonChannelArguments(&args);
if (address.length() > 0) { if (!address.empty()) {
channel_ = grpc::CreateCustomChannel(address, channel_ = grpc::CreateCustomChannel(address,
InsecureChannelCredentials(), args); InsecureChannelCredentials(), args);
} else { } else {

@ -468,7 +468,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
client_config.add_server_targets(cli_target.c_str()); client_config.add_server_targets(cli_target.c_str());
} }
} }
if (qps_server_target_override.length() > 0) { if (!qps_server_target_override.empty()) {
// overriding the qps server target only makes since if there is <= 1 // overriding the qps server target only makes since if there is <= 1
// servers // servers
CHECK_LE(num_servers, 1u); CHECK_LE(num_servers, 1u);

@ -653,7 +653,7 @@ bool GrpcTool::CallMethod(int argc, const char** argv,
fprintf(stderr, "Request sent.\n"); fprintf(stderr, "Request sent.\n");
} }
} else { } else {
if (line.length() == 0) { if (line.empty()) {
request_text = request_ss.str(); request_text = request_ss.str();
request_ss.str(std::string()); request_ss.str(std::string());
request_ss.clear(); request_ss.clear();
@ -786,7 +786,7 @@ bool GrpcTool::CallMethod(int argc, const char** argv,
} }
} }
} else { } else {
if (line.length() == 0) { if (line.empty()) {
request_text = request_ss.str(); request_text = request_ss.str();
request_ss.str(std::string()); request_ss.str(std::string());
request_ss.clear(); request_ss.clear();

Loading…
Cancel
Save