|
1 | 1 | require 'rubygems'
|
2 | 2 |
|
3 |
| -dir = File.dirname(File.expand_path(__FILE__)) |
4 |
| -$LOAD_PATH.unshift dir + '/../lib' |
| 3 | +$dir = File.dirname(File.expand_path(__FILE__)) |
| 4 | +$LOAD_PATH.unshift $dir + '/../lib' |
5 | 5 | $TESTING = true
|
6 | 6 | require 'test/unit'
|
7 | 7 |
|
|
42 | 42 | processes = `ps -A -o pid,command | grep [r]edis-test`.split("\n")
|
43 | 43 | pids = processes.map { |process| process.split(" ")[0] }
|
44 | 44 | puts "Killing test redis server..."
|
45 |
| - `rm -f #{dir}/dump.rdb #{dir}/dump-cluster.rdb` |
46 |
| - pids.each { |pid| Process.kill("KILL", pid.to_i) } |
| 45 | + pids.each { |pid| Process.kill("TERM", pid.to_i) } |
| 46 | + system("rm -f #{$dir}/dump.rdb #{$dir}/dump-cluster.rdb") |
47 | 47 | exit exit_code
|
48 | 48 | end
|
49 | 49 |
|
50 | 50 | if ENV.key? 'RESQUE_DISTRIBUTED'
|
51 | 51 | require 'redis/distributed'
|
52 | 52 | puts "Starting redis for testing at localhost:9736 and localhost:9737..."
|
53 |
| - `redis-server #{dir}/redis-test.conf` |
54 |
| - `redis-server #{dir}/redis-test-cluster.conf` |
| 53 | + `redis-server #{$dir}/redis-test.conf` |
| 54 | + `redis-server #{$dir}/redis-test-cluster.conf` |
55 | 55 | r = Redis::Distributed.new(['redis://localhost:9736', 'redis://localhost:9737'])
|
56 | 56 | Resque.redis = Redis::Namespace.new :resque, :redis => r
|
57 | 57 | else
|
58 | 58 | puts "Starting redis for testing at localhost:9736..."
|
59 |
| - `redis-server #{dir}/redis-test.conf` |
| 59 | + `redis-server #{$dir}/redis-test.conf` |
60 | 60 | Resque.redis = 'localhost:9736'
|
61 | 61 | end
|
62 | 62 |
|
|
0 commit comments