diff options
author | Craig Tiller <ctiller@google.com> | 2016-05-24 07:34:49 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-05-24 07:34:49 -0700 |
commit | e2c1040f9c52d0fea341f390bce860ae2e3c85cc (patch) | |
tree | fb2cf032f1ea73f3ef75176b8e0b1b5a94d1efb5 /test/core/end2end/fixtures | |
parent | 63d11752b7017d7fd677435d3e92a1a88d768aac (diff) | |
parent | d7bbd38b27630f908fc4f1cb906607e44c8f30bb (diff) |
Merge github.com:grpc/grpc into atm2
Diffstat (limited to 'test/core/end2end/fixtures')
-rw-r--r-- | test/core/end2end/fixtures/h2_census.c | 2 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_fakesec.c | 2 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_oauth2.c | 2 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_proxy.c | 12 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_sockpair+trace.c | 5 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_sockpair.c | 5 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_sockpair_1byte.c | 5 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_ssl.c | 2 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_ssl_cert.c | 20 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_ssl_proxy.c | 21 | ||||
-rw-r--r-- | test/core/end2end/fixtures/proxy.c | 11 | ||||
-rw-r--r-- | test/core/end2end/fixtures/proxy.h | 11 |
12 files changed, 59 insertions, 39 deletions
diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c index ff2f028f09..e46b39e476 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.c @@ -111,7 +111,7 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, + {"chttp2/fullstack+census", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_fakesec.c b/test/core/end2end/fixtures/h2_fakesec.c index 246619bf68..44408b28af 100644 --- a/test/core/end2end/fixtures/h2_fakesec.c +++ b/test/core/end2end/fixtures/h2_fakesec.c @@ -40,7 +40,7 @@ #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/fake/fake_credentials.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_oauth2.c b/test/core/end2end/fixtures/h2_oauth2.c index 550ff33140..fc56998cdb 100644 --- a/test/core/end2end/fixtures/h2_oauth2.c +++ b/test/core/end2end/fixtures/h2_oauth2.c @@ -41,7 +41,7 @@ #include <grpc/support/log.h> #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/iomgr.h" -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c index 863673a4e0..8c50eeb5d5 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.c @@ -55,14 +55,16 @@ typedef struct fullstack_fixture_data { grpc_end2end_proxy *proxy; } fullstack_fixture_data; -static grpc_server *create_proxy_server(const char *port) { - grpc_server *s = grpc_server_create(NULL, NULL); +static grpc_server *create_proxy_server(const char *port, + grpc_channel_args *server_args) { + grpc_server *s = grpc_server_create(server_args, NULL); GPR_ASSERT(grpc_server_add_insecure_http2_port(s, port)); return s; } -static grpc_channel *create_proxy_client(const char *target) { - return grpc_insecure_channel_create(target, NULL, NULL); +static grpc_channel *create_proxy_client(const char *target, + grpc_channel_args *client_args) { + return grpc_insecure_channel_create(target, client_args, NULL); } static const grpc_end2end_proxy_def proxy_def = {create_proxy_server, @@ -74,7 +76,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data)); memset(&f, 0, sizeof(f)); - ffd->proxy = grpc_end2end_proxy_create(&proxy_def); + ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args); f.fixture_data = ffd; f.cq = grpc_completion_queue_create(NULL); diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index 87533a9b7f..6b0769b608 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -50,6 +50,7 @@ #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/support/env.h" #include "src/core/lib/surface/channel.h" +#include "src/core/lib/surface/completion_queue.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -60,7 +61,9 @@ static void server_setup_transport(void *ts, grpc_transport *transport) { grpc_end2end_test_fixture *f = ts; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_server_setup_transport(&exec_ctx, f->server, transport, + grpc_endpoint_pair *sfd = f->fixture_data; + grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq)); + grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL, grpc_server_get_channel_args(f->server)); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index f28147cf40..7be88f8a68 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -49,6 +49,7 @@ #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/surface/channel.h" +#include "src/core/lib/surface/completion_queue.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -59,7 +60,9 @@ static void server_setup_transport(void *ts, grpc_transport *transport) { grpc_end2end_test_fixture *f = ts; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_server_setup_transport(&exec_ctx, f->server, transport, + grpc_endpoint_pair *sfd = f->fixture_data; + grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq)); + grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL, grpc_server_get_channel_args(f->server)); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index 302b16b372..166654bcbf 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -49,6 +49,7 @@ #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/surface/channel.h" +#include "src/core/lib/surface/completion_queue.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -59,7 +60,9 @@ static void server_setup_transport(void *ts, grpc_transport *transport) { grpc_end2end_test_fixture *f = ts; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_server_setup_transport(&exec_ctx, f->server, transport, + grpc_endpoint_pair *sfd = f->fixture_data; + grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq)); + grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL, grpc_server_get_channel_args(f->server)); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/end2end/fixtures/h2_ssl.c b/test/core/end2end/fixtures/h2_ssl.c index 69f7616074..eb28623264 100644 --- a/test/core/end2end/fixtures/h2_ssl.c +++ b/test/core/end2end/fixtures/h2_ssl.c @@ -41,7 +41,7 @@ #include <grpc/support/log.h> #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/support/env.h" #include "src/core/lib/support/string.h" #include "src/core/lib/support/tmpfile.h" diff --git a/test/core/end2end/fixtures/h2_ssl_cert.c b/test/core/end2end/fixtures/h2_ssl_cert.c index cd031ca482..0fa525175b 100644 --- a/test/core/end2end/fixtures/h2_ssl_cert.c +++ b/test/core/end2end/fixtures/h2_ssl_cert.c @@ -41,7 +41,7 @@ #include <grpc/support/log.h> #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/support/env.h" #include "src/core/lib/support/string.h" #include "src/core/lib/support/tmpfile.h" @@ -143,11 +143,11 @@ static int fail_server_auth_check(grpc_channel_args *server_args) { chttp2_init_server_secure_fullstack(f, server_args, ssl_creds); \ } -SERVER_INIT(GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE); -SERVER_INIT(GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY); -SERVER_INIT(GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY); -SERVER_INIT(GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY); -SERVER_INIT(GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY); +SERVER_INIT(GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE) +SERVER_INIT(GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY) +SERVER_INIT(GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY) +SERVER_INIT(GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY) +SERVER_INIT(GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY) #define CLIENT_INIT_NAME(cert_type) \ chttp2_init_client_simple_ssl_secure_fullstack_##cert_type @@ -189,10 +189,10 @@ typedef enum { NONE, SELF_SIGNED, SIGNED, BAD_CERT_PAIR } certtype; grpc_channel_args_destroy(new_client_args); \ } -CLIENT_INIT(NONE); -CLIENT_INIT(SELF_SIGNED); -CLIENT_INIT(SIGNED); -CLIENT_INIT(BAD_CERT_PAIR); +CLIENT_INIT(NONE) +CLIENT_INIT(SELF_SIGNED) +CLIENT_INIT(SIGNED) +CLIENT_INIT(BAD_CERT_PAIR) #define TEST_NAME(enum_name, cert_type, result) \ "chttp2/ssl_" #enum_name "_" #cert_type "_" #result "_" diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.c b/test/core/end2end/fixtures/h2_ssl_proxy.c index 1403b760f5..238e6bca46 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.c +++ b/test/core/end2end/fixtures/h2_ssl_proxy.c @@ -41,7 +41,7 @@ #include <grpc/support/log.h> #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/support/env.h" #include "src/core/lib/support/string.h" #include "src/core/lib/support/tmpfile.h" @@ -54,8 +54,9 @@ typedef struct fullstack_secure_fixture_data { grpc_end2end_proxy *proxy; } fullstack_secure_fixture_data; -static grpc_server *create_proxy_server(const char *port) { - grpc_server *s = grpc_server_create(NULL, NULL); +static grpc_server *create_proxy_server(const char *port, + grpc_channel_args *server_args) { + grpc_server *s = grpc_server_create(server_args, NULL); grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key, test_server1_cert}; grpc_server_credentials *ssl_creds = @@ -65,18 +66,20 @@ static grpc_server *create_proxy_server(const char *port) { return s; } -static grpc_channel *create_proxy_client(const char *target) { +static grpc_channel *create_proxy_client(const char *target, + grpc_channel_args *client_args) { grpc_channel *channel; grpc_channel_credentials *ssl_creds = grpc_ssl_credentials_create(NULL, NULL, NULL); grpc_arg ssl_name_override = {GRPC_ARG_STRING, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, {"foo.test.google.fr"}}; - grpc_channel_args client_args; - client_args.num_args = 1; - client_args.args = &ssl_name_override; - channel = grpc_secure_channel_create(ssl_creds, target, &client_args, NULL); + grpc_channel_args *new_client_args = + grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1); + channel = + grpc_secure_channel_create(ssl_creds, target, new_client_args, NULL); grpc_channel_credentials_release(ssl_creds); + grpc_channel_args_destroy(new_client_args); return channel; } @@ -90,7 +93,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_malloc(sizeof(fullstack_secure_fixture_data)); memset(&f, 0, sizeof(f)); - ffd->proxy = grpc_end2end_proxy_create(&proxy_def); + ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args); f.fixture_data = ffd; f.cq = grpc_completion_queue_create(NULL); diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index a6487a17ac..7f10649fa6 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -89,8 +89,9 @@ typedef struct { static void thread_main(void *arg); static void request_call(grpc_end2end_proxy *proxy); -grpc_end2end_proxy *grpc_end2end_proxy_create( - const grpc_end2end_proxy_def *def) { +grpc_end2end_proxy *grpc_end2end_proxy_create(const grpc_end2end_proxy_def *def, + grpc_channel_args *client_args, + grpc_channel_args *server_args) { gpr_thd_options opt = gpr_thd_options_default(); int proxy_port = grpc_pick_unused_port_or_die(); int server_port = grpc_pick_unused_port_or_die(); @@ -105,8 +106,8 @@ grpc_end2end_proxy *grpc_end2end_proxy_create( proxy->server_port); proxy->cq = grpc_completion_queue_create(NULL); - proxy->server = def->create_server(proxy->proxy_port); - proxy->client = def->create_client(proxy->server_port); + proxy->server = def->create_server(proxy->proxy_port, server_args); + proxy->client = def->create_client(proxy->server_port, client_args); grpc_server_register_completion_queue(proxy->server, proxy->cq, NULL); grpc_server_start(proxy->server); @@ -281,6 +282,8 @@ static void on_p2s_recv_msg(void *arg, int success) { err = grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_sent_message, pc), NULL); GPR_ASSERT(err == GRPC_CALL_OK); + } else { + grpc_byte_buffer_destroy(pc->p2s_msg); } unrefpc(pc, "on_p2s_recv_msg"); } diff --git a/test/core/end2end/fixtures/proxy.h b/test/core/end2end/fixtures/proxy.h index c1cf01d39a..75b75d1331 100644 --- a/test/core/end2end/fixtures/proxy.h +++ b/test/core/end2end/fixtures/proxy.h @@ -41,12 +41,15 @@ typedef struct grpc_end2end_proxy grpc_end2end_proxy; typedef struct grpc_end2end_proxy_def { - grpc_server *(*create_server)(const char *port); - grpc_channel *(*create_client)(const char *target); + grpc_server *(*create_server)(const char *port, + grpc_channel_args *server_args); + grpc_channel *(*create_client)(const char *target, + grpc_channel_args *client_args); } grpc_end2end_proxy_def; -grpc_end2end_proxy *grpc_end2end_proxy_create( - const grpc_end2end_proxy_def *def); +grpc_end2end_proxy *grpc_end2end_proxy_create(const grpc_end2end_proxy_def *def, + grpc_channel_args *client_args, + grpc_channel_args *server_args); void grpc_end2end_proxy_destroy(grpc_end2end_proxy *proxy); const char *grpc_end2end_proxy_get_client_target(grpc_end2end_proxy *proxy); |