| 1 |
/* |
| 2 |
* |
| 3 |
* Copyright 2015 gRPC authors. |
| 4 |
* |
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 |
* you may not use this file except in compliance with the License. |
| 7 |
* You may obtain a copy of the License at |
| 8 |
* |
| 9 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
* |
| 11 |
* Unless required by applicable law or agreed to in writing, software |
| 12 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 13 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 |
* See the License for the specific language governing permissions and |
| 15 |
* limitations under the License. |
| 16 |
* |
| 17 |
*/ |
| 18 |
|
| 19 |
#ifndef GRPC_TEST_CORE_END2END_END2END_TESTS_H |
| 20 |
#define GRPC_TEST_CORE_END2END_END2END_TESTS_H |
| 21 |
|
| 22 |
#include <stdint.h> |
| 23 |
|
| 24 |
#include <grpc/grpc.h> |
| 25 |
#include <grpc/slice.h> |
| 26 |
|
| 27 |
typedef struct grpc_end2end_test_fixture grpc_end2end_test_fixture; |
| 28 |
typedef struct grpc_end2end_test_config grpc_end2end_test_config; |
| 29 |
|
| 30 |
/* Test feature flags. */ |
| 31 |
#define FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION 1 |
| 32 |
#define FEATURE_MASK_SUPPORTS_HOSTNAME_VERIFICATION 2 |
| 33 |
// Feature mask supports call credentials with a minimum security level of |
| 34 |
// GRPC_PRIVACY_AND_INTEGRITY. |
| 35 |
#define FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS 4 |
| 36 |
// Feature mask supports call credentials with a minimum security level of |
| 37 |
// GRPC_SECURTITY_NONE. |
| 38 |
#define FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS_LEVEL_INSECURE 8 |
| 39 |
#define FEATURE_MASK_SUPPORTS_REQUEST_PROXYING 16 |
| 40 |
#define FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL 32 |
| 41 |
#define FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER 64 |
| 42 |
#define FEATURE_MASK_DOES_NOT_SUPPORT_CLIENT_HANDSHAKE_COMPLETE_FIRST 1024 |
| 43 |
#define FEATURE_MASK_DOES_NOT_SUPPORT_DEADLINES 2048 |
| 44 |
|
| 45 |
#define FAIL_AUTH_CHECK_SERVER_ARG_NAME "fail_auth_check" |
| 46 |
|
| 47 |
struct grpc_end2end_test_fixture { |
| 48 |
grpc_completion_queue* cq; |
| 49 |
grpc_server* server; |
| 50 |
grpc_channel* client; |
| 51 |
void* fixture_data; |
| 52 |
}; |
| 53 |
|
| 54 |
struct grpc_end2end_test_config { |
| 55 |
/* A descriptive name for this test fixture. */ |
| 56 |
const char* name; |
| 57 |
|
| 58 |
/* Which features are supported by this fixture. See feature flags above. */ |
| 59 |
uint32_t feature_mask; |
| 60 |
|
| 61 |
/* If the call host is setup by the fixture (for example, via the |
| 62 |
* GRPC_SSL_TARGET_NAME_OVERRIDE_ARG channel arg), which value should the test |
| 63 |
* expect to find in call_details.host */ |
| 64 |
const char* overridden_call_host; |
| 65 |
|
| 66 |
grpc_end2end_test_fixture (*create_fixture)( |
| 67 |
const grpc_channel_args* client_args, |
| 68 |
const grpc_channel_args* server_args); |
| 69 |
void (*init_client)(grpc_end2end_test_fixture* f, |
| 70 |
const grpc_channel_args* client_args); |
| 71 |
void (*init_server)(grpc_end2end_test_fixture* f, |
| 72 |
const grpc_channel_args* server_args); |
| 73 |
void (*tear_down_data)(grpc_end2end_test_fixture* f); |
| 74 |
}; |
| 75 |
|
| 76 |
void grpc_end2end_tests_pre_init(void); |
| 77 |
void grpc_end2end_tests(int argc, char** argv, grpc_end2end_test_config config); |
| 78 |
|
| 79 |
const char* get_host_override_string(const char* str, |
| 80 |
grpc_end2end_test_config config); |
| 81 |
/* Returns a pointer to a statically allocated slice: future invocations |
| 82 |
overwrite past invocations, not threadsafe, etc... */ |
| 83 |
const grpc_slice* get_host_override_slice(const char* str, |
| 84 |
grpc_end2end_test_config config); |
| 85 |
|
| 86 |
void validate_host_override_string(const char* pattern, grpc_slice str, |
| 87 |
grpc_end2end_test_config config); |
| 88 |
|
| 89 |
#endif /* GRPC_TEST_CORE_END2END_END2END_TESTS_H */ |