summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authorArseniy Simonov <harvos.arsen@gmail.com>2021-10-03 15:06:40 +0000
committerMichael Grunder <michael.grunder@gmail.com>2022-08-29 16:22:20 -0700
commit75cb6c1ea6054db7cc71c05181c30d1c439867b7 (patch)
tree8139d4ce098e59ea2ead1de13a767265b8b50b89 /test.c
parentc57cad658d43973bc1f0609649ef90b104262d75 (diff)
Do store command timeout in the context for redisSetTimeout (#593)
Diffstat (limited to 'test.c')
-rw-r--r--test.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/test.c b/test.c
index e7582d7..19228bc 100644
--- a/test.c
+++ b/test.c
@@ -1156,7 +1156,13 @@ static void test_blocking_connection_timeouts(struct config config) {
test("Does not return a reply when the command times out: ");
if (detect_debug_sleep(c)) {
redisAppendFormattedCommand(c, sleep_cmd, strlen(sleep_cmd));
+
+ // flush connection buffer without waiting for the reply
s = c->funcs->write(c);
+ assert(s == (ssize_t)sdslen(c->obuf));
+ sdsfree(c->obuf);
+ c->obuf = sdsempty();
+
tv.tv_sec = 0;
tv.tv_usec = 10000;
redisSetTimeout(c, tv);
@@ -1169,6 +1175,9 @@ static void test_blocking_connection_timeouts(struct config config) {
strcmp(c->errstr, "recv timeout") == 0);
#endif
freeReplyObject(reply);
+
+ // wait for the DEBUG SLEEP to complete so that Redis server is unblocked for the following tests
+ sleep(3);
} else {
test_skipped();
}