Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
537e64e9
Commit
537e64e9
authored
Nov 22, 2010
by
Pieter Noordhuis
Browse files
Tests for behavior when connecting fails
parent
7c33f266
Changes
1
Hide whitespace changes
Inline
Side-by-side
test.c
View file @
537e64e9
...
@@ -96,6 +96,18 @@ static void test_blocking_connection() {
...
@@ -96,6 +96,18 @@ static void test_blocking_connection() {
redisReply
*
reply
;
redisReply
*
reply
;
int
major
,
minor
;
int
major
,
minor
;
test
(
"Returns error when host cannot be resolved: "
);
c
=
redisConnect
((
char
*
)
"idontexist.local"
,
6379
);
test_cond
(
c
->
err
==
REDIS_ERR_OTHER
&&
strcmp
(
c
->
errstr
,
"can't resolve: idontexist.local"
)
==
0
);
redisFree
(
c
);
test
(
"Returns error when the port is not open: "
);
c
=
redisConnect
((
char
*
)
"localhost"
,
56380
);
test_cond
(
c
->
err
==
REDIS_ERR_IO
&&
strcmp
(
c
->
errstr
,
"Connection refused"
)
==
0
);
redisFree
(
c
);
__connect
(
&
c
);
__connect
(
&
c
);
test
(
"Is able to deliver commands: "
);
test
(
"Is able to deliver commands: "
);
reply
=
redisCommand
(
c
,
"PING"
);
reply
=
redisCommand
(
c
,
"PING"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment