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
2c73b228
Commit
2c73b228
authored
9 years ago
by
David Garcia Quintas
Browse files
Options
Downloads
Patches
Plain Diff
Small test improvements to lb_policies and sockaddr_resolver tests
parent
f1050f6f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/core/client_config/lb_policies_test.c
+14
-12
14 additions, 12 deletions
test/core/client_config/lb_policies_test.c
test/core/client_config/resolvers/sockaddr_resolver_test.c
+2
-1
2 additions, 1 deletion
test/core/client_config/resolvers/sockaddr_resolver_test.c
with
16 additions
and
13 deletions
test/core/client_config/lb_policies_test.c
+
14
−
12
View file @
2c73b228
...
@@ -500,6 +500,7 @@ void run_spec(const test_spec *spec) {
...
@@ -500,6 +500,7 @@ void run_spec(const test_spec *spec) {
gpr_malloc
(
sizeof
(
grpc_call_details
)
*
spec
->
num_servers
);
gpr_malloc
(
sizeof
(
grpc_call_details
)
*
spec
->
num_servers
);
f
=
setup_servers
(
"127.0.0.1"
,
&
rdata
,
spec
->
num_servers
);
f
=
setup_servers
(
"127.0.0.1"
,
&
rdata
,
spec
->
num_servers
);
grpc_lb_round_robin_trace
=
1
;
/* Create client. */
/* Create client. */
servers_hostports_str
=
gpr_strjoin_sep
((
const
char
**
)
f
->
servers_hostports
,
servers_hostports_str
=
gpr_strjoin_sep
((
const
char
**
)
f
->
servers_hostports
,
f
->
num_servers
,
","
,
NULL
);
f
->
num_servers
,
","
,
NULL
);
...
@@ -530,7 +531,8 @@ void run_spec(const test_spec *spec) {
...
@@ -530,7 +531,8 @@ void run_spec(const test_spec *spec) {
teardown_servers
(
f
);
teardown_servers
(
f
);
}
}
static
grpc_channel
*
create_client
(
const
servers_fixture
*
f
)
{
static
grpc_channel
*
create_client
(
const
servers_fixture
*
f
,
const
char
*
uri_query_str
)
{
grpc_channel
*
client
;
grpc_channel
*
client
;
char
*
client_hostport
;
char
*
client_hostport
;
char
*
servers_hostports_str
;
char
*
servers_hostports_str
;
...
@@ -539,8 +541,8 @@ static grpc_channel *create_client(const servers_fixture *f) {
...
@@ -539,8 +541,8 @@ static grpc_channel *create_client(const servers_fixture *f) {
servers_hostports_str
=
gpr_strjoin_sep
((
const
char
**
)
f
->
servers_hostports
,
servers_hostports_str
=
gpr_strjoin_sep
((
const
char
**
)
f
->
servers_hostports
,
f
->
num_servers
,
","
,
NULL
);
f
->
num_servers
,
","
,
NULL
);
gpr_asprintf
(
&
client_hostport
,
"ipv4:%s?
lb_policy=round_robin"
,
gpr_asprintf
(
&
client_hostport
,
"ipv4:%s?
%s"
,
servers_hostports_str
,
servers_hostports
_str
);
uri_query
_str
);
arg
.
type
=
GRPC_ARG_INTEGER
;
arg
.
type
=
GRPC_ARG_INTEGER
;
arg
.
key
=
"grpc.testing.fixed_reconnect_backoff"
;
arg
.
key
=
"grpc.testing.fixed_reconnect_backoff"
;
...
@@ -568,7 +570,7 @@ static void test_ping() {
...
@@ -568,7 +570,7 @@ static void test_ping() {
f
=
setup_servers
(
"127.0.0.1"
,
&
rdata
,
num_servers
);
f
=
setup_servers
(
"127.0.0.1"
,
&
rdata
,
num_servers
);
cqv
=
cq_verifier_create
(
f
->
cq
);
cqv
=
cq_verifier_create
(
f
->
cq
);
client
=
create_client
(
f
);
client
=
create_client
(
f
,
""
);
grpc_channel_ping
(
client
,
f
->
cq
,
tag
(
0
),
NULL
);
grpc_channel_ping
(
client
,
f
->
cq
,
tag
(
0
),
NULL
);
cq_expect_completion
(
cqv
,
tag
(
0
),
0
);
cq_expect_completion
(
cqv
,
tag
(
0
),
0
);
...
@@ -613,7 +615,7 @@ static void test_pending_calls(size_t concurrent_calls) {
...
@@ -613,7 +615,7 @@ static void test_pending_calls(size_t concurrent_calls) {
gpr_malloc
(
sizeof
(
grpc_call_details
)
*
spec
->
num_servers
);
gpr_malloc
(
sizeof
(
grpc_call_details
)
*
spec
->
num_servers
);
f
=
setup_servers
(
"127.0.0.1"
,
&
rdata
,
spec
->
num_servers
);
f
=
setup_servers
(
"127.0.0.1"
,
&
rdata
,
spec
->
num_servers
);
client
=
create_client
(
f
);
client
=
create_client
(
f
,
""
);
calls
=
perform_multirequest
(
f
,
client
,
concurrent_calls
);
calls
=
perform_multirequest
(
f
,
client
,
concurrent_calls
);
grpc_call_cancel
(
grpc_call_cancel
(
calls
[
0
],
calls
[
0
],
...
@@ -870,21 +872,21 @@ static void verify_rebirth_round_robin(const servers_fixture *f,
...
@@ -870,21 +872,21 @@ static void verify_rebirth_round_robin(const servers_fixture *f,
}
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
test_spec
*
spec
;
size_t
i
;
const
size_t
NUM_ITERS
=
10
;
const
size_t
NUM_SERVERS
=
4
;
grpc_test_init
(
argc
,
argv
);
grpc_test_init
(
argc
,
argv
);
grpc_init
();
grpc_init
();
grpc_lb_round_robin_trace
=
1
;
GPR_ASSERT
(
grpc_lb_policy_create
(
"this-lb-policy-does-not-exist"
,
NULL
)
==
GPR_ASSERT
(
grpc_lb_policy_create
(
"this-lb-policy-does-not-exist"
,
NULL
)
==
NULL
);
NULL
);
GPR_ASSERT
(
grpc_lb_policy_create
(
NULL
,
NULL
)
==
NULL
);
GPR_ASSERT
(
grpc_lb_policy_create
(
NULL
,
NULL
)
==
NULL
);
test_spec
*
spec
;
size_t
i
;
const
size_t
NUM_ITERS
=
10
;
const
size_t
NUM_SERVERS
=
4
;
spec
=
test_spec_create
(
NUM_ITERS
,
NUM_SERVERS
);
spec
=
test_spec_create
(
NUM_ITERS
,
NUM_SERVERS
);
/* everything is fine, all servers stay up the whole time and life's peachy */
/* everything is fine, all servers stay up the whole time and life's peachy
*/
spec
->
verifier
=
verify_vanilla_round_robin
;
spec
->
verifier
=
verify_vanilla_round_robin
;
spec
->
description
=
"test_all_server_up"
;
spec
->
description
=
"test_all_server_up"
;
run_spec
(
spec
);
run_spec
(
spec
);
...
...
This diff is collapsed.
Click to expand it.
test/core/client_config/resolvers/sockaddr_resolver_test.c
+
2
−
1
View file @
2c73b228
/*
/*
*
*
* Copyright 2015, Google Inc.
* Copyright 2015
-2016
, Google Inc.
* All rights reserved.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
...
@@ -98,6 +98,7 @@ int main(int argc, char **argv) {
...
@@ -98,6 +98,7 @@ int main(int argc, char **argv) {
test_fails
(
ipv4
,
"ipv4:10.2.1.1"
);
test_fails
(
ipv4
,
"ipv4:10.2.1.1"
);
test_succeeds
(
ipv4
,
"ipv4:10.2.1.1:1234"
);
test_succeeds
(
ipv4
,
"ipv4:10.2.1.1:1234"
);
test_succeeds
(
ipv4
,
"ipv4:10.2.1.1:1234,127.0.0.1:4321"
);
test_fails
(
ipv4
,
"ipv4:10.2.1.1:123456"
);
test_fails
(
ipv4
,
"ipv4:10.2.1.1:123456"
);
test_fails
(
ipv4
,
"ipv4:www.google.com"
);
test_fails
(
ipv4
,
"ipv4:www.google.com"
);
test_fails
(
ipv4
,
"ipv4:["
);
test_fails
(
ipv4
,
"ipv4:["
);
...
...
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