File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -29,31 +29,37 @@ if {[catch {cd tests/sentinel-tmp}]} {
29
29
}
30
30
31
31
# Spawn a redis or sentinel instance, depending on 'type'.
32
- proc spawn_instance {type base_port count} {
32
+ proc spawn_instance {type base_port count {conf {}} } {
33
33
for {set j 0} {$j < $count } {incr j} {
34
34
set port [find_available_port $base_port ]
35
35
incr base_port
36
36
puts " Starting $type #$j at port $port "
37
37
38
- # Create a directory for this Sentinel .
38
+ # Create a directory for this instance .
39
39
set dirname " ${type} _${j} "
40
40
lappend ::dirs $dirname
41
41
catch {exec rm -rf $dirname }
42
42
file mkdir $dirname
43
43
44
- # Write the Sentinel config file.
44
+ # Write the instance config file.
45
45
set cfgfile [file join $dirname $type .conf]
46
46
set cfg [open $cfgfile w]
47
47
puts $cfg " port $port "
48
48
puts $cfg " dir ./$dirname "
49
49
puts $cfg " logfile log.txt"
50
+ # Add additional config files
51
+ foreach directive $conf {
52
+ puts $cfg $directive
53
+ }
50
54
close $cfg
51
55
52
56
# Finally exec it and remember the pid for later cleanup.
53
57
if {$type eq " redis" } {
54
58
set prgname redis-server
55
- } else {
59
+ } elseif { $type eq " sentinel " } {
56
60
set prgname redis-sentinel
61
+ } else {
62
+ error " Unknown instance type."
57
63
}
58
64
set pid [exec ../../src/${prgname} $cfgfile &]
59
65
lappend ::pids $pid
You can’t perform that action at this time.
0 commit comments