aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/security
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/security')
-rw-r--r--test/core/security/create_jwt.c11
-rw-r--r--test/core/security/credentials_test.c76
-rw-r--r--test/core/security/fetch_oauth2.c13
-rw-r--r--test/core/security/jwt_verifier_test.c74
-rw-r--r--test/core/security/oauth2_utils.c18
-rw-r--r--test/core/security/print_google_default_creds_token.c14
-rw-r--r--test/core/security/secure_endpoint_test.c6
-rw-r--r--test/core/security/verify_jwt.c11
8 files changed, 117 insertions, 106 deletions
diff --git a/test/core/security/create_jwt.c b/test/core/security/create_jwt.c
index 3c36b767d3..1bd135f175 100644
--- a/test/core/security/create_jwt.c
+++ b/test/core/security/create_jwt.c
@@ -34,8 +34,8 @@
#include <stdio.h>
#include <string.h>
+#include "src/core/lib/iomgr/load_file.h"
#include "src/core/lib/security/credentials/jwt/jwt_credentials.h"
-#include "src/core/lib/support/load_file.h"
#include <grpc/support/alloc.h>
#include <grpc/support/cmdline.h>
@@ -45,13 +45,10 @@
void create_jwt(const char *json_key_file_path, const char *service_url,
const char *scope) {
grpc_auth_json_key key;
- int ok = 0;
char *jwt;
- gpr_slice json_key_data = gpr_load_file(json_key_file_path, 1, &ok);
- if (!ok) {
- fprintf(stderr, "Could not read %s.\n", json_key_file_path);
- exit(1);
- }
+ gpr_slice json_key_data;
+ GPR_ASSERT(GRPC_LOG_IF_ERROR(
+ "load_file", grpc_load_file(json_key_file_path, 1, &json_key_data)));
key = grpc_auth_json_key_create_from_string(
(const char *)GPR_SLICE_START_PTR(json_key_data));
gpr_slice_unref(json_key_data);
diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c
index 31e06372b9..e703dbdeb6 100644
--- a/test/core/security/credentials_test.c
+++ b/test/core/security/credentials_test.c
@@ -157,7 +157,7 @@ static grpc_httpcli_response http_response(int status, const char *body) {
grpc_httpcli_response response;
memset(&response, 0, sizeof(grpc_httpcli_response));
response.status = status;
- response.body = (char *)body;
+ response.body = gpr_strdup((char *)body);
response.body_length = strlen(body);
return response;
}
@@ -247,6 +247,7 @@ static void test_oauth2_token_fetcher_creds_parsing_ok(void) {
"Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") ==
0);
grpc_credentials_md_store_unref(token_md);
+ grpc_http_response_destroy(&response);
}
static void test_oauth2_token_fetcher_creds_parsing_bad_http_status(void) {
@@ -257,6 +258,7 @@ static void test_oauth2_token_fetcher_creds_parsing_bad_http_status(void) {
GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response(
&response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
+ grpc_http_response_destroy(&response);
}
static void test_oauth2_token_fetcher_creds_parsing_empty_http_body(void) {
@@ -266,6 +268,7 @@ static void test_oauth2_token_fetcher_creds_parsing_empty_http_body(void) {
GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response(
&response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
+ grpc_http_response_destroy(&response);
}
static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) {
@@ -279,6 +282,7 @@ static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) {
GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response(
&response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
+ grpc_http_response_destroy(&response);
}
static void test_oauth2_token_fetcher_creds_parsing_missing_token(void) {
@@ -291,6 +295,7 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token(void) {
GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response(
&response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
+ grpc_http_response_destroy(&response);
}
static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) {
@@ -304,6 +309,7 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) {
GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response(
&response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
+ grpc_http_response_destroy(&response);
}
static void test_oauth2_token_fetcher_creds_parsing_missing_token_lifetime(
@@ -317,6 +323,7 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token_lifetime(
GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response(
&response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
+ grpc_http_response_destroy(&response);
}
static void check_metadata(expected_md *expected, grpc_credentials_md *md_elems,
@@ -549,37 +556,37 @@ static void validate_compute_engine_http_request(
static int compute_engine_httpcli_get_success_override(
grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- gpr_timespec deadline, grpc_httpcli_response_cb on_response,
- void *user_data) {
- grpc_httpcli_response response =
- http_response(200, valid_oauth2_json_response);
+ gpr_timespec deadline, grpc_closure *on_done,
+ grpc_httpcli_response *response) {
validate_compute_engine_http_request(request);
- on_response(exec_ctx, user_data, &response);
+ *response = http_response(200, valid_oauth2_json_response);
+ grpc_exec_ctx_sched(exec_ctx, on_done, GRPC_ERROR_NONE, NULL);
return 1;
}
static int compute_engine_httpcli_get_failure_override(
grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- gpr_timespec deadline, grpc_httpcli_response_cb on_response,
- void *user_data) {
- grpc_httpcli_response response = http_response(403, "Not Authorized.");
+ gpr_timespec deadline, grpc_closure *on_done,
+ grpc_httpcli_response *response) {
validate_compute_engine_http_request(request);
- on_response(exec_ctx, user_data, &response);
+ *response = http_response(403, "Not Authorized.");
+ grpc_exec_ctx_sched(exec_ctx, on_done, GRPC_ERROR_NONE, NULL);
return 1;
}
static int httpcli_post_should_not_be_called(
grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
const char *body_bytes, size_t body_size, gpr_timespec deadline,
- grpc_httpcli_response_cb on_response, void *user_data) {
+ grpc_closure *on_done, grpc_httpcli_response *response) {
GPR_ASSERT("HTTP POST should not be called" == NULL);
return 1;
}
-static int httpcli_get_should_not_be_called(
- grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- gpr_timespec deadline, grpc_httpcli_response_cb on_response,
- void *user_data) {
+static int httpcli_get_should_not_be_called(grpc_exec_ctx *exec_ctx,
+ const grpc_httpcli_request *request,
+ gpr_timespec deadline,
+ grpc_closure *on_done,
+ grpc_httpcli_response *response) {
GPR_ASSERT("HTTP GET should not be called" == NULL);
return 1;
}
@@ -653,21 +660,20 @@ static void validate_refresh_token_http_request(
static int refresh_token_httpcli_post_success(
grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
const char *body, size_t body_size, gpr_timespec deadline,
- grpc_httpcli_response_cb on_response, void *user_data) {
- grpc_httpcli_response response =
- http_response(200, valid_oauth2_json_response);
+ grpc_closure *on_done, grpc_httpcli_response *response) {
validate_refresh_token_http_request(request, body, body_size);
- on_response(exec_ctx, user_data, &response);
+ *response = http_response(200, valid_oauth2_json_response);
+ grpc_exec_ctx_sched(exec_ctx, on_done, GRPC_ERROR_NONE, NULL);
return 1;
}
static int refresh_token_httpcli_post_failure(
grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
const char *body, size_t body_size, gpr_timespec deadline,
- grpc_httpcli_response_cb on_response, void *user_data) {
- grpc_httpcli_response response = http_response(403, "Not Authorized.");
+ grpc_closure *on_done, grpc_httpcli_response *response) {
validate_refresh_token_http_request(request, body, body_size);
- on_response(exec_ctx, user_data, &response);
+ *response = http_response(403, "Not Authorized.");
+ grpc_exec_ctx_sched(exec_ctx, on_done, GRPC_ERROR_NONE, NULL);
return 1;
}
@@ -899,17 +905,17 @@ static void test_google_default_creds_refresh_token(void) {
static int default_creds_gce_detection_httpcli_get_success_override(
grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- gpr_timespec deadline, grpc_httpcli_response_cb on_response,
- void *user_data) {
- grpc_httpcli_response response = http_response(200, "");
- grpc_http_header header;
- header.key = "Metadata-Flavor";
- header.value = "Google";
- response.hdr_count = 1;
- response.hdrs = &header;
+ gpr_timespec deadline, grpc_closure *on_done,
+ grpc_httpcli_response *response) {
+ *response = http_response(200, "");
+ grpc_http_header *headers = gpr_malloc(sizeof(*headers) * 1);
+ headers[0].key = gpr_strdup("Metadata-Flavor");
+ headers[0].value = gpr_strdup("Google");
+ response->hdr_count = 1;
+ response->hdrs = headers;
GPR_ASSERT(strcmp(request->http.path, "/") == 0);
GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0);
- on_response(exec_ctx, user_data, &response);
+ grpc_exec_ctx_sched(exec_ctx, on_done, GRPC_ERROR_NONE, NULL);
return 1;
}
@@ -961,13 +967,13 @@ static void test_google_default_creds_gce(void) {
static int default_creds_gce_detection_httpcli_get_failure_override(
grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- gpr_timespec deadline, grpc_httpcli_response_cb on_response,
- void *user_data) {
+ gpr_timespec deadline, grpc_closure *on_done,
+ grpc_httpcli_response *response) {
/* No magic header. */
- grpc_httpcli_response response = http_response(200, "");
GPR_ASSERT(strcmp(request->http.path, "/") == 0);
GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0);
- on_response(exec_ctx, user_data, &response);
+ *response = http_response(200, "");
+ grpc_exec_ctx_sched(exec_ctx, on_done, GRPC_ERROR_NONE, NULL);
return 1;
}
diff --git a/test/core/security/fetch_oauth2.c b/test/core/security/fetch_oauth2.c
index 2a102fb139..292f59a7c1 100644
--- a/test/core/security/fetch_oauth2.c
+++ b/test/core/security/fetch_oauth2.c
@@ -42,19 +42,16 @@
#include <grpc/support/slice.h>
#include <grpc/support/sync.h>
+#include "src/core/lib/iomgr/load_file.h"
#include "src/core/lib/security/credentials/credentials.h"
-#include "src/core/lib/support/load_file.h"
#include "test/core/security/oauth2_utils.h"
static grpc_call_credentials *create_refresh_token_creds(
const char *json_refresh_token_file_path) {
- int success;
- gpr_slice refresh_token =
- gpr_load_file(json_refresh_token_file_path, 1, &success);
- if (!success) {
- gpr_log(GPR_ERROR, "Could not read file %s.", json_refresh_token_file_path);
- exit(1);
- }
+ gpr_slice refresh_token;
+ GPR_ASSERT(GRPC_LOG_IF_ERROR(
+ "load_file",
+ grpc_load_file(json_refresh_token_file_path, 1, &refresh_token)));
return grpc_google_refresh_token_credentials_create(
(const char *)GPR_SLICE_START_PTR(refresh_token), NULL);
}
diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c
index 7f4f4ffadf..36b331a777 100644
--- a/test/core/security/jwt_verifier_test.c
+++ b/test/core/security/jwt_verifier_test.c
@@ -278,24 +278,23 @@ static grpc_httpcli_response http_response(int status, char *body) {
static int httpcli_post_should_not_be_called(
grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
const char *body_bytes, size_t body_size, gpr_timespec deadline,
- grpc_httpcli_response_cb on_response, void *user_data) {
+ grpc_closure *on_done, grpc_httpcli_response *response) {
GPR_ASSERT("HTTP POST should not be called" == NULL);
return 1;
}
static int httpcli_get_google_keys_for_email(
grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- gpr_timespec deadline, grpc_httpcli_response_cb on_response,
- void *user_data) {
- grpc_httpcli_response response = http_response(200, good_google_email_keys());
+ gpr_timespec deadline, grpc_closure *on_done,
+ grpc_httpcli_response *response) {
+ *response = http_response(200, good_google_email_keys());
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "www.googleapis.com") == 0);
GPR_ASSERT(strcmp(request->http.path,
"/robot/v1/metadata/x509/"
"777-abaslkan11hlb6nmim3bpspl31ud@developer."
"gserviceaccount.com") == 0);
- on_response(exec_ctx, user_data, &response);
- gpr_free(response.body);
+ grpc_exec_ctx_sched(exec_ctx, on_done, GRPC_ERROR_NONE, NULL);
return 1;
}
@@ -325,22 +324,21 @@ static void test_jwt_verifier_google_email_issuer_success(void) {
GPR_ASSERT(jwt != NULL);
grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience,
on_verification_success, (void *)expected_user_data);
+ grpc_exec_ctx_finish(&exec_ctx);
gpr_free(jwt);
grpc_jwt_verifier_destroy(verifier);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
}
static int httpcli_get_custom_keys_for_email(
grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- gpr_timespec deadline, grpc_httpcli_response_cb on_response,
- void *user_data) {
- grpc_httpcli_response response = http_response(200, gpr_strdup(good_jwk_set));
+ gpr_timespec deadline, grpc_closure *on_done,
+ grpc_httpcli_response *response) {
+ *response = http_response(200, gpr_strdup(good_jwk_set));
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "keys.bar.com") == 0);
GPR_ASSERT(strcmp(request->http.path, "/jwk/foo@bar.com") == 0);
- on_response(exec_ctx, user_data, &response);
- gpr_free(response.body);
+ grpc_exec_ctx_sched(exec_ctx, on_done, GRPC_ERROR_NONE, NULL);
return 1;
}
@@ -360,40 +358,36 @@ static void test_jwt_verifier_custom_email_issuer_success(void) {
GPR_ASSERT(jwt != NULL);
grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience,
on_verification_success, (void *)expected_user_data);
+ grpc_exec_ctx_finish(&exec_ctx);
gpr_free(jwt);
grpc_jwt_verifier_destroy(verifier);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
}
static int httpcli_get_jwk_set(grpc_exec_ctx *exec_ctx,
const grpc_httpcli_request *request,
- gpr_timespec deadline,
- grpc_httpcli_response_cb on_response,
- void *user_data) {
- grpc_httpcli_response response = http_response(200, gpr_strdup(good_jwk_set));
+ gpr_timespec deadline, grpc_closure *on_done,
+ grpc_httpcli_response *response) {
+ *response = http_response(200, gpr_strdup(good_jwk_set));
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "www.googleapis.com") == 0);
GPR_ASSERT(strcmp(request->http.path, "/oauth2/v3/certs") == 0);
- on_response(exec_ctx, user_data, &response);
- gpr_free(response.body);
+ grpc_exec_ctx_sched(exec_ctx, on_done, GRPC_ERROR_NONE, NULL);
return 1;
}
static int httpcli_get_openid_config(grpc_exec_ctx *exec_ctx,
const grpc_httpcli_request *request,
gpr_timespec deadline,
- grpc_httpcli_response_cb on_response,
- void *user_data) {
- grpc_httpcli_response response =
- http_response(200, gpr_strdup(good_openid_config));
+ grpc_closure *on_done,
+ grpc_httpcli_response *response) {
+ *response = http_response(200, gpr_strdup(good_openid_config));
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "accounts.google.com") == 0);
GPR_ASSERT(strcmp(request->http.path, GRPC_OPENID_CONFIG_URL_SUFFIX) == 0);
grpc_httpcli_set_override(httpcli_get_jwk_set,
httpcli_post_should_not_be_called);
- on_response(exec_ctx, user_data, &response);
- gpr_free(response.body);
+ grpc_exec_ctx_sched(exec_ctx, on_done, GRPC_ERROR_NONE, NULL);
return 1;
}
@@ -413,10 +407,10 @@ static void test_jwt_verifier_url_issuer_success(void) {
GPR_ASSERT(jwt != NULL);
grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience,
on_verification_success, (void *)expected_user_data);
+ grpc_exec_ctx_finish(&exec_ctx);
gpr_free(jwt);
grpc_jwt_verifier_destroy(verifier);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
}
static void on_verification_key_retrieval_error(void *user_data,
@@ -429,14 +423,11 @@ static void on_verification_key_retrieval_error(void *user_data,
static int httpcli_get_bad_json(grpc_exec_ctx *exec_ctx,
const grpc_httpcli_request *request,
- gpr_timespec deadline,
- grpc_httpcli_response_cb on_response,
- void *user_data) {
- grpc_httpcli_response response =
- http_response(200, gpr_strdup("{\"bad\": \"stuff\"}"));
+ gpr_timespec deadline, grpc_closure *on_done,
+ grpc_httpcli_response *response) {
+ *response = http_response(200, gpr_strdup("{\"bad\": \"stuff\"}"));
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
- on_response(exec_ctx, user_data, &response);
- gpr_free(response.body);
+ grpc_exec_ctx_sched(exec_ctx, on_done, GRPC_ERROR_NONE, NULL);
return 1;
}
@@ -457,10 +448,10 @@ static void test_jwt_verifier_url_issuer_bad_config(void) {
grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience,
on_verification_key_retrieval_error,
(void *)expected_user_data);
+ grpc_exec_ctx_finish(&exec_ctx);
gpr_free(jwt);
grpc_jwt_verifier_destroy(verifier);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
}
static void test_jwt_verifier_bad_json_key(void) {
@@ -480,10 +471,10 @@ static void test_jwt_verifier_bad_json_key(void) {
grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience,
on_verification_key_retrieval_error,
(void *)expected_user_data);
+ grpc_exec_ctx_finish(&exec_ctx);
gpr_free(jwt);
grpc_jwt_verifier_destroy(verifier);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
}
static void corrupt_jwt_sig(char *jwt) {
@@ -529,16 +520,17 @@ static void test_jwt_verifier_bad_signature(void) {
grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience,
on_verification_bad_signature,
(void *)expected_user_data);
+ grpc_exec_ctx_finish(&exec_ctx);
gpr_free(jwt);
grpc_jwt_verifier_destroy(verifier);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
}
-static int httpcli_get_should_not_be_called(
- grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- gpr_timespec deadline, grpc_httpcli_response_cb on_response,
- void *user_data) {
+static int httpcli_get_should_not_be_called(grpc_exec_ctx *exec_ctx,
+ const grpc_httpcli_request *request,
+ gpr_timespec deadline,
+ grpc_closure *on_done,
+ grpc_httpcli_response *response) {
GPR_ASSERT(0);
return 1;
}
@@ -559,9 +551,9 @@ static void test_jwt_verifier_bad_format(void) {
grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, "bad jwt",
expected_audience, on_verification_bad_format,
(void *)expected_user_data);
+ grpc_exec_ctx_finish(&exec_ctx);
grpc_jwt_verifier_destroy(verifier);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
}
/* find verification key: bad jks, cannot find key in jks */
diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.c
index cb27a1a564..a334edc32d 100644
--- a/test/core/security/oauth2_utils.c
+++ b/test/core/security/oauth2_utils.c
@@ -70,11 +70,14 @@ static void on_oauth2_response(grpc_exec_ctx *exec_ctx, void *user_data,
gpr_mu_lock(request->mu);
request->is_done = 1;
request->token = token;
- grpc_pollset_kick(grpc_polling_entity_pollset(&request->pops), NULL);
+ GRPC_LOG_IF_ERROR(
+ "pollset_kick",
+ grpc_pollset_kick(grpc_polling_entity_pollset(&request->pops), NULL));
gpr_mu_unlock(request->mu);
}
-static void do_nothing(grpc_exec_ctx *exec_ctx, void *unused, bool success) {}
+static void do_nothing(grpc_exec_ctx *exec_ctx, void *unused,
+ grpc_error *error) {}
char *grpc_test_fetch_oauth2_token_with_credentials(
grpc_call_credentials *creds) {
@@ -98,9 +101,14 @@ char *grpc_test_fetch_oauth2_token_with_credentials(
gpr_mu_lock(request.mu);
while (!request.is_done) {
grpc_pollset_worker *worker = NULL;
- grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&request.pops),
- &worker, gpr_now(GPR_CLOCK_MONOTONIC),
- gpr_inf_future(GPR_CLOCK_MONOTONIC));
+ if (!GRPC_LOG_IF_ERROR(
+ "pollset_work",
+ grpc_pollset_work(&exec_ctx,
+ grpc_polling_entity_pollset(&request.pops),
+ &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ gpr_inf_future(GPR_CLOCK_MONOTONIC)))) {
+ request.is_done = 1;
+ }
}
gpr_mu_unlock(request.mu);
diff --git a/test/core/security/print_google_default_creds_token.c b/test/core/security/print_google_default_creds_token.c
index 07c8c58d41..18fbc3c41c 100644
--- a/test/core/security/print_google_default_creds_token.c
+++ b/test/core/security/print_google_default_creds_token.c
@@ -67,7 +67,9 @@ static void on_metadata_response(grpc_exec_ctx *exec_ctx, void *user_data,
}
gpr_mu_lock(sync->mu);
sync->is_done = 1;
- grpc_pollset_kick(grpc_polling_entity_pollset(&sync->pops), NULL);
+ GRPC_LOG_IF_ERROR(
+ "pollset_kick",
+ grpc_pollset_kick(grpc_polling_entity_pollset(&sync->pops), NULL));
gpr_mu_unlock(sync->mu);
}
@@ -106,9 +108,13 @@ int main(int argc, char **argv) {
gpr_mu_lock(sync.mu);
while (!sync.is_done) {
grpc_pollset_worker *worker = NULL;
- grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&sync.pops),
- &worker, gpr_now(GPR_CLOCK_MONOTONIC),
- gpr_inf_future(GPR_CLOCK_MONOTONIC));
+ if (!GRPC_LOG_IF_ERROR(
+ "pollset_work",
+ grpc_pollset_work(&exec_ctx,
+ grpc_polling_entity_pollset(&sync.pops), &worker,
+ gpr_now(GPR_CLOCK_MONOTONIC),
+ gpr_inf_future(GPR_CLOCK_MONOTONIC))))
+ sync.is_done = 1;
gpr_mu_unlock(sync.mu);
grpc_exec_ctx_flush(&exec_ctx);
gpr_mu_lock(sync.mu);
diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c
index 6aba21a98c..1d2bf73bb1 100644
--- a/test/core/security/secure_endpoint_test.c
+++ b/test/core/security/secure_endpoint_test.c
@@ -139,7 +139,8 @@ static grpc_endpoint_test_config configs[] = {
secure_endpoint_create_fixture_tcp_socketpair_leftover, clean_up},
};
-static void inc_call_ctr(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
+static void inc_call_ctr(grpc_exec_ctx *exec_ctx, void *arg,
+ grpc_error *error) {
++*(int *)arg;
}
@@ -172,7 +173,8 @@ static void test_leftover(grpc_endpoint_test_config config, size_t slice_size) {
clean_up();
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) {
+static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
+ grpc_error *error) {
grpc_pollset_destroy(p);
}
diff --git a/test/core/security/verify_jwt.c b/test/core/security/verify_jwt.c
index ecb873b655..728d2d637a 100644
--- a/test/core/security/verify_jwt.c
+++ b/test/core/security/verify_jwt.c
@@ -81,7 +81,7 @@ static void on_jwt_verification_done(void *user_data,
gpr_mu_lock(sync->mu);
sync->is_done = 1;
- grpc_pollset_kick(sync->pollset, NULL);
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(sync->pollset, NULL));
gpr_mu_unlock(sync->mu);
}
@@ -115,9 +115,12 @@ int main(int argc, char **argv) {
gpr_mu_lock(sync.mu);
while (!sync.is_done) {
grpc_pollset_worker *worker = NULL;
- grpc_pollset_work(&exec_ctx, sync.pollset, &worker,
- gpr_now(GPR_CLOCK_MONOTONIC),
- gpr_inf_future(GPR_CLOCK_MONOTONIC));
+ if (!GRPC_LOG_IF_ERROR(
+ "pollset_work",
+ grpc_pollset_work(&exec_ctx, sync.pollset, &worker,
+ gpr_now(GPR_CLOCK_MONOTONIC),
+ gpr_inf_future(GPR_CLOCK_MONOTONIC))))
+ sync.is_done = true;
gpr_mu_unlock(sync.mu);
grpc_exec_ctx_finish(&exec_ctx);
gpr_mu_lock(sync.mu);