Commit Graph

96 Commits

Author SHA1 Message Date
Jan-Erik Rediger
8655a6ac7a test: Add regression test for sds argv formatting 2016-05-14 11:26:18 +02:00
not-a-robot
a91afd746b Auto merge of #379 - thomaslee:tom_test_race, r=badboy
Fix potential race in 'invalid timeout' tests

It's possible for the call to connect() to succeed on the very first try, in which case the logic for checking for invalid timeout fields is never executed. When this happens, the tests fail because they expect a REDIS_ERR_IO but no such failure has occurred.

Tests aside, this is a potential source of irritating and hard-to-find intermittent bugs.

This patch forces the validation to occur early so that we get predictable behavior whenever an invalid timeout is specified.
2016-04-20 17:42:04 +02:00
owent
6c53d6803a Add CI for Windows
- fix macro problem in mingw-gcc
- fix typedef in cygwin
2016-04-20 16:10:02 +02:00
Jerry Jacobs
8a5fdf0c9e test.c: Fix shadowed name with typedef when compiling with -Wshadow 2016-04-17 20:33:59 +00:00
Tom Lee
d4b715f0aa Fix potential race in 'invalid timeout' tests
It's possible for the call to connect() to succeed on the very first
try, in which case the logic for checking for invalid timeout fields is
never executed. When this happens, the tests fail because they expect a
REDIS_ERR_IO but no such failure has occurred.

Tests aside, this is a potential source of irritating and hard-to-find
intermittent bugs.

This patch forces the validation to occur early so that we get
predictable behavior whenever an invalid timeout is specified.
2015-11-18 00:36:29 -08:00
olgeni
3d4b5c29ba Add FreeBSD message to test_blocking_connection_errors. 2015-09-16 12:24:03 +02:00
Jan-Erik Rediger
d9e0b0f6ab Implement a reconnect method for the client context
Originally implemented by @abedra as part of #306.

In case a write or read times out, we force an error state, because we
can't guarantuee that the next read will get the right data.
Instead we need to reconnect to have a clean-state connection, which is
now easily possible with this method.
2015-04-16 21:00:30 +02:00
Jan-Erik Rediger
b872919463 Make this work on Redis 3.0 2015-04-16 18:24:50 +02:00
Matt Stancliff
27076a3e6d Fix tests when assert() undefined
Closes #309

(such as when -DNDEBUG disables all assert() macros)

Inspired by keith-bennett-gbg, but re-rewritten to be more concise.
2015-02-18 14:45:03 -05:00
Matt Stancliff
3c023ee157 Cleanup memory during test 2015-01-22 16:00:38 -05:00
Matt Stancliff
802456def1 Use known-bad hostname when testing hostname fail
Suggested at
https://github.com/redis/hiredis/issues/294#issuecomment-69153074

This change also makes the test stop hanging for 10 to 30 seconds
waiting for the resolver to timeout.  Now the resolver immediately
sees the hostname is bad and returns error without waiting for timeout.
2015-01-08 17:28:55 -05:00
Matt Stancliff
c642079a80 Update test error message detection for dead hosts
Fixes #294
2015-01-08 17:26:22 -05:00
Daniel Melani
21a1207ae1 Add tests for redisFree() and freeReplyObject()
Test that redisFree() and freeReplyObject() do not crash when NULL is
passed in.
2014-05-29 17:10:03 +02:00
Axel Etcheverry
66192a0052 Add new redisAppendFormatedCommand with tests
Closes #202
2014-04-09 17:02:42 -04:00
ripcurld00d
303a0421ef Fix "host cannot be resolved test" test
Closes #186
2014-04-09 17:02:42 -04:00
Eddy Jansson
ae30d58ff9 Add redisConnectFd() and redisFreeKeepFd()
These allows for easier integration of hiredis with external
code that wants to manage its fds, say for instance in a pool.

Closes #223
2014-04-09 17:02:42 -04:00
Wolfgang Richter
37a840dc2c Emphasize size_t length for %b formatting
Closes #121.
2013-07-10 23:05:39 -07:00
Pieter Noordhuis
49de2cf990 Fix DNS error test (fixes #167) 2013-07-10 21:58:10 -07:00
Pieter Noordhuis
94675ea8c8 Merge branch 'gai_strerror'
See pull request #153.
2013-05-01 09:32:10 -07:00
Pieter Noordhuis
b1f07f77d2 Fix style 2013-05-01 09:32:03 -07:00
Aaron Bedra
fca66b9e8b Set error when invalid timeout value is given to redisConnectWithTimeout
Closes #154

This commit properly sets the error value inside of
redisContextWaitReady when an invalid sec or usec value is provided.
Tests for each case are provided to demonstrate that the issue is
properly fixed and to avoid regression.

Signed-off-by: Aaron Bedra <aaron@aaronbedra.com>
2013-03-14 21:34:21 -05:00
Thordur Bjornsson
e5589afdec Fix tests for test_blocking_connection_errors();
Add strings to allow OpenBSD/OSX to pass.
2013-02-23 10:51:24 +01:00
Henri Doreau
814be4f5bd Made connect functions return NULL on alloc failures.
Updated documentation and examples accordingly.
2013-01-22 10:19:46 +01:00
Pieter Noordhuis
05d0608ab9 Test new maximum depth of multi-bulk replies 2012-08-27 23:47:42 -07:00
Chip Salzenberg
1d5e27f6d7 more error messages 2011-12-20 10:05:57 -08:00
mrb
52a29a124b increase read depth by one, would allow ruby redis client to read from slowlog 2011-12-02 08:45:13 -05:00
Pieter Noordhuis
b52193977e Colorize test outcome 2011-07-10 17:36:07 +02:00
Pieter Noordhuis
dad240f0a3 Test all supported types for printf-like formatting 2011-07-10 17:25:55 +02:00
Pieter Noordhuis
2da784ce8f Abort on invalid format
There is no way we can guess the width of the argument when we cannot
infer its type from the format specifier.
2011-07-09 15:08:45 +02:00
Pieter Noordhuis
4ac55be9b5 Update printf-formatting tests to fail 2011-07-09 15:08:45 +02:00
Pieter Noordhuis
375ba48eea Revert "Add function to retrieve formatted reply"
This reverts commit 77540aa316. The change
in buffer strategy is too large to put in a minor release. It is put in
a separate branch in the meantime, so it can be refined and released
together with a minor version bump.
2011-06-19 13:41:25 +02:00
Pieter Noordhuis
367ac44ac1 Remove private feature macros for Solaris from compiler flags 2011-06-18 16:28:57 +02:00
Pieter Noordhuis
e0d5c71277 Fix compiler warnings 2011-06-18 12:29:49 +02:00
Pieter Noordhuis
5f5b3d9787 Fix for issue #45 2011-06-09 09:25:09 +02:00
Pieter Noordhuis
159a83ab8a Flag to disable throughput tests 2011-06-09 09:16:31 +02:00
Pieter Noordhuis
7a8de1fe25 Exit with a non-zero status when tests failed 2011-05-29 10:03:39 -07:00
Pieter Noordhuis
9723a4fc46 More control over host/port and unix path in test.c 2011-05-22 16:26:04 +02:00
Piotr Sikora
5793b999a9 Add "make check" target (useful for automated tests).
While there, add "-p" option to "hiredis-test", so that we could run
tests without interrupting Redis instance running on the default port.
2011-05-22 15:24:11 +02:00
Pieter Noordhuis
77540aa316 Add function to retrieve formatted reply
This is done by only truncating the read buffer once a full reply has
been read. The buffer is no longer truncated halfway through reading a
reply. In addition: pass offset/length of protocol and content via the
read tasks.
2011-05-05 17:01:34 +02:00
Pieter Noordhuis
19709152f2 Reflect rename in tests 2011-04-21 16:03:54 +02:00
Pieter Noordhuis
6d207ea98e Create protocol reader when creating context 2011-04-21 15:04:42 +02:00
Pieter Noordhuis
fc790ebea6 State should not be reset after protocol error 2011-04-21 10:54:54 +02:00
Pieter Noordhuis
178024244d Use variable for throughput test iteration count 2011-04-19 23:03:29 +02:00
Pieter Noordhuis
b4f85484ea Add pipelined throughput tests 2011-03-31 12:41:46 +02:00
Pieter Noordhuis
8e2c39200d Fix formatCommand to work with all empty interpolations 2011-03-06 11:38:07 +01:00
Pieter Noordhuis
663d6d1258 Properly reset state after protocol error in reply reader 2011-01-27 14:39:34 +01:00
Pieter Noordhuis
fbe756d838 Avoid warnings with -Wstrict-prototypes 2011-01-27 12:50:55 +01:00
Pieter Noordhuis
43ab0f8018 Return error on socket timeout for a blocking context 2011-01-07 13:04:42 +01:00
Pieter Noordhuis
7684d556bd Add (nearly) full printf support by delegating to vsprintf 2010-12-02 16:20:55 +01:00
Pieter Noordhuis
257a9d40a9 Set error on unexpected nesting of multi bulks 2010-11-24 15:46:05 +01:00