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
0c63e3f3
Commit
0c63e3f3
authored
Aug 12, 2024
by
michael-grunder
Committed by
Michael Grunder
Aug 13, 2024
Browse files
Fix timing based macOS CI failure.
Signed-off-by:
michael-grunder
<
michael.grunder@gmail.com
>
parent
45b7820d
Changes
1
Hide whitespace changes
Inline
Side-by-side
test.c
View file @
0c63e3f3
...
@@ -1276,15 +1276,13 @@ static void test_blocking_connection_timeouts(struct config config) {
...
@@ -1276,15 +1276,13 @@ static void test_blocking_connection_timeouts(struct config config) {
redisContext *c;
redisContext *c;
redisReply *reply;
redisReply *reply;
ssize_t s;
ssize_t s;
const char *sleep_cmd = "DEBUG SLEEP
3
\r\n";
const char *sleep_cmd = "DEBUG SLEEP
1
\r\n";
struct timeval tv;
struct timeval tv
= {.tv_sec = 0, .tv_usec = 10000}
;
c = do_connect(config);
c = do_connect(config);
test("Successfully completes a command when the timeout is not exceeded: ");
test("Successfully completes a command when the timeout is not exceeded: ");
reply = redisCommand(c,"SET foo fast");
reply = redisCommand(c,"SET foo fast");
freeReplyObject(reply);
freeReplyObject(reply);
tv.tv_sec = 0;
tv.tv_usec = 10000;
redisSetTimeout(c, tv);
redisSetTimeout(c, tv);
reply = redisCommand(c, "GET foo");
reply = redisCommand(c, "GET foo");
test_cond(reply != NULL && reply->type == REDIS_REPLY_STRING && memcmp(reply->str, "fast", 4) == 0);
test_cond(reply != NULL && reply->type == REDIS_REPLY_STRING && memcmp(reply->str, "fast", 4) == 0);
...
@@ -1302,8 +1300,6 @@ static void test_blocking_connection_timeouts(struct config config) {
...
@@ -1302,8 +1300,6 @@ static void test_blocking_connection_timeouts(struct config config) {
sdsfree(c->obuf);
sdsfree(c->obuf);
c->obuf = sdsempty();
c->obuf = sdsempty();
tv.tv_sec = 0;
tv.tv_usec = 10000;
redisSetTimeout(c, tv);
redisSetTimeout(c, tv);
reply = redisCommand(c, "GET foo");
reply = redisCommand(c, "GET foo");
#ifndef _WIN32
#ifndef _WIN32
...
@@ -1316,7 +1312,7 @@ static void test_blocking_connection_timeouts(struct config config) {
...
@@ -1316,7 +1312,7 @@ static void test_blocking_connection_timeouts(struct config config) {
freeReplyObject(reply);
freeReplyObject(reply);
// wait for the DEBUG SLEEP to complete so that Redis server is unblocked for the following tests
// wait for the DEBUG SLEEP to complete so that Redis server is unblocked for the following tests
millisleep(
30
00);
millisleep(
11
00);
} else {
} else {
test_skipped();
test_skipped();
}
}
...
...
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