本文整理汇总了C++中grpc_end2end_test_config类的典型用法代码示例。如果您正苦于以下问题:C++ grpc_end2end_test_config类的具体用法?C++ grpc_end2end_test_config怎么用?C++ grpc_end2end_test_config使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了grpc_end2end_test_config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: begin_test
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char *test_name,
grpc_channel_args *client_args,
grpc_channel_args *server_args) {
grpc_end2end_test_fixture f;
gpr_log(GPR_INFO, "%s/%s", test_name, config.name);
f = config.create_fixture(client_args, server_args);
config.init_server(&f, server_args);
config.init_client(&f, client_args);
return f;
}
示例2: begin_test
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char *test_name,
grpc_channel_args *client_args,
grpc_channel_args *server_args,
bool request_status_early) {
grpc_end2end_test_fixture f;
gpr_log(GPR_INFO, "%s/%s/request_status_early=%s", test_name, config.name,
request_status_early ? "true" : "false");
f = config.create_fixture(client_args, server_args);
config.init_server(&f, server_args);
config.init_client(&f, client_args);
return f;
}
示例3: begin_test
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char *test_name,
grpc_channel_args *client_args,
grpc_channel_args *server_args) {
grpc_end2end_test_fixture f;
gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name);
// We intentionally do not pass the client and server args to
// create_fixture(), since we don't want the limit enforced on the
// proxy, only on the backend server.
f = config.create_fixture(NULL, NULL);
config.init_server(&f, server_args);
config.init_client(&f, client_args);
return f;
}
示例4: test_ping
static void test_ping(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_connectivity_state state = GRPC_CHANNEL_IDLE;
int i;
config.init_client(&f, NULL, NULL);
config.init_server(&f, NULL);
grpc_channel_ping(f.client, f.cq, tag(0), NULL);
CQ_EXPECT_COMPLETION(cqv, tag(0), 0);
/* check that we're still in idle, and start connecting */
GPR_ASSERT(grpc_channel_check_connectivity_state(f.client, 1) ==
GRPC_CHANNEL_IDLE);
/* we'll go through some set of transitions (some might be missed), until
READY is reached */
while (state != GRPC_CHANNEL_READY) {
grpc_channel_watch_connectivity_state(
f.client, state, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3), f.cq, tag(99));
CQ_EXPECT_COMPLETION(cqv, tag(99), 1);
cq_verify(cqv);
state = grpc_channel_check_connectivity_state(f.client, 0);
GPR_ASSERT(state == GRPC_CHANNEL_READY ||
state == GRPC_CHANNEL_CONNECTING ||
state == GRPC_CHANNEL_TRANSIENT_FAILURE);
}
for (i = 1; i <= 5; i++) {
grpc_channel_ping(f.client, f.cq, tag(i), NULL);
CQ_EXPECT_COMPLETION(cqv, tag(i), 1);
cq_verify(cqv);
}
grpc_server_shutdown_and_notify(f.server, f.cq, tag(0xdead));
CQ_EXPECT_COMPLETION(cqv, tag(0xdead), 1);
cq_verify(cqv);
/* cleanup server */
grpc_server_destroy(f.server);
grpc_channel_destroy(f.client);
grpc_completion_queue_shutdown(f.cq);
grpc_completion_queue_destroy(f.cq);
config.tear_down_data(&f);
cq_verifier_destroy(cqv);
}
示例5: test_max_age_forcibly_close
static void test_max_age_forcibly_close(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_arg server_a[] = {{.type = GRPC_ARG_INTEGER,
.key = GRPC_ARG_MAX_CONNECTION_AGE_MS,
.value.integer = MAX_CONNECTION_AGE_MS},
{.type = GRPC_ARG_INTEGER,
示例6: test_invoke_request_response_with_payload
/* Client sends a request with payload, server reads then returns a response
payload and status. */
static void test_invoke_request_response_with_payload(
grpc_end2end_test_config config) {
grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL);
request_response_with_payload(f);
end_test(&f);
config.tear_down_data(&f);
}
示例7: test_size
static void test_size(grpc_end2end_test_config config, int encode_size,
int decode_size) {
size_t i;
grpc_end2end_test_fixture f;
grpc_arg server_arg;
grpc_channel_args server_args;
grpc_arg client_arg;
grpc_channel_args client_args;
char *name;
server_arg.type = GRPC_ARG_INTEGER;
server_arg.key = GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER;
server_arg.value.integer = decode_size;
server_args.num_args = 1;
server_args.args = &server_arg;
client_arg.type = GRPC_ARG_INTEGER;
client_arg.key = GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER;
client_arg.value.integer = encode_size;
client_args.num_args = 1;
client_args.args = &client_arg;
gpr_asprintf(&name, "test_size:e=%d:d=%d", encode_size, decode_size);
f = begin_test(config, name, encode_size != 4096 ? &client_args : NULL,
decode_size != 4096 ? &server_args : NULL);
for (i = 0; i < 4 * GPR_ARRAY_SIZE(hobbits); i++) {
simple_request_body(config, f, i);
}
end_test(&f);
config.tear_down_data(&f);
gpr_free(name);
}
示例8: test_early_server_shutdown_finishes_tags
static void test_early_server_shutdown_finishes_tags(
grpc_end2end_test_config config) {
grpc_end2end_test_fixture f = begin_test(
config, "test_early_server_shutdown_finishes_tags", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_call *s = (void *)1;
grpc_call_details call_details;
grpc_metadata_array request_metadata_recv;
grpc_metadata_array_init(&request_metadata_recv);
grpc_call_details_init(&call_details);
/* upon shutdown, the server should finish all requested calls indicating
no new call */
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
f.server, &s, &call_details,
&request_metadata_recv, f.cq, f.cq, tag(101)));
grpc_server_shutdown_and_notify(f.server, f.cq, tag(1000));
CQ_EXPECT_COMPLETION(cqv, tag(101), 0);
CQ_EXPECT_COMPLETION(cqv, tag(1000), 1);
cq_verify(cqv);
GPR_ASSERT(s == NULL);
grpc_server_destroy(f.server);
end_test(&f);
config.tear_down_data(&f);
cq_verifier_destroy(cqv);
}
示例9: test_invoke_request_with_census
static void test_invoke_request_with_census(
grpc_end2end_test_config config, const char *name,
void (*body)(grpc_end2end_test_fixture f)) {
char *fullname;
grpc_end2end_test_fixture f;
grpc_arg client_arg, server_arg;
grpc_channel_args client_args, server_args;
client_arg.type = GRPC_ARG_INTEGER;
client_arg.key = GRPC_ARG_ENABLE_CENSUS;
client_arg.value.integer = 1;
client_args.num_args = 1;
client_args.args = &client_arg;
server_arg.type = GRPC_ARG_INTEGER;
server_arg.key = GRPC_ARG_ENABLE_CENSUS;
server_arg.value.integer = 1;
server_args.num_args = 1;
server_args.args = &server_arg;
gpr_asprintf(&fullname, "%s/%s", "test_invoke_request_with_census", name);
f = begin_test(config, fullname, &client_args, &server_args);
body(f);
end_test(&f);
config.tear_down_data(&f);
gpr_free(fullname);
}
示例10: test_invoke_10_simple_requests
static void test_invoke_10_simple_requests(grpc_end2end_test_config config,
int initial_sequence_number) {
int i;
grpc_end2end_test_fixture f;
grpc_arg client_arg;
grpc_channel_args client_args;
char *name;
client_arg.type = GRPC_ARG_INTEGER;
client_arg.key = GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER;
client_arg.value.integer = initial_sequence_number;
client_args.num_args = 1;
client_args.args = &client_arg;
gpr_asprintf(&name, "test_invoke_requests first_seqno=%d",
initial_sequence_number);
f = begin_test(config, name, &client_args, NULL);
for (i = 0; i < 10; i++) {
simple_request_body(f);
gpr_log(GPR_INFO, "Passed simple request %d", i);
}
end_test(&f);
config.tear_down_data(&f);
gpr_free(name);
}
示例11: test_invoke_simple_request
static void test_invoke_simple_request(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f;
f = begin_test(config, "test_invoke_simple_request", NULL, NULL);
simple_request_body(f);
end_test(&f);
config.tear_down_data(&f);
}
示例12: test_invoke_empty_body
static void test_invoke_empty_body(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f;
f = begin_test(config, "test_invoke_empty_body", NULL, NULL);
empty_batch_body(f);
end_test(&f);
config.tear_down_data(&f);
}
示例13: test_invoke_simple_request
static void test_invoke_simple_request(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f =
begin_test(config, "test_invoke_simple_request", NULL, NULL);
void *rc = grpc_channel_register_call(f.client, "/foo",
"foo.test.google.fr:1234", NULL);
simple_request_body(f, rc);
end_test(&f);
config.tear_down_data(&f);
}
示例14: begin_test
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char *test_name,
int fail_server_auth_check) {
grpc_end2end_test_fixture f;
gpr_log(GPR_INFO, "%s/%s", test_name, config.name);
f = config.create_fixture(NULL, NULL);
config.init_client(&f, NULL);
if (fail_server_auth_check) {
grpc_arg fail_auth_arg = {
GRPC_ARG_STRING, FAIL_AUTH_CHECK_SERVER_ARG_NAME, {NULL}};
grpc_channel_args args;
args.num_args= 1;
args.args = &fail_auth_arg;
config.init_server(&f, &args);
} else {
config.init_server(&f, NULL);
}
return f;
}
示例15: test_invoke_10_request_response_with_payload
static void test_invoke_10_request_response_with_payload(
grpc_end2end_test_config config) {
int i;
grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL);
for (i = 0; i < 10; i++) {
request_response_with_payload(f);
}
end_test(&f);
config.tear_down_data(&f);
}