diff options
author | Craig Tiller <ctiller@google.com> | 2017-05-04 22:02:42 +0000 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-05-04 22:02:42 +0000 |
commit | bc7c224cac5cebc7b8cef0c6b14151f237eef8dd (patch) | |
tree | eccea363b01a3640ab4c75fedf53cd2eea8e882b /test | |
parent | 9ba9f704c30640a6cd98195b4eaf4b1fab660bec (diff) | |
parent | e1f5302bc5a00d8fb93943f9b958b10d6cd8578d (diff) |
Merge branch '0bug' into timer_pool
Diffstat (limited to 'test')
-rw-r--r-- | test/core/end2end/cq_verifier.c | 45 | ||||
-rw-r--r-- | test/cpp/client/credentials_test.cc | 4 | ||||
-rw-r--r-- | test/cpp/end2end/grpclb_end2end_test.cc | 2 |
3 files changed, 33 insertions, 18 deletions
diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c index 9b0106ec84..5eea5d43fe 100644 --- a/test/core/end2end/cq_verifier.c +++ b/test/core/end2end/cq_verifier.c @@ -189,23 +189,6 @@ int byte_buffer_eq_string(grpc_byte_buffer *bb, const char *str) { return res; } -static void verify_matches(expectation *e, grpc_event *ev) { - GPR_ASSERT(e->type == ev->type); - switch (e->type) { - case GRPC_QUEUE_SHUTDOWN: - gpr_log(GPR_ERROR, "premature queue shutdown"); - abort(); - break; - case GRPC_OP_COMPLETE: - GPR_ASSERT(e->success == ev->success); - break; - case GRPC_QUEUE_TIMEOUT: - gpr_log(GPR_ERROR, "not implemented"); - abort(); - break; - } -} - static void expectation_to_strvec(gpr_strvec *buf, expectation *e) { char *tmp; @@ -214,7 +197,7 @@ static void expectation_to_strvec(gpr_strvec *buf, expectation *e) { switch (e->type) { case GRPC_OP_COMPLETE: - gpr_asprintf(&tmp, "GRPC_OP_COMPLETE result=%d %s:%d", e->success, + gpr_asprintf(&tmp, "GRPC_OP_COMPLETE success=%d %s:%d", e->success, e->file, e->line); gpr_strvec_add(buf, tmp); break; @@ -248,6 +231,32 @@ static void fail_no_event_received(cq_verifier *v) { abort(); } +static void verify_matches(expectation *e, grpc_event *ev) { + GPR_ASSERT(e->type == ev->type); + switch (e->type) { + case GRPC_OP_COMPLETE: + if (e->success != ev->success) { + gpr_strvec expected; + gpr_strvec_init(&expected); + expectation_to_strvec(&expected, e); + char *s = gpr_strvec_flatten(&expected, NULL); + gpr_strvec_destroy(&expected); + gpr_log(GPR_ERROR, "actual success does not match expected: %s", s); + gpr_free(s); + abort(); + } + break; + case GRPC_QUEUE_SHUTDOWN: + gpr_log(GPR_ERROR, "premature queue shutdown"); + abort(); + break; + case GRPC_QUEUE_TIMEOUT: + gpr_log(GPR_ERROR, "not implemented"); + abort(); + break; + } +} + void cq_verify(cq_verifier *v) { const gpr_timespec deadline = grpc_timeout_seconds_to_deadline(10); while (v->first_expectation != NULL) { diff --git a/test/cpp/client/credentials_test.cc b/test/cpp/client/credentials_test.cc index 418a54439a..23b3b2ef3f 100644 --- a/test/cpp/client/credentials_test.cc +++ b/test/cpp/client/credentials_test.cc @@ -50,6 +50,10 @@ TEST_F(CredentialsTest, InvalidGoogleRefreshToken) { EXPECT_EQ(static_cast<CallCredentials*>(nullptr), bad1.get()); } +TEST_F(CredentialsTest, DefaultCredentials) { + auto creds = GoogleDefaultCredentials(); +} + } // namespace testing } // namespace grpc diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc index 30e1a1e0c9..8417f1a99c 100644 --- a/test/cpp/end2end/grpclb_end2end_test.cc +++ b/test/cpp/end2end/grpclb_end2end_test.cc @@ -469,6 +469,8 @@ class SingleBalancerTest : public GrpclbEnd2endTest { TEST_F(SingleBalancerTest, Vanilla) { ScheduleResponseForBalancer( 0, BalancerServiceImpl::BuildResponseForBackends(GetBackendPorts()), 0); + // Make sure that trying to connect works without a call. + channel_->GetState(true /* try_to_connect */); // Start servers and send 100 RPCs per server. const auto& statuses_and_responses = SendRpc(kMessage_, 100 * num_backends_); |