summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authorMichael Grunder <michael.grunder@gmail.com>2023-08-18 21:07:25 -0700
committerGitHub <noreply@github.com>2023-08-18 21:07:25 -0700
commit869f3d0ef1513dd0258ad7190c9914df16dcc4a4 (patch)
treeda35d90b552e3903035c6e2b417ca1127fe68136 /test.c
parent039385bd8b9192a3994d75e75e377933f17d1f47 (diff)
Make redisEnableKeepAlive a no-op on AF_UNIX connections. (#1215)
Fixes #1185
Diffstat (limited to 'test.c')
-rw-r--r--test.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test.c b/test.c
index 45914af..897daf8 100644
--- a/test.c
+++ b/test.c
@@ -431,6 +431,24 @@ static void test_tcp_options(struct config cfg) {
redisFree(c);
}
+static void test_unix_keepalive(struct config cfg) {
+ redisContext *c;
+ redisReply *r;
+
+ c = do_connect(cfg);
+
+ test("Setting TCP_KEEPALIVE on a unix socket returns an error: ");
+ test_cond(redisEnableKeepAlive(c) == REDIS_ERR && c->err == 0);
+
+ test("Setting TCP_KEEPALIVE on a unix socket doesn't break the connection: ");
+ r = redisCommand(c, "PING");
+ test_cond(r != NULL && r->type == REDIS_REPLY_STATUS && r->len == 4 &&
+ !memcmp(r->str, "PONG", 4));
+ freeReplyObject(r);
+
+ redisFree(c);
+}
+
static void test_reply_reader(void) {
redisReader *reader;
void *reply, *root;
@@ -2363,6 +2381,7 @@ int main(int argc, char **argv) {
test_blocking_connection_timeouts(cfg);
test_blocking_io_errors(cfg);
test_invalid_timeout_errors(cfg);
+ test_unix_keepalive(cfg);
if (throughput) test_throughput(cfg);
} else {
test_skipped();