Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
9db75cf6
Commit
9db75cf6
authored
8 years ago
by
Mark D. Roth
Browse files
Options
Downloads
Patches
Plain Diff
Revert changes to sockaddr_resolver_test, since we no longer support query_args there.
parent
fd2ddd28
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/core/client_config/resolvers/sockaddr_resolver_test.c
+1
-83
1 addition, 83 deletions
test/core/client_config/resolvers/sockaddr_resolver_test.c
with
1 addition
and
83 deletions
test/core/client_config/resolvers/sockaddr_resolver_test.c
+
1
−
83
View file @
9db75cf6
...
@@ -37,21 +37,13 @@
...
@@ -37,21 +37,13 @@
#include
<grpc/support/log.h>
#include
<grpc/support/log.h>
#include
<grpc/support/string_util.h>
#include
<grpc/support/string_util.h>
#include
"src/core/ext/client_config/method_config.h"
#include
"src/core/ext/client_config/resolver_registry.h"
#include
"src/core/ext/client_config/resolver_registry.h"
#include
"src/core/ext/client_config/resolver_result.h"
#include
"src/core/ext/client_config/resolver_result.h"
#include
"src/core/lib/channel/channel_args.h"
#include
"src/core/lib/transport/metadata.h"
#include
"test/core/util/test_config.h"
#include
"test/core/util/test_config.h"
typedef
struct
on_resolution_arg
{
typedef
struct
on_resolution_arg
{
char
*
expected_server_name
;
char
*
expected_server_name
;
const
char
*
expected_method_name
;
bool
expected_wait_for_ready
;
gpr_timespec
expected_timeout
;
int32_t
expected_max_request_message_bytes
;
int32_t
expected_max_response_message_bytes
;
grpc_resolver_result
*
resolver_result
;
grpc_resolver_result
*
resolver_result
;
}
on_resolution_arg
;
}
on_resolution_arg
;
...
@@ -60,40 +52,6 @@ void on_resolution_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
...
@@ -60,40 +52,6 @@ void on_resolution_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
const
char
*
server_name
=
const
char
*
server_name
=
grpc_resolver_result_get_server_name
(
res
->
resolver_result
);
grpc_resolver_result_get_server_name
(
res
->
resolver_result
);
GPR_ASSERT
(
strcmp
(
res
->
expected_server_name
,
server_name
)
==
0
);
GPR_ASSERT
(
strcmp
(
res
->
expected_server_name
,
server_name
)
==
0
);
const
grpc_channel_args
*
lb_policy_args
=
grpc_resolver_result_get_lb_policy_args
(
res
->
resolver_result
);
if
(
res
->
expected_method_name
==
NULL
)
{
GPR_ASSERT
(
lb_policy_args
==
NULL
);
}
else
{
const
grpc_arg
*
channel_arg
=
grpc_channel_args_find
(
lb_policy_args
,
GRPC_ARG_SERVICE_CONFIG
);
GPR_ASSERT
(
channel_arg
!=
NULL
);
GPR_ASSERT
(
channel_arg
->
type
==
GRPC_ARG_POINTER
);
grpc_method_config_table
*
method_config_table
=
(
grpc_method_config_table
*
)
channel_arg
->
value
.
pointer
.
p
;
GPR_ASSERT
(
method_config_table
!=
NULL
);
grpc_mdstr
*
path
=
grpc_mdstr_from_string
(
res
->
expected_method_name
);
grpc_method_config
*
method_config
=
grpc_method_config_table_get_method_config
(
method_config_table
,
path
);
GRPC_MDSTR_UNREF
(
path
);
GPR_ASSERT
(
method_config
!=
NULL
);
bool
*
wait_for_ready
=
grpc_method_config_get_wait_for_ready
(
method_config
);
GPR_ASSERT
(
wait_for_ready
!=
NULL
);
GPR_ASSERT
(
*
wait_for_ready
==
res
->
expected_wait_for_ready
);
gpr_timespec
*
timeout
=
grpc_method_config_get_timeout
(
method_config
);
GPR_ASSERT
(
timeout
!=
NULL
);
GPR_ASSERT
(
gpr_time_cmp
(
*
timeout
,
res
->
expected_timeout
)
==
0
);
int32_t
*
max_request_message_bytes
=
grpc_method_config_get_max_request_message_bytes
(
method_config
);
GPR_ASSERT
(
max_request_message_bytes
!=
NULL
);
GPR_ASSERT
(
*
max_request_message_bytes
==
res
->
expected_max_request_message_bytes
);
int32_t
*
max_response_message_bytes
=
grpc_method_config_get_max_response_message_bytes
(
method_config
);
GPR_ASSERT
(
max_response_message_bytes
!=
NULL
);
GPR_ASSERT
(
*
max_response_message_bytes
==
res
->
expected_max_response_message_bytes
);
}
grpc_resolver_result_unref
(
exec_ctx
,
res
->
resolver_result
);
grpc_resolver_result_unref
(
exec_ctx
,
res
->
resolver_result
);
}
}
...
@@ -109,43 +67,13 @@ static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
...
@@ -109,43 +67,13 @@ static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
args
.
uri
=
uri
;
args
.
uri
=
uri
;
resolver
=
grpc_resolver_factory_create_resolver
(
factory
,
&
args
);
resolver
=
grpc_resolver_factory_create_resolver
(
factory
,
&
args
);
GPR_ASSERT
(
resolver
!=
NULL
);
GPR_ASSERT
(
resolver
!=
NULL
);
on_resolution_arg
on_res_arg
;
memset
(
&
on_res_arg
,
0
,
sizeof
(
on_res_arg
));
on_res_arg
.
expected_server_name
=
uri
->
path
;
grpc_closure
*
on_resolution
=
grpc_closure_create
(
on_resolution_cb
,
&
on_res_arg
);
grpc_resolver_next
(
&
exec_ctx
,
resolver
,
&
on_res_arg
.
resolver_result
,
on_resolution
);
GRPC_RESOLVER_UNREF
(
&
exec_ctx
,
resolver
,
"test_succeeds"
);
grpc_exec_ctx_finish
(
&
exec_ctx
);
grpc_uri_destroy
(
uri
);
}
static
void
test_succeeds_with_service_config
(
grpc_resolver_factory
*
factory
,
const
char
*
string
,
const
char
*
method_name
,
bool
wait_for_ready
,
gpr_timespec
timeout
,
int32_t
max_request_message_bytes
,
int32_t
max_response_message_bytes
)
{
grpc_exec_ctx
exec_ctx
=
GRPC_EXEC_CTX_INIT
;
grpc_uri
*
uri
=
grpc_uri_parse
(
string
,
0
);
grpc_resolver_args
args
;
grpc_resolver
*
resolver
;
gpr_log
(
GPR_DEBUG
,
"test: '%s' should be valid for '%s'"
,
string
,
factory
->
vtable
->
scheme
);
GPR_ASSERT
(
uri
);
memset
(
&
args
,
0
,
sizeof
(
args
));
args
.
uri
=
uri
;
resolver
=
grpc_resolver_factory_create_resolver
(
factory
,
&
args
);
GPR_ASSERT
(
resolver
!=
NULL
);
on_resolution_arg
on_res_arg
;
on_resolution_arg
on_res_arg
;
memset
(
&
on_res_arg
,
0
,
sizeof
(
on_res_arg
));
memset
(
&
on_res_arg
,
0
,
sizeof
(
on_res_arg
));
on_res_arg
.
expected_server_name
=
uri
->
path
;
on_res_arg
.
expected_server_name
=
uri
->
path
;
on_res_arg
.
expected_method_name
=
method_name
;
on_res_arg
.
expected_wait_for_ready
=
wait_for_ready
;
on_res_arg
.
expected_timeout
=
timeout
;
on_res_arg
.
expected_max_request_message_bytes
=
max_request_message_bytes
;
on_res_arg
.
expected_max_response_message_bytes
=
max_response_message_bytes
;
grpc_closure
*
on_resolution
=
grpc_closure
*
on_resolution
=
grpc_closure_create
(
on_resolution_cb
,
&
on_res_arg
);
grpc_closure_create
(
on_resolution_cb
,
&
on_res_arg
);
grpc_resolver_next
(
&
exec_ctx
,
resolver
,
&
on_res_arg
.
resolver_result
,
grpc_resolver_next
(
&
exec_ctx
,
resolver
,
&
on_res_arg
.
resolver_result
,
on_resolution
);
on_resolution
);
GRPC_RESOLVER_UNREF
(
&
exec_ctx
,
resolver
,
"test_succeeds"
);
GRPC_RESOLVER_UNREF
(
&
exec_ctx
,
resolver
,
"test_succeeds"
);
...
@@ -191,16 +119,6 @@ int main(int argc, char **argv) {
...
@@ -191,16 +119,6 @@ int main(int argc, char **argv) {
test_fails
(
ipv6
,
"ipv6:[::]:123456"
);
test_fails
(
ipv6
,
"ipv6:[::]:123456"
);
test_fails
(
ipv6
,
"ipv6:www.google.com"
);
test_fails
(
ipv6
,
"ipv6:www.google.com"
);
test_succeeds_with_service_config
(
ipv4
,
"ipv4:127.0.0.1:1234?method_name=/service/method"
"&wait_for_ready=1"
"&timeout_seconds=7"
"&max_request_message_bytes=456"
"&max_response_message_bytes=789"
,
"/service/method"
,
true
/* wait_for_ready */
,
(
gpr_timespec
){
7
,
0
,
GPR_CLOCK_MONOTONIC
},
456
,
789
);
grpc_resolver_factory_unref
(
ipv4
);
grpc_resolver_factory_unref
(
ipv4
);
grpc_resolver_factory_unref
(
ipv6
);
grpc_resolver_factory_unref
(
ipv6
);
grpc_shutdown
();
grpc_shutdown
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment