Go to the documentation of this file.
19 #include <gmock/gmock.h>
20 #include <gtest/gtest.h>
22 #include "absl/strings/str_cat.h"
23 #include "absl/strings/str_format.h"
39 using proto::EchoRequest;
40 using proto::EchoResponse;
41 using proto::EchoTestService;
42 using proto::ForwardEchoRequest;
43 using proto::ForwardEchoResponse;
47 class SimpleEchoTestServerImpl :
public proto::EchoTestService::Service {
49 explicit SimpleEchoTestServerImpl() {}
52 const proto::EchoRequest* ,
53 proto::EchoResponse* )
override {
59 const proto::ForwardEchoRequest*
request,
60 proto::ForwardEchoResponse*
response)
override {
68 void set_fail_rpc(
bool fail_rpc) {
fail_rpc_ = fail_rpc; }
88 ServerBuilder simple_builder;
113 std::unique_ptr<EchoTestService::Stub>
stub_;
116 TEST_F(EchoTest, SimpleEchoTest) {
131 TEST_F(EchoTest, ForwardEchoTest) {
137 request.set_timeout_micros(20 * 1000 * 1000);
142 for (
int i = 0;
i < 3; ++
i) {
156 TEST_F(EchoTest, ForwardEchoTestUnhandledProtocols) {
162 request.set_timeout_micros(20 * 1000 * 1000);
169 <<
" Message = " <<
status.error_message();
174 TEST_F(EchoTest, ForwardEchoFailure) {
181 request.set_timeout_micros(20 * 1000 * 1000);
194 int main(
int argc,
char** argv) {
EXPECT_THAT(status.error_message(), ::testing::HasSubstr("subject_token_type"))
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
std::unique_ptr< EchoTestService::Stub > stub_
std::atomic< bool > fail_rpc_
ASSERT_EQ(sizeof(valid_json), fwrite(valid_json, 1, sizeof(valid_json), creds_file))
std::unique_ptr< Server > server_
std::unique_ptr< EchoTestServiceImpl > echo_test_service_impl_
wrapped_grpc_channel * channel
int main(int argc, char **argv)
SimpleEchoTestServerImpl simple_test_service_impl_
std::string JoinHostPort(absl::string_view host, int port)
static const Status & OK
An OK pre-defined instance.
std::shared_ptr< Channel > CreateChannel(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
int grpc_pick_unused_port_or_die(void)
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
TEST_F(ChannelArgumentsTest, SetInt)
GRPC_CUSTOM_UTIL_STATUS Status
#define ASSERT_TRUE(condition)
#define ASSERT_FALSE(condition)
EXPECT_EQ(options.token_exchange_service_uri, "https://foo/exchange")
std::shared_ptr< ServerCredentials > InsecureServerCredentials()
internal::AllOfResult2< M1, M2 >::type AllOf(M1 m1, M2 m2)
grpc::ClientContext context
std::unique_ptr< Server > simple_server_
std::shared_ptr< ChannelCredentials > InsecureChannelCredentials()
Credentials for an unencrypted, unauthenticated channel.
GRPCAPI void grpc_init(void)
std::string forwarding_address_
PolymorphicMatcher< internal::HasSubstrMatcher< internal::string > > HasSubstr(const internal::string &substring)
GRPCAPI void grpc_shutdown(void)
std::string server_address_
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:22