Skip to content

Commit 4e0149a

Browse files
Fix new benchmark test under the TLS (#1710)
We need to call cliSecureConnection if we are runing under the TLS, otherwise the connection can not be use. Signed-off-by: Binbin <[email protected]> Co-authored-by: Viktor Söderqvist <[email protected]>
1 parent 8fc37a0 commit 4e0149a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/valkey-benchmark.c

+10-2
Original file line numberDiff line numberDiff line change
@@ -2023,8 +2023,16 @@ int main(int argc, char **argv) {
20232023
char *ip = config.conn_info.hostip;
20242024
int port = config.conn_info.hostport;
20252025
redisContext *conn = redisConnect(ip, port);
2026-
assert(conn != NULL && conn->err == 0);
2027-
void *reply = redisCommand(conn, "FUNCTION LOAD REPLACE %s", script);
2026+
assert(conn != NULL);
2027+
if (config.tls == 1) {
2028+
const char *err = NULL;
2029+
if (cliSecureConnection(conn, config.sslconfig, &err) == REDIS_ERR && err) {
2030+
fprintf(stderr, "Could not negotiate a TLS connection: %s\n", err);
2031+
}
2032+
assert(err == NULL);
2033+
}
2034+
assert(conn->err == 0);
2035+
redisReply *reply = redisCommand(conn, "FUNCTION LOAD REPLACE %s", script);
20282036
assert(reply != NULL);
20292037
freeReplyObject(reply);
20302038
redisFree(conn);

tests/integration/valkey-benchmark.tcl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ proc common_bench_setup {cmd} {
1111
r flushall
1212
if {[catch { exec {*}$cmd } error]} {
1313
set first_line [lindex [split $error "\n"] 0]
14-
puts [colorstr red "valkey-benchmark non zero code. first line: $first_line"]
14+
puts [colorstr red "valkey-benchmark non zero code, the output is: $error"]
1515
fail "valkey-benchmark non zero code. first line: $first_line"
1616
}
1717
}

0 commit comments

Comments
 (0)