Fixing tests.

pull/2947/head
Julien Boeuf 9 years ago
parent c5b570f97e
commit c17fecd224
  1. 2
      src/php/ext/grpc/channel.c
  2. 3
      test/core/end2end/fixtures/chttp2_fake_security.c
  3. 7
      test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c
  4. 7
      test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_poll.c
  5. 13
      test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_proxy.c
  6. 9
      test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c
  7. 6
      test/core/end2end/tests/request_response_with_payload_and_call_creds.c
  8. 4
      test/core/fling/server.c
  9. 42
      test/core/security/credentials_test.c
  10. 6
      test/core/security/fetch_oauth2.c

@ -169,7 +169,7 @@ PHP_METHOD(Channel, __construct) {
} else {
gpr_log(GPR_DEBUG, "Initialized secure channel");
channel->wrapped =
grpc_secure_channel_create(creds->wrapped, target, &args);
grpc_secure_channel_create(creds->wrapped, target, &args, NULL);
}
efree(args.args);
}

@ -77,7 +77,8 @@ static void chttp2_init_client_secure_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args,
grpc_credentials *creds) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
f->client = grpc_secure_channel_create(creds, ffd->localaddr, client_args);
f->client =
grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client != NULL);
grpc_credentials_release(creds);
}

@ -80,7 +80,8 @@ static void chttp2_init_client_secure_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args,
grpc_credentials *creds) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
f->client = grpc_secure_channel_create(creds, ffd->localaddr, client_args);
f->client =
grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client != NULL);
grpc_credentials_release(creds);
}
@ -108,7 +109,7 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) {
static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *client_args) {
grpc_credentials *ssl_creds = grpc_ssl_credentials_create(NULL, NULL);
grpc_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"}};
@ -135,7 +136,7 @@ static void chttp2_init_server_simple_ssl_secure_fullstack(
grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key,
test_server1_cert};
grpc_server_credentials *ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0);
grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0, NULL);
if (fail_server_auth_check(server_args)) {
grpc_auth_metadata_processor processor = {process_auth_failure, NULL};
grpc_server_credentials_set_auth_metadata_processor(ssl_creds, processor);

@ -80,7 +80,8 @@ static void chttp2_init_client_secure_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args,
grpc_credentials *creds) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
f->client = grpc_secure_channel_create(creds, ffd->localaddr, client_args);
f->client =
grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client != NULL);
grpc_credentials_release(creds);
}
@ -108,7 +109,7 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) {
static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *client_args) {
grpc_credentials *ssl_creds = grpc_ssl_credentials_create(NULL, NULL);
grpc_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"}};
@ -135,7 +136,7 @@ static void chttp2_init_server_simple_ssl_secure_fullstack(
grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key,
test_server1_cert};
grpc_server_credentials *ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0);
grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0, NULL);
if (fail_server_auth_check(server_args)) {
grpc_auth_metadata_processor processor = {process_auth_failure, NULL};
grpc_server_credentials_set_auth_metadata_processor(ssl_creds, processor);

@ -58,7 +58,7 @@ static grpc_server *create_proxy_server(const char *port) {
grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key,
test_server1_cert};
grpc_server_credentials *ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0);
grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(s, port, ssl_creds));
grpc_server_credentials_release(ssl_creds);
return s;
@ -66,14 +66,14 @@ static grpc_server *create_proxy_server(const char *port) {
static grpc_channel *create_proxy_client(const char *target) {
grpc_channel *channel;
grpc_credentials *ssl_creds = grpc_ssl_credentials_create(NULL, NULL);
grpc_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);
channel = grpc_secure_channel_create(ssl_creds, target, &client_args, NULL);
grpc_credentials_release(ssl_creds);
return channel;
}
@ -109,7 +109,8 @@ static void chttp2_init_client_secure_fullstack(grpc_end2end_test_fixture *f,
grpc_credentials *creds) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
f->client = grpc_secure_channel_create(
creds, grpc_end2end_proxy_get_client_target(ffd->proxy), client_args);
creds, grpc_end2end_proxy_get_client_target(ffd->proxy), client_args,
NULL);
GPR_ASSERT(f->client != NULL);
grpc_credentials_release(creds);
}
@ -137,7 +138,7 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) {
static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *client_args) {
grpc_credentials *ssl_creds = grpc_ssl_credentials_create(NULL, NULL);
grpc_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"}};
@ -164,7 +165,7 @@ static void chttp2_init_server_simple_ssl_secure_fullstack(
grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key,
test_server1_cert};
grpc_server_credentials *ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0);
grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0, NULL);
if (fail_server_auth_check(server_args)) {
grpc_auth_metadata_processor processor = {process_auth_failure, NULL};
grpc_server_credentials_set_auth_metadata_processor(ssl_creds, processor);

@ -113,7 +113,8 @@ static void chttp2_init_client_secure_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args,
grpc_credentials *creds) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
f->client = grpc_secure_channel_create(creds, ffd->localaddr, client_args);
f->client =
grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client != NULL);
grpc_credentials_release(creds);
}
@ -142,11 +143,11 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) {
static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *client_args) {
grpc_credentials *ssl_creds =
grpc_ssl_credentials_create(test_root_cert, NULL);
grpc_ssl_credentials_create(test_root_cert, NULL, NULL);
grpc_credentials *oauth2_creds =
grpc_md_only_test_credentials_create("Authorization", oauth2_md, 1);
grpc_credentials *ssl_oauth2_creds =
grpc_composite_credentials_create(ssl_creds, oauth2_creds);
grpc_composite_credentials_create(ssl_creds, oauth2_creds, NULL);
grpc_arg ssl_name_override = {GRPC_ARG_STRING,
GRPC_SSL_TARGET_NAME_OVERRIDE_ARG,
{"foo.test.google.fr"}};
@ -175,7 +176,7 @@ static void chttp2_init_server_simple_ssl_secure_fullstack(
grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key,
test_server1_cert};
grpc_server_credentials *ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1, 0);
grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1, 0, NULL);
grpc_auth_metadata_processor processor;
processor.state = NULL;
if (fail_server_auth_check(server_args)) {

@ -190,7 +190,7 @@ static void request_response_with_payload_and_call_creds(
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
"/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
creds = grpc_iam_credentials_create(iam_token, iam_selector);
creds = grpc_iam_credentials_create(iam_token, iam_selector, NULL);
GPR_ASSERT(creds != NULL);
GPR_ASSERT(grpc_call_set_credentials(c, creds) == GRPC_CALL_OK);
switch (mode) {
@ -199,7 +199,7 @@ static void request_response_with_payload_and_call_creds(
case OVERRIDE:
grpc_credentials_release(creds);
creds = grpc_iam_credentials_create(overridden_iam_token,
overridden_iam_selector);
overridden_iam_selector, NULL);
GPR_ASSERT(creds != NULL);
GPR_ASSERT(grpc_call_set_credentials(c, creds) == GRPC_CALL_OK);
break;
@ -421,7 +421,7 @@ static void test_request_with_server_rejecting_client_creds(
"/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
creds = grpc_iam_credentials_create(iam_token, iam_selector);
creds = grpc_iam_credentials_create(iam_token, iam_selector, NULL);
GPR_ASSERT(creds != NULL);
GPR_ASSERT(grpc_call_set_credentials(c, creds) == GRPC_CALL_OK);
grpc_credentials_release(creds);

@ -215,8 +215,8 @@ int main(int argc, char **argv) {
if (secure) {
grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key,
test_server1_cert};
grpc_server_credentials *ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1, 0);
grpc_server_credentials *ssl_creds = grpc_ssl_server_credentials_create(
NULL, &pem_key_cert_pair, 1, 0, NULL);
server = grpc_server_create(NULL, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds));
grpc_server_credentials_release(ssl_creds);

@ -329,7 +329,7 @@ static void check_iam_metadata(void *user_data, grpc_credentials_md *md_elems,
static void test_iam_creds(void) {
grpc_credentials *creds = grpc_iam_credentials_create(
test_iam_authorization_token, test_iam_authority_selector);
test_iam_authorization_token, test_iam_authority_selector, NULL);
GPR_ASSERT(grpc_credentials_has_request_metadata(creds));
GPR_ASSERT(grpc_credentials_has_request_metadata_only(creds));
grpc_credentials_get_request_metadata(creds, NULL, test_service_url,
@ -349,7 +349,7 @@ static void check_access_token_metadata(void *user_data,
}
static void test_access_token_creds(void) {
grpc_credentials *creds = grpc_access_token_credentials_create("blah");
grpc_credentials *creds = grpc_access_token_credentials_create("blah", NULL);
GPR_ASSERT(grpc_credentials_has_request_metadata(creds));
GPR_ASSERT(grpc_credentials_has_request_metadata_only(creds));
GPR_ASSERT(strcmp(creds->type, GRPC_CREDENTIALS_TYPE_OAUTH2) == 0);
@ -371,12 +371,12 @@ static void check_ssl_oauth2_composite_metadata(
static void test_ssl_oauth2_composite_creds(void) {
grpc_credentials *ssl_creds =
grpc_ssl_credentials_create(test_root_cert, NULL);
grpc_ssl_credentials_create(test_root_cert, NULL, NULL);
const grpc_credentials_array *creds_array;
grpc_credentials *oauth2_creds = grpc_md_only_test_credentials_create(
"Authorization", test_oauth2_bearer_token, 0);
grpc_credentials *composite_creds =
grpc_composite_credentials_create(ssl_creds, oauth2_creds);
grpc_composite_credentials_create(ssl_creds, oauth2_creds, NULL);
grpc_credentials_unref(ssl_creds);
grpc_credentials_unref(oauth2_creds);
GPR_ASSERT(strcmp(composite_creds->type, GRPC_CREDENTIALS_TYPE_COMPOSITE) ==
@ -395,13 +395,13 @@ static void test_ssl_oauth2_composite_creds(void) {
}
void test_ssl_fake_transport_security_composite_creds_failure(void) {
grpc_credentials *ssl_creds = grpc_ssl_credentials_create(NULL, NULL);
grpc_credentials *ssl_creds = grpc_ssl_credentials_create(NULL, NULL, NULL);
grpc_credentials *fake_transport_security_creds =
grpc_fake_transport_security_credentials_create();
/* 2 connector credentials: should not work. */
GPR_ASSERT(grpc_composite_credentials_create(
ssl_creds, fake_transport_security_creds) == NULL);
ssl_creds, fake_transport_security_creds, NULL) == NULL);
grpc_credentials_unref(ssl_creds);
grpc_credentials_unref(fake_transport_security_creds);
}
@ -422,16 +422,16 @@ static void check_ssl_oauth2_iam_composite_metadata(
static void test_ssl_oauth2_iam_composite_creds(void) {
grpc_credentials *ssl_creds =
grpc_ssl_credentials_create(test_root_cert, NULL);
grpc_ssl_credentials_create(test_root_cert, NULL, NULL);
const grpc_credentials_array *creds_array;
grpc_credentials *oauth2_creds = grpc_md_only_test_credentials_create(
"Authorization", test_oauth2_bearer_token, 0);
grpc_credentials *aux_creds =
grpc_composite_credentials_create(ssl_creds, oauth2_creds);
grpc_composite_credentials_create(ssl_creds, oauth2_creds, NULL);
grpc_credentials *iam_creds = grpc_iam_credentials_create(
test_iam_authorization_token, test_iam_authority_selector);
test_iam_authorization_token, test_iam_authority_selector, NULL);
grpc_credentials *composite_creds =
grpc_composite_credentials_create(aux_creds, iam_creds);
grpc_composite_credentials_create(aux_creds, iam_creds, NULL);
grpc_credentials_unref(ssl_creds);
grpc_credentials_unref(oauth2_creds);
grpc_credentials_unref(aux_creds);
@ -524,7 +524,7 @@ static int httpcli_get_should_not_be_called(
static void test_compute_engine_creds_success(void) {
grpc_credentials *compute_engine_creds =
grpc_compute_engine_credentials_create();
grpc_compute_engine_credentials_create(NULL);
GPR_ASSERT(grpc_credentials_has_request_metadata(compute_engine_creds));
GPR_ASSERT(grpc_credentials_has_request_metadata_only(compute_engine_creds));
@ -548,7 +548,7 @@ static void test_compute_engine_creds_success(void) {
static void test_compute_engine_creds_failure(void) {
grpc_credentials *compute_engine_creds =
grpc_compute_engine_credentials_create();
grpc_compute_engine_credentials_create(NULL);
grpc_httpcli_set_override(compute_engine_httpcli_get_failure_override,
httpcli_post_should_not_be_called);
GPR_ASSERT(grpc_credentials_has_request_metadata(compute_engine_creds));
@ -605,7 +605,7 @@ static int refresh_token_httpcli_post_failure(
static void test_refresh_token_creds_success(void) {
grpc_credentials *refresh_token_creds =
grpc_refresh_token_credentials_create(test_refresh_token_str);
grpc_refresh_token_credentials_create(test_refresh_token_str, NULL);
GPR_ASSERT(grpc_credentials_has_request_metadata(refresh_token_creds));
GPR_ASSERT(grpc_credentials_has_request_metadata_only(refresh_token_creds));
@ -629,7 +629,7 @@ static void test_refresh_token_creds_success(void) {
static void test_refresh_token_creds_failure(void) {
grpc_credentials *refresh_token_creds =
grpc_refresh_token_credentials_create(test_refresh_token_str);
grpc_refresh_token_credentials_create(test_refresh_token_str, NULL);
grpc_httpcli_set_override(httpcli_get_should_not_be_called,
refresh_token_httpcli_post_failure);
GPR_ASSERT(grpc_credentials_has_request_metadata(refresh_token_creds));
@ -731,7 +731,7 @@ static void test_service_account_creds_success(void) {
char *json_key_string = test_json_key_str();
grpc_credentials *service_account_creds =
grpc_service_account_credentials_create(json_key_string, test_scope,
grpc_max_auth_token_lifetime);
grpc_max_auth_token_lifetime, NULL);
GPR_ASSERT(grpc_credentials_has_request_metadata(service_account_creds));
GPR_ASSERT(grpc_credentials_has_request_metadata_only(service_account_creds));
@ -761,8 +761,8 @@ static void test_service_account_creds_success(void) {
static void test_service_account_creds_http_failure(void) {
char *json_key_string = test_json_key_str();
grpc_credentials *service_account_creds =
grpc_service_account_credentials_create(json_key_string, test_scope,
grpc_max_auth_token_lifetime);
grpc_service_account_credentials_create(
json_key_string, test_scope, grpc_max_auth_token_lifetime, NULL);
GPR_ASSERT(grpc_credentials_has_request_metadata(service_account_creds));
GPR_ASSERT(grpc_credentials_has_request_metadata_only(service_account_creds));
@ -781,8 +781,8 @@ static void test_service_account_creds_http_failure(void) {
static void test_service_account_creds_signing_failure(void) {
char *json_key_string = test_json_key_str();
grpc_credentials *service_account_creds =
grpc_service_account_credentials_create(json_key_string, test_scope,
grpc_max_auth_token_lifetime);
grpc_service_account_credentials_create(
json_key_string, test_scope, grpc_max_auth_token_lifetime, NULL);
GPR_ASSERT(grpc_credentials_has_request_metadata(service_account_creds));
GPR_ASSERT(grpc_credentials_has_request_metadata_only(service_account_creds));
@ -828,7 +828,7 @@ static void test_jwt_creds_success(void) {
char *json_key_string = test_json_key_str();
grpc_credentials *jwt_creds =
grpc_service_account_jwt_access_credentials_create(
json_key_string, grpc_max_auth_token_lifetime);
json_key_string, grpc_max_auth_token_lifetime, NULL);
GPR_ASSERT(grpc_credentials_has_request_metadata(jwt_creds));
GPR_ASSERT(grpc_credentials_has_request_metadata_only(jwt_creds));
@ -861,7 +861,7 @@ static void test_jwt_creds_signing_failure(void) {
char *json_key_string = test_json_key_str();
grpc_credentials *jwt_creds =
grpc_service_account_jwt_access_credentials_create(
json_key_string, grpc_max_auth_token_lifetime);
json_key_string, grpc_max_auth_token_lifetime, NULL);
GPR_ASSERT(grpc_credentials_has_request_metadata(jwt_creds));
GPR_ASSERT(grpc_credentials_has_request_metadata_only(jwt_creds));

@ -56,7 +56,7 @@ static grpc_credentials *create_service_account_creds(
}
return grpc_service_account_credentials_create(
(const char *)GPR_SLICE_START_PTR(json_key), scope,
grpc_max_auth_token_lifetime);
grpc_max_auth_token_lifetime, NULL);
}
static grpc_credentials *create_refresh_token_creds(
@ -69,7 +69,7 @@ static grpc_credentials *create_refresh_token_creds(
exit(1);
}
return grpc_refresh_token_credentials_create(
(const char *)GPR_SLICE_START_PTR(refresh_token));
(const char *)GPR_SLICE_START_PTR(refresh_token), NULL);
}
int main(int argc, char **argv) {
@ -112,7 +112,7 @@ int main(int argc, char **argv) {
"Ignoring json key and scope to get a token from the GCE "
"metadata server.");
}
creds = grpc_compute_engine_credentials_create();
creds = grpc_compute_engine_credentials_create(NULL);
if (creds == NULL) {
gpr_log(GPR_ERROR, "Could not create gce credentials.");
exit(1);

Loading…
Cancel
Save