Go to the documentation of this file.
18 #include <grpc/byte_buffer.h>
32 static void*
tag(
intptr_t t) {
return reinterpret_cast<void*
>(t); }
35 const char* test_name,
40 f =
config.create_fixture(client_args, server_args);
41 config.init_server(&
f, server_args);
42 config.init_client(&
f, client_args);
62 if (!
f->server)
return;
73 if (!
f->client)
return;
97 const char* error_string =
nullptr;
181 gpr_free(
const_cast<char*
>(error_string));
199 const char* error_string =
nullptr;
249 gpr_free(
const_cast<char*
>(error_string));
259 const char* authz_policy =
261 " \"name\": \"authz\","
262 " \"allow_rules\": ["
264 " \"name\": \"allow_foo\","
274 const char* error_details;
298 const char* authz_policy =
300 " \"name\": \"authz\","
301 " \"allow_rules\": ["
303 " \"name\": \"allow_bar\","
313 " \"name\": \"deny_foo\","
323 const char* error_details;
347 const char* authz_policy =
349 " \"name\": \"authz\","
350 " \"allow_rules\": ["
352 " \"name\": \"allow_bar\","
362 const char* error_details;
376 nullptr, &server_args);
386 const char* authz_policy =
388 " \"name\": \"authz\","
389 " \"allow_rules\": ["
391 " \"name\": \"allow_foo\","
402 const char* error_details;
405 tmp_policy.
name().c_str(), 1, &
code,
417 nullptr, &server_args);
427 const char* authz_policy =
429 " \"name\": \"authz\","
430 " \"allow_rules\": ["
432 " \"name\": \"allow_bar\","
442 " \"name\": \"deny_foo\","
453 const char* error_details;
456 tmp_policy.
name().c_str(), 1, &
code,
468 nullptr, &server_args);
478 const char* authz_policy =
480 " \"name\": \"authz\","
481 " \"allow_rules\": ["
483 " \"name\": \"allow_bar\","
494 const char* error_details;
497 tmp_policy.
name().c_str(), 1, &
code,
508 config,
"test_file_watcher_init_deny_request_no_match_in_policy",
nullptr,
519 const char* authz_policy =
521 " \"name\": \"authz\","
522 " \"allow_rules\": ["
524 " \"name\": \"allow_foo\","
535 const char* error_details;
538 tmp_policy.
name().c_str(), 1, &
code,
549 config,
"test_file_watcher_valid_policy_reload",
nullptr, &server_args);
556 if (contents_changed) {
566 " \"name\": \"authz\","
567 " \"allow_rules\": ["
569 " \"name\": \"allow_bar\","
579 " \"name\": \"deny_foo\","
590 reinterpret_cast<void*
>(1) ==
594 ->SetCallbackForTesting(
nullptr);
602 const char* authz_policy =
604 " \"name\": \"authz\","
605 " \"allow_rules\": ["
607 " \"name\": \"allow_foo\","
618 const char* error_details;
621 tmp_policy.
name().c_str(), 1, &
code,
633 nullptr, &server_args);
640 if (contents_changed) {
652 reinterpret_cast<void*
>(1) ==
656 ->SetCallbackForTesting(
nullptr);
664 const char* authz_policy =
666 " \"name\": \"authz\","
667 " \"allow_rules\": ["
669 " \"name\": \"allow_foo\","
680 const char* error_details;
683 tmp_policy.
name().c_str(), 1, &
code,
694 config,
"test_file_watcher_recovers_from_failure",
nullptr, &server_args);
701 if (contents_changed) {
704 gpr_event_set(&on_first_reload_done,
reinterpret_cast<void*
>(1));
708 ->SetCallbackForTesting(
std::move(callback1));
720 if (contents_changed) {
722 gpr_event_set(&on_second_reload_done,
reinterpret_cast<void*
>(1));
731 " \"name\": \"authz\","
732 " \"allow_rules\": ["
734 " \"name\": \"allow_bar\","
744 " \"name\": \"deny_foo\","
759 ->SetCallbackForTesting(
nullptr);
GPRAPI void grpc_slice_unref(grpc_slice s)
GRPCAPI void grpc_call_details_destroy(grpc_call_details *details)
GRPCAPI void grpc_call_details_init(grpc_call_details *details)
grpc_metadata_array * trailing_metadata
gpr_timespec grpc_timeout_seconds_to_deadline(int64_t time_s)
grpc_status_code * status
return memset(p, 0, total)
static void test_file_watcher_init_allow_authorized_request(grpc_end2end_test_config config)
struct grpc_op::grpc_op_data::grpc_op_send_initial_metadata send_initial_metadata
@ GRPC_STATUS_PERMISSION_DENIED
GPRAPI void gpr_event_set(gpr_event *ev, void *value)
GPRAPI void gpr_free(void *ptr)
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type)
static void end_test(grpc_end2end_test_fixture *f)
GRPCAPI grpc_authorization_policy_provider * grpc_authorization_policy_provider_file_watcher_create(const char *authz_policy_path, unsigned int refresh_interval_sec, grpc_status_code *code, const char **error_details)
const GRPCAPI grpc_arg_pointer_vtable * grpc_authorization_policy_provider_arg_vtable(void)
union grpc_op::grpc_op_data data
void RewriteFile(absl::string_view data)
static void test_static_init_allow_authorized_request(grpc_end2end_test_config config)
static gpr_timespec five_seconds_from_now(void)
GRPCAPI void grpc_metadata_array_destroy(grpc_metadata_array *array)
GRPCAPI grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *request_metadata, grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag_new)
static grpc_metadata_array trailing_metadata_recv
static void test_file_watcher_recovers_from_failure(grpc_end2end_test_config config)
@ GRPC_OP_RECV_INITIAL_METADATA
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
@ GRPC_OP_SEND_STATUS_FROM_SERVER
GRPCAPI void grpc_call_unref(grpc_call *call)
const char ** error_string
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
void cq_verifier_destroy(cq_verifier *v)
static void test_file_watcher_init_deny_unauthorized_request(grpc_end2end_test_config config)
struct grpc_call grpc_call
absl::string_view message() const
static void test_allow_authorized_request(grpc_end2end_test_fixture f)
GPRAPI grpc_slice grpc_slice_from_static_string(const char *source)
cq_verifier * cq_verifier_create(grpc_completion_queue *cq)
static void test_deny_unauthorized_request(grpc_end2end_test_fixture f)
GPRAPI grpc_slice grpc_empty_slice(void)
static grpc_metadata_array request_metadata_recv
GPRAPI void gpr_event_init(gpr_event *ev)
GRPCAPI void grpc_server_destroy(grpc_server *server)
static void callback(void *arg, int status, int timeouts, struct hostent *host)
#define CQ_EXPECT_COMPLETION(v, tag, success)
static void test_file_watcher_init_deny_request_no_match_in_policy(grpc_end2end_test_config config)
GPRAPI void * gpr_event_wait(gpr_event *ev, gpr_timespec abs_deadline)
const std::string & name()
static void * tag(intptr_t t)
#define GRPC_ARG_AUTHORIZATION_POLICY_PROVIDER
grpc_slice * status_details
static grpc_slice details
GRPCAPI grpc_call * grpc_channel_create_call(grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask, grpc_completion_queue *completion_queue, grpc_slice method, const grpc_slice *host, gpr_timespec deadline, void *reserved)
struct grpc_op::grpc_op_data::grpc_op_recv_close_on_server recv_close_on_server
static gpr_timespec n_seconds_from_now(int n)
#define GPR_ARRAY_SIZE(array)
#define GRPC_PROPAGATE_DEFAULTS
struct grpc_op::grpc_op_data::grpc_op_send_status_from_server send_status_from_server
static void test_static_init_deny_request_no_match_in_policy(grpc_end2end_test_config config)
static void shutdown_client(grpc_end2end_test_fixture *f)
static void test_static_init_deny_unauthorized_request(grpc_end2end_test_config config)
GRPCAPI void grpc_completion_queue_destroy(grpc_completion_queue *cq)
@ GRPC_OP_SEND_INITIAL_METADATA
struct grpc_op::grpc_op_data::grpc_op_recv_status_on_client recv_status_on_client
GRPCAPI grpc_authorization_policy_provider * grpc_authorization_policy_provider_static_data_create(const char *authz_policy, grpc_status_code *code, const char **error_details)
size_t trailing_metadata_count
GRPCAPI void grpc_server_shutdown_and_notify(grpc_server *server, grpc_completion_queue *cq, void *tag)
GRPCAPI grpc_event grpc_completion_queue_next(grpc_completion_queue *cq, gpr_timespec deadline, void *reserved)
void cq_verify(cq_verifier *v, int timeout_sec)
GRPCAPI void grpc_completion_queue_shutdown(grpc_completion_queue *cq)
GRPCAPI void grpc_channel_destroy(grpc_channel *channel)
ABSL_MUST_USE_RESULT bool ok() const
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)
static void shutdown_server(grpc_end2end_test_fixture *f)
static void drain_cq(grpc_completion_queue *cq)
@ GRPC_OP_RECV_CLOSE_ON_SERVER
static void callback2(void *arg, int status, int timeouts, struct hostent *host)
static void test_file_watcher_valid_policy_reload(grpc_end2end_test_config config)
void grpc_authz_pre_init(void)
struct grpc_op::grpc_op_data::grpc_op_recv_initial_metadata recv_initial_metadata
grpc_slice * status_details
GRPCAPI void grpc_authorization_policy_provider_release(grpc_authorization_policy_provider *provider)
grpc_completion_type type
void grpc_authz(grpc_end2end_test_config config)
@ GRPC_OP_RECV_STATUS_ON_CLIENT
GPRAPI int grpc_slice_str_cmp(grpc_slice a, const char *b)
absl::StatusCode code() const
static void test_file_watcher_invalid_policy_skip_reload(grpc_end2end_test_config config)
grpc_arg grpc_channel_arg_pointer_create(char *name, void *value, const grpc_arg_pointer_vtable *vtable)
static grpc_metadata_array initial_metadata_recv
GRPCAPI grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops, size_t nops, void *tag, void *reserved)
static grpc_completion_queue * cq
@ GRPC_OP_SEND_CLOSE_FROM_CLIENT
static grpc_call_details call_details
GRPCAPI void grpc_metadata_array_init(grpc_metadata_array *array)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:47