diff options
author | antirez <antirez@gmail.com> | 2014-06-30 12:07:26 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-06-30 12:11:22 +0200 |
commit | 05b6b147ecd4844dcbefc67d672f18c2bf2f5938 (patch) | |
tree | 24cce10a5d01d99ee841bef30abacfb5f42fa582 | |
parent | a5aa3b649165db867823e8a4510915826b5ba50d (diff) | |
download | redis-05b6b147ecd4844dcbefc67d672f18c2bf2f5938.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.tcl | 10 |
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} { |