summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authorMichael Grunder <michael.grunder@gmail.com>2023-06-01 09:09:11 -0700
committerGitHub <noreply@github.com>2023-06-01 09:09:11 -0700
commitded32c7d1a449a94b0241270342cb75696c64224 (patch)
tree965e55f5189b3e106774438bae6a6f928adb123a /test.c
parent5cbd1f2960662c18b1d2b2dac7352f2b5b1ba776 (diff)
Add a test for the TCP_USER_TIMEOUT option. (#1192)
* Add a test for the TCP_USER_TIMEOUT option. * Explicitly set errno to ENOTSUP on unsupported OS's
Diffstat (limited to 'test.c')
-rw-r--r--test.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/test.c b/test.c
index a9afe90..e3d808d 100644
--- a/test.c
+++ b/test.c
@@ -409,10 +409,19 @@ static void test_tcp_options(struct config cfg) {
redisContext *c;
c = do_connect(cfg);
+
test("We can enable TCP_KEEPALIVE: ");
test_cond(redisEnableKeepAlive(c) == REDIS_OK);
- disconnect(c, 0);
+#ifdef TCP_USER_TIMEOUT
+ test("We can set TCP_USER_TIMEOUT: ");
+ test_cond(redisSetTcpUserTimeout(c, 100) == REDIS_OK);
+#else
+ test("Setting TCP_USER_TIMEOUT errors when unsupported: ");
+ test_cond(redisSetTcpUserTimeout(c, 100) == REDIS_ERR && c->err == REDIS_ERR_IO);
+#endif
+
+ redisFree(c);
}
static void test_reply_reader(void) {