diff --git a/test/core/security/create_jwt.c b/test/core/security/create_jwt.c index 3c36b767d302079121e231237f62d506c7faeca8..65468bc0ed23a46e49ba500704d6d64538c49c53 100644 --- a/test/core/security/create_jwt.c +++ b/test/core/security/create_jwt.c @@ -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", gpr_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/fetch_oauth2.c b/test/core/security/fetch_oauth2.c index 2a102fb139bb4b5b6dee5ce3d0b4ca91023deacc..d970ff9c498f4933504998bda47311f0fa35fc20 100644 --- a/test/core/security/fetch_oauth2.c +++ b/test/core/security/fetch_oauth2.c @@ -48,13 +48,10 @@ 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", + gpr_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); }