Classes | Macros | Typedefs | Functions | Variables
alts_handshaker_client_test.cc File Reference
#include "src/core/tsi/alts/handshaker/alts_handshaker_client.h"
#include "upb/upb.hpp"
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include "src/core/tsi/alts/handshaker/alts_shared_resource.h"
#include "src/core/tsi/alts/handshaker/alts_tsi_handshaker.h"
#include "src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h"
#include "src/core/tsi/transport_security.h"
#include "src/core/tsi/transport_security_interface.h"
#include "test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.h"
#include "test/core/util/test_config.h"
Include dependency graph for alts_handshaker_client_test.cc:

Go to the source code of this file.

Classes

struct  alts_handshaker_client_test_config
 

Macros

#define ALTS_HANDSHAKER_CLIENT_TEST_MAX_FRAME_SIZE   (64 * 1024)
 
#define ALTS_HANDSHAKER_CLIENT_TEST_OUT_FRAME   "Hello Google"
 
#define ALTS_HANDSHAKER_CLIENT_TEST_TARGET_NAME   "bigtable.google.api.com"
 
#define ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT1   "A@google.com"
 
#define ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT2   "B@google.com"
 

Typedefs

typedef struct alts_handshaker_client_test_config alts_handshaker_client_test_config
 

Functions

static grpc_call_error check_client_start_success (grpc_call *, const grpc_op *op, size_t nops, grpc_closure *closure)
 
static grpc_call_error check_grpc_call_failure (grpc_call *, const grpc_op *op, size_t nops, grpc_closure *)
 
static grpc_call_error check_must_not_be_called (grpc_call *, const grpc_op *, size_t, grpc_closure *)
 
static grpc_call_error check_next_success (grpc_call *, const grpc_op *op, size_t nops, grpc_closure *closure)
 
static grpc_call_error check_server_start_success (grpc_call *, const grpc_op *op, size_t nops, grpc_closure *closure)
 
static alts_handshaker_client_test_configcreate_config ()
 
static grpc_alts_credentials_optionscreate_credentials_options (bool is_client)
 
static grpc_gcp_HandshakerReqdeserialize_handshaker_req (grpc_byte_buffer *buffer, upb_Arena *arena)
 
static void destroy_config (alts_handshaker_client_test_config *config)
 
static bool is_recv_status_op (const grpc_op *op, size_t nops)
 
int main (int argc, char **argv)
 
static void schedule_request_grpc_call_failure_test ()
 
static void schedule_request_invalid_arg_test ()
 
static void schedule_request_success_test ()
 
static void tsi_cb_assert_tsi_internal_error (tsi_result status, void *, const unsigned char *, size_t, tsi_handshaker_result *)
 
static bool validate_op (alts_handshaker_client *c, const grpc_op *op, size_t nops, bool is_start)
 
static void validate_rpc_protocol_versions (const grpc_gcp_RpcProtocolVersions *versions)
 
static void validate_target_identities (const grpc_gcp_Identity *const *target_identities, size_t target_identities_count)
 

Variables

const size_t kHandshakerClientOpNum = 4
 
const size_t kMaxRpcVersionMajor = 3
 
const size_t kMaxRpcVersionMinor = 2
 
const size_t kMinRpcVersionMajor = 2
 
const size_t kMinRpcVersionMinor = 1
 

Macro Definition Documentation

◆ ALTS_HANDSHAKER_CLIENT_TEST_MAX_FRAME_SIZE

#define ALTS_HANDSHAKER_CLIENT_TEST_MAX_FRAME_SIZE   (64 * 1024)

Definition at line 38 of file alts_handshaker_client_test.cc.

◆ ALTS_HANDSHAKER_CLIENT_TEST_OUT_FRAME

#define ALTS_HANDSHAKER_CLIENT_TEST_OUT_FRAME   "Hello Google"

Definition at line 34 of file alts_handshaker_client_test.cc.

◆ ALTS_HANDSHAKER_CLIENT_TEST_TARGET_NAME

#define ALTS_HANDSHAKER_CLIENT_TEST_TARGET_NAME   "bigtable.google.api.com"

Definition at line 35 of file alts_handshaker_client_test.cc.

◆ ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT1

#define ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT1   "A@google.com"

Definition at line 36 of file alts_handshaker_client_test.cc.

◆ ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT2

#define ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT2   "B@google.com"

Definition at line 37 of file alts_handshaker_client_test.cc.

Typedef Documentation

◆ alts_handshaker_client_test_config

Function Documentation

◆ check_client_start_success()

static grpc_call_error check_client_start_success ( grpc_call ,
const grpc_op op,
size_t  nops,
grpc_closure closure 
)
static

A mock grpc_caller used to check correct execution of client_start operation. It checks if the client_start handshaker request is populated with correct handshake_security_protocol, application_protocol, record_protocol and max_frame_size, and op is correctly populated.

Definition at line 165 of file alts_handshaker_client_test.cc.

◆ check_grpc_call_failure()

static grpc_call_error check_grpc_call_failure ( grpc_call ,
const grpc_op op,
size_t  nops,
grpc_closure  
)
static

A mock grpc_caller used to check if client_start, server_start, and next operations correctly handle the situation when the grpc call made to the handshaker service fails.

Definition at line 283 of file alts_handshaker_client_test.cc.

◆ check_must_not_be_called()

static grpc_call_error check_must_not_be_called ( grpc_call ,
const grpc_op ,
size_t  ,
grpc_closure  
)
static

A mock grpc_caller used to check if client_start, server_start, and next operations correctly handle invalid arguments. It should not be called.

Definition at line 152 of file alts_handshaker_client_test.cc.

◆ check_next_success()

static grpc_call_error check_next_success ( grpc_call ,
const grpc_op op,
size_t  nops,
grpc_closure closure 
)
static

A mock grpc_caller used to check correct execution of next operation. It checks if the next handshaker request is populated with correct information, and op is correctly populated.

Definition at line 260 of file alts_handshaker_client_test.cc.

◆ check_server_start_success()

static grpc_call_error check_server_start_success ( grpc_call ,
const grpc_op op,
size_t  nops,
grpc_closure closure 
)
static

A mock grpc_caller used to check correct execution of server_start operation. It checks if the server_start handshaker request is populated with correct handshake_security_protocol, application_protocol, record_protocol and max_frame_size, and op is correctly populated.

Definition at line 216 of file alts_handshaker_client_test.cc.

◆ create_config()

static alts_handshaker_client_test_config* create_config ( )
static

Definition at line 312 of file alts_handshaker_client_test.cc.

◆ create_credentials_options()

static grpc_alts_credentials_options* create_credentials_options ( bool  is_client)
static

Definition at line 293 of file alts_handshaker_client_test.cc.

◆ deserialize_handshaker_req()

static grpc_gcp_HandshakerReq* deserialize_handshaker_req ( grpc_byte_buffer buffer,
upb_Arena arena 
)
static

Definition at line 131 of file alts_handshaker_client_test.cc.

◆ destroy_config()

static void destroy_config ( alts_handshaker_client_test_config config)
static

Definition at line 346 of file alts_handshaker_client_test.cc.

◆ is_recv_status_op()

static bool is_recv_status_op ( const grpc_op op,
size_t  nops 
)
static

Definition at line 144 of file alts_handshaker_client_test.cc.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 505 of file alts_handshaker_client_test.cc.

◆ schedule_request_grpc_call_failure_test()

static void schedule_request_grpc_call_failure_test ( )
static

Definition at line 455 of file alts_handshaker_client_test.cc.

◆ schedule_request_invalid_arg_test()

static void schedule_request_invalid_arg_test ( )
static

Definition at line 358 of file alts_handshaker_client_test.cc.

◆ schedule_request_success_test()

static void schedule_request_success_test ( )
static

Definition at line 398 of file alts_handshaker_client_test.cc.

◆ tsi_cb_assert_tsi_internal_error()

static void tsi_cb_assert_tsi_internal_error ( tsi_result  status,
void *  ,
const unsigned char *  ,
size_t  ,
tsi_handshaker_result  
)
static

Definition at line 448 of file alts_handshaker_client_test.cc.

◆ validate_op()

static bool validate_op ( alts_handshaker_client c,
const grpc_op op,
size_t  nops,
bool  is_start 
)
static

Validate if grpc operation data is correctly populated with the fields of ALTS handshaker client.

Definition at line 102 of file alts_handshaker_client_test.cc.

◆ validate_rpc_protocol_versions()

static void validate_rpc_protocol_versions ( const grpc_gcp_RpcProtocolVersions versions)
static

Definition at line 65 of file alts_handshaker_client_test.cc.

◆ validate_target_identities()

static void validate_target_identities ( const grpc_gcp_Identity *const target_identities,
size_t  target_identities_count 
)
static

Definition at line 82 of file alts_handshaker_client_test.cc.

Variable Documentation

◆ kHandshakerClientOpNum

const size_t kHandshakerClientOpNum = 4

Definition at line 40 of file alts_handshaker_client_test.cc.

◆ kMaxRpcVersionMajor

const size_t kMaxRpcVersionMajor = 3

Definition at line 41 of file alts_handshaker_client_test.cc.

◆ kMaxRpcVersionMinor

const size_t kMaxRpcVersionMinor = 2

Definition at line 42 of file alts_handshaker_client_test.cc.

◆ kMinRpcVersionMajor

const size_t kMinRpcVersionMajor = 2

Definition at line 43 of file alts_handshaker_client_test.cc.

◆ kMinRpcVersionMinor

const size_t kMinRpcVersionMinor = 1

Definition at line 44 of file alts_handshaker_client_test.cc.



grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:02