summaryrefslogtreecommitdiff
path: root/tests/support
diff options
context:
space:
mode:
authorYossi Gottlieb <yossigo@gmail.com>2021-06-22 12:50:17 +0300
committerGitHub <noreply@github.com>2021-06-22 12:50:17 +0300
commit07b0d144cee7e3ef0ed34fbf046c418d66099cea (patch)
treed5d686af6556925793fcf673b5aa747badc9ae99 /tests/support
parent1ccf2ca2f475a161b8ca0c574d4c0e6ef9ecf754 (diff)
downloadredis-07b0d144cee7e3ef0ed34fbf046c418d66099cea.tar.gz
Improve bind and protected-mode config handling. (#9034)
* Specifying an empty `bind ""` configuration prevents Redis from listening on any TCP port. Before this commit, such configuration was not accepted. * Using `CONFIG GET bind` will always return an explicit configuration value. Before this commit, if a bind address was not specified the returned value was empty (which was an anomaly). Another behavior change is that modifying the `bind` configuration to a non-default value will NO LONGER DISABLE protected-mode implicitly.
Diffstat (limited to 'tests/support')
-rw-r--r--tests/support/cli.tcl17
-rw-r--r--tests/support/server.tcl6
2 files changed, 21 insertions, 2 deletions
diff --git a/tests/support/cli.tcl b/tests/support/cli.tcl
index 19e306e24..a080823eb 100644
--- a/tests/support/cli.tcl
+++ b/tests/support/cli.tcl
@@ -11,9 +11,26 @@ proc rediscli_tls_config {testsdir} {
}
}
+# Returns command line for executing redis-cli
proc rediscli {host port {opts {}}} {
set cmd [list src/redis-cli -h $host -p $port]
lappend cmd {*}[rediscli_tls_config "tests"]
lappend cmd {*}$opts
return $cmd
}
+
+# Returns command line for executing redis-cli with a unix socket address
+proc rediscli_unixsocket {unixsocket {opts {}}} {
+ return [list src/redis-cli -s $unixsocket {*}$opts]
+}
+
+# Run redis-cli with specified args on the server of specified level.
+# Returns output broken down into individual lines.
+proc rediscli_exec {level args} {
+ set cmd [rediscli_unixsocket [srv $level unixsocket] $args]
+ set fd [open "|$cmd" "r"]
+ set ret [lrange [split [read $fd] "\n"] 0 end-1]
+ close $fd
+
+ return $ret
+}
diff --git a/tests/support/server.tcl b/tests/support/server.tcl
index 54b0e4ed0..39a0dd065 100644
--- a/tests/support/server.tcl
+++ b/tests/support/server.tcl
@@ -626,7 +626,7 @@ proc start_server {options {code undefined}} {
}
}
-proc restart_server {level wait_ready rotate_logs} {
+proc restart_server {level wait_ready rotate_logs {reconnect 1}} {
set srv [lindex $::servers end+$level]
kill_server $srv
@@ -668,5 +668,7 @@ proc restart_server {level wait_ready rotate_logs} {
after 10
}
}
- reconnect $level
+ if {$reconnect} {
+ reconnect $level
+ }
}