Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
Craig Tiller | 6169d5f | 2016-03-31 07:46:18 -0700 | [diff] [blame] | 3 | * Copyright 2015, Google Inc. |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 4 | * All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions are |
| 8 | * met: |
| 9 | * |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above |
| 13 | * copyright notice, this list of conditions and the following disclaimer |
| 14 | * in the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * * Neither the name of Google Inc. nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived from |
| 18 | * this software without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | * |
| 32 | */ |
| 33 | |
| 34 | #include "test/core/end2end/end2end_tests.h" |
| 35 | |
| 36 | #include <stdio.h> |
| 37 | #include <string.h> |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 38 | |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 39 | #include <grpc/byte_buffer.h> |
Craig Tiller | f40df23 | 2016-03-25 13:38:14 -0700 | [diff] [blame] | 40 | #include <grpc/grpc_security.h> |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 41 | #include <grpc/support/alloc.h> |
| 42 | #include <grpc/support/log.h> |
| 43 | #include <grpc/support/time.h> |
| 44 | #include <grpc/support/useful.h> |
Julien Boeuf | 8ca294e | 2016-05-02 14:56:30 -0700 | [diff] [blame] | 45 | #include "src/core/lib/security/credentials/credentials.h" |
Craig Tiller | 9533d04 | 2016-03-25 17:11:06 -0700 | [diff] [blame] | 46 | #include "src/core/lib/support/string.h" |
Craig Tiller | f40df23 | 2016-03-25 13:38:14 -0700 | [diff] [blame] | 47 | #include "test/core/end2end/cq_verifier.h" |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 48 | |
| 49 | static const char iam_token[] = "token"; |
| 50 | static const char iam_selector[] = "selector"; |
| 51 | static const char overridden_iam_token[] = "overridden_token"; |
| 52 | static const char overridden_iam_selector[] = "overridden_selector"; |
| 53 | |
Craig Tiller | 9a57633 | 2015-06-17 10:21:49 -0700 | [diff] [blame] | 54 | typedef enum { NONE, OVERRIDE, DESTROY } override_mode; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 55 | |
Craig Tiller | 7536af0 | 2015-12-22 13:49:30 -0800 | [diff] [blame] | 56 | static void *tag(intptr_t t) { return (void *)t; } |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 57 | |
| 58 | static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, |
| 59 | const char *test_name, |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 60 | int fail_server_auth_check) { |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 61 | grpc_end2end_test_fixture f; |
Robbie Shade | 55a046a | 2017-01-25 15:14:28 -0500 | [diff] [blame] | 62 | gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name); |
Julien Boeuf | ea456fc | 2015-07-07 15:23:30 -0700 | [diff] [blame] | 63 | f = config.create_fixture(NULL, NULL); |
Mark D. Roth | e127a39 | 2016-10-27 08:27:15 -0700 | [diff] [blame] | 64 | config.init_client(&f, NULL); |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 65 | if (fail_server_auth_check) { |
| 66 | grpc_arg fail_auth_arg = { |
| 67 | GRPC_ARG_STRING, FAIL_AUTH_CHECK_SERVER_ARG_NAME, {NULL}}; |
| 68 | grpc_channel_args args; |
Craig Tiller | d6c98df | 2015-08-18 09:33:44 -0700 | [diff] [blame] | 69 | args.num_args = 1; |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 70 | args.args = &fail_auth_arg; |
| 71 | config.init_server(&f, &args); |
| 72 | } else { |
| 73 | config.init_server(&f, NULL); |
| 74 | } |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 75 | return f; |
| 76 | } |
| 77 | |
Chris Evans | ed2a547 | 2017-03-27 17:34:51 -0500 | [diff] [blame] | 78 | static gpr_timespec n_seconds_from_now(int n) { |
Robbie Shade | ca7effc | 2017-01-17 09:14:29 -0500 | [diff] [blame] | 79 | return grpc_timeout_seconds_to_deadline(n); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 80 | } |
| 81 | |
Chris Evans | ed2a547 | 2017-03-27 17:34:51 -0500 | [diff] [blame] | 82 | static gpr_timespec five_seconds_from_now(void) { |
| 83 | return n_seconds_from_now(5); |
| 84 | } |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 85 | |
| 86 | static void drain_cq(grpc_completion_queue *cq) { |
Craig Tiller | c731323 | 2015-05-08 17:05:14 -0700 | [diff] [blame] | 87 | grpc_event ev; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 88 | do { |
Chris Evans | ed2a547 | 2017-03-27 17:34:51 -0500 | [diff] [blame] | 89 | ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); |
Craig Tiller | c731323 | 2015-05-08 17:05:14 -0700 | [diff] [blame] | 90 | } while (ev.type != GRPC_QUEUE_SHUTDOWN); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | static void shutdown_server(grpc_end2end_test_fixture *f) { |
| 94 | if (!f->server) return; |
Sree Kuchibhotla | 321881d | 2017-02-27 11:25:28 -0800 | [diff] [blame] | 95 | grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); |
Sree Kuchibhotla | 752be9c | 2017-03-03 14:36:02 -0800 | [diff] [blame] | 96 | GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), |
| 97 | grpc_timeout_seconds_to_deadline(5), |
| 98 | NULL) |
Craig Tiller | f40df23 | 2016-03-25 13:38:14 -0700 | [diff] [blame] | 99 | .type == GRPC_OP_COMPLETE); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 100 | grpc_server_destroy(f->server); |
| 101 | f->server = NULL; |
| 102 | } |
| 103 | |
| 104 | static void shutdown_client(grpc_end2end_test_fixture *f) { |
| 105 | if (!f->client) return; |
| 106 | grpc_channel_destroy(f->client); |
| 107 | f->client = NULL; |
| 108 | } |
| 109 | |
| 110 | static void end_test(grpc_end2end_test_fixture *f) { |
| 111 | shutdown_server(f); |
| 112 | shutdown_client(f); |
| 113 | |
Craig Tiller | bc0ec33 | 2015-05-11 12:11:32 -0700 | [diff] [blame] | 114 | grpc_completion_queue_shutdown(f->cq); |
| 115 | drain_cq(f->cq); |
| 116 | grpc_completion_queue_destroy(f->cq); |
Sree Kuchibhotla | 321881d | 2017-02-27 11:25:28 -0800 | [diff] [blame] | 117 | grpc_completion_queue_destroy(f->shutdown_cq); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 118 | } |
| 119 | |
Julien Boeuf | 84d964a | 2015-04-29 11:31:06 -0700 | [diff] [blame] | 120 | static void print_auth_context(int is_client, const grpc_auth_context *ctx) { |
| 121 | const grpc_auth_property *p; |
Julien Boeuf | 83b0297 | 2015-05-20 22:50:34 -0700 | [diff] [blame] | 122 | grpc_auth_property_iterator it; |
Julien Boeuf | 84d964a | 2015-04-29 11:31:06 -0700 | [diff] [blame] | 123 | gpr_log(GPR_INFO, "%s peer:", is_client ? "client" : "server"); |
Julien Boeuf | 83b0297 | 2015-05-20 22:50:34 -0700 | [diff] [blame] | 124 | gpr_log(GPR_INFO, "\tauthenticated: %s", |
| 125 | grpc_auth_context_peer_is_authenticated(ctx) ? "YES" : "NO"); |
Julien Boeuf | 84d964a | 2015-04-29 11:31:06 -0700 | [diff] [blame] | 126 | it = grpc_auth_context_peer_identity(ctx); |
Julien Boeuf | 83b0297 | 2015-05-20 22:50:34 -0700 | [diff] [blame] | 127 | while ((p = grpc_auth_property_iterator_next(&it)) != NULL) { |
| 128 | gpr_log(GPR_INFO, "\t\t%s: %s", p->name, p->value); |
Julien Boeuf | 84d964a | 2015-04-29 11:31:06 -0700 | [diff] [blame] | 129 | } |
| 130 | gpr_log(GPR_INFO, "\tall properties:"); |
| 131 | it = grpc_auth_context_property_iterator(ctx); |
Julien Boeuf | 83b0297 | 2015-05-20 22:50:34 -0700 | [diff] [blame] | 132 | while ((p = grpc_auth_property_iterator_next(&it)) != NULL) { |
Julien Boeuf | 84d964a | 2015-04-29 11:31:06 -0700 | [diff] [blame] | 133 | gpr_log(GPR_INFO, "\t\t%s: %s", p->name, p->value); |
| 134 | } |
Julien Boeuf | 84d964a | 2015-04-29 11:31:06 -0700 | [diff] [blame] | 135 | } |
| 136 | |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 137 | static void request_response_with_payload_and_call_creds( |
| 138 | const char *test_name, grpc_end2end_test_config config, |
| 139 | override_mode mode) { |
| 140 | grpc_call *c; |
| 141 | grpc_call *s; |
Craig Tiller | 28b7242 | 2016-10-26 21:15:29 -0700 | [diff] [blame] | 142 | grpc_slice request_payload_slice = |
| 143 | grpc_slice_from_copied_string("hello world"); |
| 144 | grpc_slice response_payload_slice = |
| 145 | grpc_slice_from_copied_string("hello you"); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 146 | grpc_byte_buffer *request_payload = |
David Garcia Quintas | 59f905d | 2015-06-08 16:31:19 -0700 | [diff] [blame] | 147 | grpc_raw_byte_buffer_create(&request_payload_slice, 1); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 148 | grpc_byte_buffer *response_payload = |
David Garcia Quintas | 59f905d | 2015-06-08 16:31:19 -0700 | [diff] [blame] | 149 | grpc_raw_byte_buffer_create(&response_payload_slice, 1); |
Julien Boeuf | a87d6c2 | 2015-07-17 15:51:46 -0700 | [diff] [blame] | 150 | grpc_end2end_test_fixture f; |
| 151 | cq_verifier *cqv; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 152 | grpc_op ops[6]; |
| 153 | grpc_op *op; |
| 154 | grpc_metadata_array initial_metadata_recv; |
| 155 | grpc_metadata_array trailing_metadata_recv; |
| 156 | grpc_metadata_array request_metadata_recv; |
| 157 | grpc_byte_buffer *request_payload_recv = NULL; |
| 158 | grpc_byte_buffer *response_payload_recv = NULL; |
| 159 | grpc_call_details call_details; |
| 160 | grpc_status_code status; |
Nicolas "Pixel" Noble | 9a123df | 2015-07-29 23:45:08 +0200 | [diff] [blame] | 161 | grpc_call_error error; |
Craig Tiller | 7c70b6c | 2017-01-23 07:48:42 -0800 | [diff] [blame] | 162 | grpc_slice details; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 163 | int was_cancelled = 2; |
Julien Boeuf | 4e02e84 | 2015-10-09 22:49:42 -0700 | [diff] [blame] | 164 | grpc_call_credentials *creds = NULL; |
yang-g | d53bc89 | 2015-07-09 12:56:29 -0700 | [diff] [blame] | 165 | grpc_auth_context *s_auth_context = NULL; |
Julien Boeuf | ea456fc | 2015-07-07 15:23:30 -0700 | [diff] [blame] | 166 | grpc_auth_context *c_auth_context = NULL; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 167 | |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 168 | f = begin_test(config, test_name, 0); |
Julien Boeuf | a87d6c2 | 2015-07-17 15:51:46 -0700 | [diff] [blame] | 169 | cqv = cq_verifier_create(f.cq); |
| 170 | |
Chris Evans | ed2a547 | 2017-03-27 17:34:51 -0500 | [diff] [blame] | 171 | gpr_timespec deadline = five_seconds_from_now(); |
Muxi Yan | 5ebd327 | 2016-10-31 07:27:07 -0700 | [diff] [blame] | 172 | c = grpc_channel_create_call( |
Craig Tiller | 7c70b6c | 2017-01-23 07:48:42 -0800 | [diff] [blame] | 173 | f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, |
| 174 | grpc_slice_from_static_string("/foo"), |
| 175 | get_host_override_slice("foo.test.google.fr:1234", config), deadline, |
Muxi Yan | 5ebd327 | 2016-10-31 07:27:07 -0700 | [diff] [blame] | 176 | NULL); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 177 | GPR_ASSERT(c); |
Julien Boeuf | 510a920 | 2015-08-25 21:51:07 -0700 | [diff] [blame] | 178 | creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 179 | GPR_ASSERT(creds != NULL); |
| 180 | GPR_ASSERT(grpc_call_set_credentials(c, creds) == GRPC_CALL_OK); |
| 181 | switch (mode) { |
| 182 | case NONE: |
| 183 | break; |
| 184 | case OVERRIDE: |
Julien Boeuf | 4e02e84 | 2015-10-09 22:49:42 -0700 | [diff] [blame] | 185 | grpc_call_credentials_release(creds); |
Julien Boeuf | 510a920 | 2015-08-25 21:51:07 -0700 | [diff] [blame] | 186 | creds = grpc_google_iam_credentials_create(overridden_iam_token, |
| 187 | overridden_iam_selector, NULL); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 188 | GPR_ASSERT(creds != NULL); |
| 189 | GPR_ASSERT(grpc_call_set_credentials(c, creds) == GRPC_CALL_OK); |
| 190 | break; |
Nicolas "Pixel" Noble | b5cb8d1 | 2015-05-09 09:16:19 +0200 | [diff] [blame] | 191 | case DESTROY: |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 192 | GPR_ASSERT(grpc_call_set_credentials(c, NULL) == GRPC_CALL_OK); |
| 193 | break; |
| 194 | } |
Julien Boeuf | 4e02e84 | 2015-10-09 22:49:42 -0700 | [diff] [blame] | 195 | grpc_call_credentials_release(creds); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 196 | |
| 197 | grpc_metadata_array_init(&initial_metadata_recv); |
| 198 | grpc_metadata_array_init(&trailing_metadata_recv); |
| 199 | grpc_metadata_array_init(&request_metadata_recv); |
| 200 | grpc_call_details_init(&call_details); |
| 201 | |
David Garcia Quintas | a301eaa | 2016-05-06 16:59:03 -0700 | [diff] [blame] | 202 | memset(ops, 0, sizeof(ops)); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 203 | op = ops; |
| 204 | op->op = GRPC_OP_SEND_INITIAL_METADATA; |
| 205 | op->data.send_initial_metadata.count = 0; |
David Garcia Quintas | 1d5aca5 | 2015-06-14 14:42:04 -0700 | [diff] [blame] | 206 | op->flags = 0; |
Nicolas "Pixel" Noble | 4960516 | 2015-08-01 00:12:01 +0200 | [diff] [blame] | 207 | op->reserved = NULL; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 208 | op++; |
| 209 | op->op = GRPC_OP_SEND_MESSAGE; |
Mark D. Roth | 435f9f2 | 2017-01-25 12:53:54 -0800 | [diff] [blame] | 210 | op->data.send_message.send_message = request_payload; |
David Garcia Quintas | 1d5aca5 | 2015-06-14 14:42:04 -0700 | [diff] [blame] | 211 | op->flags = 0; |
Nicolas "Pixel" Noble | 4960516 | 2015-08-01 00:12:01 +0200 | [diff] [blame] | 212 | op->reserved = NULL; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 213 | op++; |
| 214 | op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; |
David Garcia Quintas | 1d5aca5 | 2015-06-14 14:42:04 -0700 | [diff] [blame] | 215 | op->flags = 0; |
Nicolas "Pixel" Noble | 4960516 | 2015-08-01 00:12:01 +0200 | [diff] [blame] | 216 | op->reserved = NULL; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 217 | op++; |
| 218 | op->op = GRPC_OP_RECV_INITIAL_METADATA; |
Mark D. Roth | 435f9f2 | 2017-01-25 12:53:54 -0800 | [diff] [blame] | 219 | op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; |
David Garcia Quintas | 1d5aca5 | 2015-06-14 14:42:04 -0700 | [diff] [blame] | 220 | op->flags = 0; |
Nicolas "Pixel" Noble | 4960516 | 2015-08-01 00:12:01 +0200 | [diff] [blame] | 221 | op->reserved = NULL; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 222 | op++; |
| 223 | op->op = GRPC_OP_RECV_MESSAGE; |
Mark D. Roth | 435f9f2 | 2017-01-25 12:53:54 -0800 | [diff] [blame] | 224 | op->data.recv_message.recv_message = &response_payload_recv; |
David Garcia Quintas | 1d5aca5 | 2015-06-14 14:42:04 -0700 | [diff] [blame] | 225 | op->flags = 0; |
Nicolas "Pixel" Noble | 4960516 | 2015-08-01 00:12:01 +0200 | [diff] [blame] | 226 | op->reserved = NULL; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 227 | op++; |
| 228 | op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; |
| 229 | op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; |
| 230 | op->data.recv_status_on_client.status = &status; |
| 231 | op->data.recv_status_on_client.status_details = &details; |
David Garcia Quintas | 1d5aca5 | 2015-06-14 14:42:04 -0700 | [diff] [blame] | 232 | op->flags = 0; |
Nicolas "Pixel" Noble | 4960516 | 2015-08-01 00:12:01 +0200 | [diff] [blame] | 233 | op->reserved = NULL; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 234 | op++; |
Craig Tiller | 3121fd4 | 2015-09-10 09:56:20 -0700 | [diff] [blame] | 235 | error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); |
Nicolas "Pixel" Noble | 9a123df | 2015-07-29 23:45:08 +0200 | [diff] [blame] | 236 | GPR_ASSERT(GRPC_CALL_OK == error); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 237 | |
Craig Tiller | d6c98df | 2015-08-18 09:33:44 -0700 | [diff] [blame] | 238 | error = |
| 239 | grpc_server_request_call(f.server, &s, &call_details, |
| 240 | &request_metadata_recv, f.cq, f.cq, tag(101)); |
Nicolas "Pixel" Noble | 9a123df | 2015-07-29 23:45:08 +0200 | [diff] [blame] | 241 | GPR_ASSERT(GRPC_CALL_OK == error); |
Mark D. Roth | 7187ab9 | 2016-08-24 13:49:22 -0700 | [diff] [blame] | 242 | CQ_EXPECT_COMPLETION(cqv, tag(101), 1); |
Craig Tiller | bc0ec33 | 2015-05-11 12:11:32 -0700 | [diff] [blame] | 243 | cq_verify(cqv); |
Julien Boeuf | 84d964a | 2015-04-29 11:31:06 -0700 | [diff] [blame] | 244 | s_auth_context = grpc_call_auth_context(s); |
| 245 | GPR_ASSERT(s_auth_context != NULL); |
| 246 | print_auth_context(0, s_auth_context); |
yang-g | d53bc89 | 2015-07-09 12:56:29 -0700 | [diff] [blame] | 247 | grpc_auth_context_release(s_auth_context); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 248 | |
Julien Boeuf | ea456fc | 2015-07-07 15:23:30 -0700 | [diff] [blame] | 249 | c_auth_context = grpc_call_auth_context(c); |
| 250 | GPR_ASSERT(c_auth_context != NULL); |
| 251 | print_auth_context(1, c_auth_context); |
| 252 | grpc_auth_context_release(c_auth_context); |
| 253 | |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 254 | /* Cannot set creds on the server call object. */ |
Craig Tiller | e7da1d4 | 2015-05-12 14:59:24 -0700 | [diff] [blame] | 255 | GPR_ASSERT(grpc_call_set_credentials(s, NULL) != GRPC_CALL_OK); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 256 | |
David Garcia Quintas | a301eaa | 2016-05-06 16:59:03 -0700 | [diff] [blame] | 257 | memset(ops, 0, sizeof(ops)); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 258 | op = ops; |
| 259 | op->op = GRPC_OP_SEND_INITIAL_METADATA; |
| 260 | op->data.send_initial_metadata.count = 0; |
David Garcia Quintas | 1d5aca5 | 2015-06-14 14:42:04 -0700 | [diff] [blame] | 261 | op->flags = 0; |
Nicolas "Pixel" Noble | 4960516 | 2015-08-01 00:12:01 +0200 | [diff] [blame] | 262 | op->reserved = NULL; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 263 | op++; |
Craig Tiller | 4541f33 | 2015-05-19 16:26:33 -0700 | [diff] [blame] | 264 | op->op = GRPC_OP_RECV_MESSAGE; |
Mark D. Roth | 435f9f2 | 2017-01-25 12:53:54 -0800 | [diff] [blame] | 265 | op->data.recv_message.recv_message = &request_payload_recv; |
David Garcia Quintas | 1d5aca5 | 2015-06-14 14:42:04 -0700 | [diff] [blame] | 266 | op->flags = 0; |
Nicolas "Pixel" Noble | 4960516 | 2015-08-01 00:12:01 +0200 | [diff] [blame] | 267 | op->reserved = NULL; |
Craig Tiller | 4541f33 | 2015-05-19 16:26:33 -0700 | [diff] [blame] | 268 | op++; |
Craig Tiller | 3121fd4 | 2015-09-10 09:56:20 -0700 | [diff] [blame] | 269 | error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); |
Nicolas "Pixel" Noble | 9a123df | 2015-07-29 23:45:08 +0200 | [diff] [blame] | 270 | GPR_ASSERT(GRPC_CALL_OK == error); |
Craig Tiller | 4541f33 | 2015-05-19 16:26:33 -0700 | [diff] [blame] | 271 | |
Mark D. Roth | 7187ab9 | 2016-08-24 13:49:22 -0700 | [diff] [blame] | 272 | CQ_EXPECT_COMPLETION(cqv, tag(102), 1); |
Craig Tiller | dad88a7 | 2015-05-26 17:01:09 -0700 | [diff] [blame] | 273 | cq_verify(cqv); |
| 274 | |
David Garcia Quintas | a301eaa | 2016-05-06 16:59:03 -0700 | [diff] [blame] | 275 | memset(ops, 0, sizeof(ops)); |
Craig Tiller | 4541f33 | 2015-05-19 16:26:33 -0700 | [diff] [blame] | 276 | op = ops; |
| 277 | op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; |
| 278 | op->data.recv_close_on_server.cancelled = &was_cancelled; |
David Garcia Quintas | 1d5aca5 | 2015-06-14 14:42:04 -0700 | [diff] [blame] | 279 | op->flags = 0; |
Nicolas "Pixel" Noble | 4960516 | 2015-08-01 00:12:01 +0200 | [diff] [blame] | 280 | op->reserved = NULL; |
Craig Tiller | 4541f33 | 2015-05-19 16:26:33 -0700 | [diff] [blame] | 281 | op++; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 282 | op->op = GRPC_OP_SEND_MESSAGE; |
Mark D. Roth | 435f9f2 | 2017-01-25 12:53:54 -0800 | [diff] [blame] | 283 | op->data.send_message.send_message = response_payload; |
David Garcia Quintas | 1d5aca5 | 2015-06-14 14:42:04 -0700 | [diff] [blame] | 284 | op->flags = 0; |
Nicolas "Pixel" Noble | 4960516 | 2015-08-01 00:12:01 +0200 | [diff] [blame] | 285 | op->reserved = NULL; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 286 | op++; |
| 287 | op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; |
| 288 | op->data.send_status_from_server.trailing_metadata_count = 0; |
Julien Boeuf | 554c79c | 2015-05-08 14:51:25 -0700 | [diff] [blame] | 289 | op->data.send_status_from_server.status = GRPC_STATUS_OK; |
Craig Tiller | 7c70b6c | 2017-01-23 07:48:42 -0800 | [diff] [blame] | 290 | grpc_slice status_details = grpc_slice_from_static_string("xyz"); |
| 291 | op->data.send_status_from_server.status_details = &status_details; |
David Garcia Quintas | 1d5aca5 | 2015-06-14 14:42:04 -0700 | [diff] [blame] | 292 | op->flags = 0; |
Nicolas "Pixel" Noble | 4960516 | 2015-08-01 00:12:01 +0200 | [diff] [blame] | 293 | op->reserved = NULL; |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 294 | op++; |
Craig Tiller | 3121fd4 | 2015-09-10 09:56:20 -0700 | [diff] [blame] | 295 | error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); |
Nicolas "Pixel" Noble | 9a123df | 2015-07-29 23:45:08 +0200 | [diff] [blame] | 296 | GPR_ASSERT(GRPC_CALL_OK == error); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 297 | |
Mark D. Roth | 7187ab9 | 2016-08-24 13:49:22 -0700 | [diff] [blame] | 298 | CQ_EXPECT_COMPLETION(cqv, tag(103), 1); |
| 299 | CQ_EXPECT_COMPLETION(cqv, tag(1), 1); |
Craig Tiller | bc0ec33 | 2015-05-11 12:11:32 -0700 | [diff] [blame] | 300 | cq_verify(cqv); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 301 | |
Julien Boeuf | 554c79c | 2015-05-08 14:51:25 -0700 | [diff] [blame] | 302 | GPR_ASSERT(status == GRPC_STATUS_OK); |
Craig Tiller | 7c70b6c | 2017-01-23 07:48:42 -0800 | [diff] [blame] | 303 | GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); |
| 304 | GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); |
Muxi Yan | 5ebd327 | 2016-10-31 07:27:07 -0700 | [diff] [blame] | 305 | validate_host_override_string("foo.test.google.fr:1234", call_details.host, |
| 306 | config); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 307 | GPR_ASSERT(was_cancelled == 0); |
| 308 | GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); |
| 309 | GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); |
| 310 | |
| 311 | switch (mode) { |
| 312 | case NONE: |
| 313 | GPR_ASSERT(contains_metadata(&request_metadata_recv, |
| 314 | GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, |
| 315 | iam_token)); |
| 316 | GPR_ASSERT(contains_metadata(&request_metadata_recv, |
| 317 | GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY, |
| 318 | iam_selector)); |
| 319 | break; |
| 320 | case OVERRIDE: |
| 321 | GPR_ASSERT(contains_metadata(&request_metadata_recv, |
| 322 | GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, |
| 323 | overridden_iam_token)); |
| 324 | GPR_ASSERT(contains_metadata(&request_metadata_recv, |
| 325 | GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY, |
| 326 | overridden_iam_selector)); |
| 327 | break; |
Nicolas "Pixel" Noble | b5cb8d1 | 2015-05-09 09:16:19 +0200 | [diff] [blame] | 328 | case DESTROY: |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 329 | GPR_ASSERT(!contains_metadata(&request_metadata_recv, |
| 330 | GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, |
| 331 | iam_token)); |
| 332 | GPR_ASSERT(!contains_metadata(&request_metadata_recv, |
| 333 | GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY, |
| 334 | iam_selector)); |
| 335 | GPR_ASSERT(!contains_metadata(&request_metadata_recv, |
| 336 | GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, |
| 337 | overridden_iam_token)); |
| 338 | GPR_ASSERT(!contains_metadata(&request_metadata_recv, |
| 339 | GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY, |
| 340 | overridden_iam_selector)); |
| 341 | break; |
| 342 | } |
| 343 | |
Craig Tiller | 7c70b6c | 2017-01-23 07:48:42 -0800 | [diff] [blame] | 344 | grpc_slice_unref(details); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 345 | grpc_metadata_array_destroy(&initial_metadata_recv); |
| 346 | grpc_metadata_array_destroy(&trailing_metadata_recv); |
| 347 | grpc_metadata_array_destroy(&request_metadata_recv); |
| 348 | grpc_call_details_destroy(&call_details); |
| 349 | |
| 350 | grpc_call_destroy(c); |
| 351 | grpc_call_destroy(s); |
| 352 | |
Craig Tiller | bc0ec33 | 2015-05-11 12:11:32 -0700 | [diff] [blame] | 353 | cq_verifier_destroy(cqv); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 354 | |
| 355 | grpc_byte_buffer_destroy(request_payload); |
| 356 | grpc_byte_buffer_destroy(response_payload); |
| 357 | grpc_byte_buffer_destroy(request_payload_recv); |
| 358 | grpc_byte_buffer_destroy(response_payload_recv); |
| 359 | |
| 360 | end_test(&f); |
| 361 | config.tear_down_data(&f); |
| 362 | } |
| 363 | |
Julien Boeuf | ea456fc | 2015-07-07 15:23:30 -0700 | [diff] [blame] | 364 | static void test_request_response_with_payload_and_call_creds( |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 365 | grpc_end2end_test_config config) { |
Craig Tiller | 9a57633 | 2015-06-17 10:21:49 -0700 | [diff] [blame] | 366 | request_response_with_payload_and_call_creds( |
| 367 | "test_request_response_with_payload_and_call_creds", config, NONE); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 368 | } |
| 369 | |
Julien Boeuf | ea456fc | 2015-07-07 15:23:30 -0700 | [diff] [blame] | 370 | static void test_request_response_with_payload_and_overridden_call_creds( |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 371 | grpc_end2end_test_config config) { |
Craig Tiller | 9a57633 | 2015-06-17 10:21:49 -0700 | [diff] [blame] | 372 | request_response_with_payload_and_call_creds( |
| 373 | "test_request_response_with_payload_and_overridden_call_creds", config, |
| 374 | OVERRIDE); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 375 | } |
| 376 | |
Julien Boeuf | ea456fc | 2015-07-07 15:23:30 -0700 | [diff] [blame] | 377 | static void test_request_response_with_payload_and_deleted_call_creds( |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 378 | grpc_end2end_test_config config) { |
Craig Tiller | 9a57633 | 2015-06-17 10:21:49 -0700 | [diff] [blame] | 379 | request_response_with_payload_and_call_creds( |
| 380 | "test_request_response_with_payload_and_deleted_call_creds", config, |
| 381 | DESTROY); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 382 | } |
| 383 | |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 384 | static void test_request_with_server_rejecting_client_creds( |
| 385 | grpc_end2end_test_config config) { |
| 386 | grpc_op ops[6]; |
| 387 | grpc_op *op; |
| 388 | grpc_call *c; |
| 389 | grpc_end2end_test_fixture f; |
Chris Evans | ed2a547 | 2017-03-27 17:34:51 -0500 | [diff] [blame] | 390 | gpr_timespec deadline = five_seconds_from_now(); |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 391 | cq_verifier *cqv; |
| 392 | grpc_metadata_array initial_metadata_recv; |
| 393 | grpc_metadata_array trailing_metadata_recv; |
| 394 | grpc_metadata_array request_metadata_recv; |
| 395 | grpc_call_details call_details; |
| 396 | grpc_status_code status; |
Nicolas "Pixel" Noble | 9d72b14 | 2015-08-08 01:45:38 +0200 | [diff] [blame] | 397 | grpc_call_error error; |
Craig Tiller | 7c70b6c | 2017-01-23 07:48:42 -0800 | [diff] [blame] | 398 | grpc_slice details; |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 399 | grpc_byte_buffer *response_payload_recv = NULL; |
Craig Tiller | 28b7242 | 2016-10-26 21:15:29 -0700 | [diff] [blame] | 400 | grpc_slice request_payload_slice = |
| 401 | grpc_slice_from_copied_string("hello world"); |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 402 | grpc_byte_buffer *request_payload = |
| 403 | grpc_raw_byte_buffer_create(&request_payload_slice, 1); |
Julien Boeuf | 4e02e84 | 2015-10-09 22:49:42 -0700 | [diff] [blame] | 404 | grpc_call_credentials *creds; |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 405 | |
| 406 | f = begin_test(config, "test_request_with_server_rejecting_client_creds", 1); |
| 407 | cqv = cq_verifier_create(f.cq); |
| 408 | |
Muxi Yan | 5ebd327 | 2016-10-31 07:27:07 -0700 | [diff] [blame] | 409 | c = grpc_channel_create_call( |
Craig Tiller | 7c70b6c | 2017-01-23 07:48:42 -0800 | [diff] [blame] | 410 | f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, |
| 411 | grpc_slice_from_static_string("/foo"), |
| 412 | get_host_override_slice("foo.test.google.fr:1234", config), deadline, |
Muxi Yan | 5ebd327 | 2016-10-31 07:27:07 -0700 | [diff] [blame] | 413 | NULL); |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 414 | GPR_ASSERT(c); |
| 415 | |
Julien Boeuf | 510a920 | 2015-08-25 21:51:07 -0700 | [diff] [blame] | 416 | creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 417 | GPR_ASSERT(creds != NULL); |
| 418 | GPR_ASSERT(grpc_call_set_credentials(c, creds) == GRPC_CALL_OK); |
Julien Boeuf | 4e02e84 | 2015-10-09 22:49:42 -0700 | [diff] [blame] | 419 | grpc_call_credentials_release(creds); |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 420 | |
| 421 | grpc_metadata_array_init(&initial_metadata_recv); |
| 422 | grpc_metadata_array_init(&trailing_metadata_recv); |
| 423 | grpc_metadata_array_init(&request_metadata_recv); |
| 424 | grpc_call_details_init(&call_details); |
| 425 | |
David Garcia Quintas | a301eaa | 2016-05-06 16:59:03 -0700 | [diff] [blame] | 426 | memset(ops, 0, sizeof(ops)); |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 427 | op = ops; |
| 428 | op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; |
| 429 | op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; |
| 430 | op->data.recv_status_on_client.status = &status; |
| 431 | op->data.recv_status_on_client.status_details = &details; |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 432 | op->flags = 0; |
Craig Tiller | 4275899 | 2015-08-18 10:34:32 -0700 | [diff] [blame] | 433 | op->reserved = NULL; |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 434 | op++; |
| 435 | op->op = GRPC_OP_SEND_INITIAL_METADATA; |
| 436 | op->data.send_initial_metadata.count = 0; |
| 437 | op->flags = 0; |
Craig Tiller | 4275899 | 2015-08-18 10:34:32 -0700 | [diff] [blame] | 438 | op->reserved = NULL; |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 439 | op++; |
| 440 | op->op = GRPC_OP_SEND_MESSAGE; |
Mark D. Roth | 435f9f2 | 2017-01-25 12:53:54 -0800 | [diff] [blame] | 441 | op->data.send_message.send_message = request_payload; |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 442 | op->flags = 0; |
Craig Tiller | 4275899 | 2015-08-18 10:34:32 -0700 | [diff] [blame] | 443 | op->reserved = NULL; |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 444 | op++; |
| 445 | op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; |
| 446 | op->flags = 0; |
Craig Tiller | 4275899 | 2015-08-18 10:34:32 -0700 | [diff] [blame] | 447 | op->reserved = NULL; |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 448 | op++; |
| 449 | op->op = GRPC_OP_RECV_INITIAL_METADATA; |
Mark D. Roth | 435f9f2 | 2017-01-25 12:53:54 -0800 | [diff] [blame] | 450 | op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 451 | op->flags = 0; |
Craig Tiller | 4275899 | 2015-08-18 10:34:32 -0700 | [diff] [blame] | 452 | op->reserved = NULL; |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 453 | op++; |
| 454 | op->op = GRPC_OP_RECV_MESSAGE; |
Mark D. Roth | 435f9f2 | 2017-01-25 12:53:54 -0800 | [diff] [blame] | 455 | op->data.recv_message.recv_message = &response_payload_recv; |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 456 | op->flags = 0; |
Craig Tiller | 4275899 | 2015-08-18 10:34:32 -0700 | [diff] [blame] | 457 | op->reserved = NULL; |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 458 | op++; |
Craig Tiller | 3121fd4 | 2015-09-10 09:56:20 -0700 | [diff] [blame] | 459 | error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); |
Nicolas "Pixel" Noble | 9d72b14 | 2015-08-08 01:45:38 +0200 | [diff] [blame] | 460 | GPR_ASSERT(error == GRPC_CALL_OK); |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 461 | |
Mark D. Roth | 7187ab9 | 2016-08-24 13:49:22 -0700 | [diff] [blame] | 462 | CQ_EXPECT_COMPLETION(cqv, tag(1), 1); |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 463 | cq_verify(cqv); |
| 464 | |
| 465 | GPR_ASSERT(status == GRPC_STATUS_UNAUTHENTICATED); |
| 466 | |
| 467 | grpc_metadata_array_destroy(&initial_metadata_recv); |
| 468 | grpc_metadata_array_destroy(&trailing_metadata_recv); |
| 469 | grpc_metadata_array_destroy(&request_metadata_recv); |
| 470 | grpc_call_details_destroy(&call_details); |
| 471 | |
| 472 | grpc_byte_buffer_destroy(request_payload); |
| 473 | grpc_byte_buffer_destroy(response_payload_recv); |
Craig Tiller | 7c70b6c | 2017-01-23 07:48:42 -0800 | [diff] [blame] | 474 | grpc_slice_unref(details); |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 475 | |
| 476 | grpc_call_destroy(c); |
| 477 | |
| 478 | cq_verifier_destroy(cqv); |
| 479 | end_test(&f); |
| 480 | config.tear_down_data(&f); |
| 481 | } |
| 482 | |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 483 | void call_creds(grpc_end2end_test_config config) { |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 484 | if (config.feature_mask & FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS) { |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 485 | test_request_response_with_payload_and_call_creds(config); |
| 486 | test_request_response_with_payload_and_overridden_call_creds(config); |
| 487 | test_request_response_with_payload_and_deleted_call_creds(config); |
Julien Boeuf | 77a7b87 | 2015-08-05 20:11:02 -0700 | [diff] [blame] | 488 | test_request_with_server_rejecting_client_creds(config); |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 489 | } |
| 490 | } |
Craig Tiller | 9e9edbc | 2016-04-04 10:38:49 -0700 | [diff] [blame] | 491 | |
| 492 | void call_creds_pre_init(void) {} |