summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-06-30 12:07:26 +0200
committerantirez <antirez@gmail.com>2014-06-30 12:08:24 +0200
commit54157bc49ebf7b49a1d2a95c7b09b4e3ce56e2a6 (patch)
tree251f7e2e5deae29405e2f7e8a3df155e40ca36ce
parent612bc784fca7ca83d6267a5d407daee9d5996b89 (diff)
downloadredis-54157bc49ebf7b49a1d2a95c7b09b4e3ce56e2a6.tar.gz
Test: find_available_port: check that cluster port is free as well.
The function will only return ports that have also port+10000 free, so that Redis Cluster instances can be executed at the returned port.
-rw-r--r--tests/support/util.tcl10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/support/util.tcl b/tests/support/util.tcl
index e49ea229c..8ef6e1bc0 100644
--- a/tests/support/util.tcl
+++ b/tests/support/util.tcl
@@ -315,12 +315,14 @@ proc roundFloat f {
proc find_available_port start {
for {set j $start} {$j < $start+1024} {incr j} {
- if {[catch {
- set fd [socket 127.0.0.1 $j]
- }]} {
+ if {[catch {set fd1 [socket 127.0.0.1 $j]}] &&
+ [catch {set fd2 [socket 127.0.0.1 [expr $j+10000]]}]} {
return $j
} else {
- close $fd
+ catch {
+ close $fd1
+ close $fd2
+ }
}
}
if {$j == $start+1024} {