diff options
author | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-11-22 10:31:57 +0100 |
---|---|---|
committer | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-11-22 10:32:37 +0100 |
commit | 537e64e94680b75826949af46e95f3507bdf66a8 (patch) | |
tree | 2f66c01c99d5b4ba83c217c6628181af9ed0acca | |
parent | 7c33f2666bd60a4bba1a67c155b11b757b043904 (diff) |
Tests for behavior when connecting fails
-rw-r--r-- | test.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -96,6 +96,18 @@ static void test_blocking_connection() { redisReply *reply; 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); test("Is able to deliver commands: "); reply = redisCommand(c,"PING"); |