Use correct redis for beetle_handler in features again
MODIFY
features/redis_auto_failover.feature
features/redis_auto_failover.feature
@@ -27,7 +27,7 @@ Feature: Redis auto failover
Scenario: Successful single redis master switch with multiple failover sets
Given a redis server "redis-3" exists as master
And a redis server "redis-4" exists as slave of "redis-3"
- Given a redis configuration server using redis servers "a/redis-1,redis-2;b/redis-3,redis-4" with clients "rc-client-1,rc-client-2" exists
+ Given a redis configuration server using redis servers "system/redis-1,redis-2;system2/redis-3,redis-4" with clients "rc-client-1,rc-client-2" exists
And a redis configuration client "rc-client-1" using redis servers "redis-1,redis-2" exists
And a redis configuration client "rc-client-2" using redis servers "redis-1,redis-2" exists
And a beetle handler using the redis-master file from "rc-client-1" exists
@@ -37,10 +37,10 @@ Feature: Redis auto failover
And the role of redis server "redis-2" should be "master"
And the redis master file of the redis configuration server should contain "redis-2"
And the redis master file of the redis configuration server should contain "redis-3"
- And the redis master of "rc-client-1" in system "a" should be "redis-2"
- And the redis master of "rc-client-2" in system "a" should be "redis-2"
- And the redis master of "rc-client-1" in system "b" should be "redis-3"
- And the redis master of "rc-client-2" in system "b" should be "redis-3"
+ And the redis master of "rc-client-1" in system "system" should be "redis-2"
+ And the redis master of "rc-client-2" in system "system" should be "redis-2"
+ And the redis master of "rc-client-1" in system "system2" should be "redis-3"
+ And the redis master of "rc-client-2" in system "system2" should be "redis-3"
And the redis master of the beetle handler should be "redis-2"
And a system notification for switching from "redis-1" to "redis-2" should be sent
Given a redis server "redis-1" exists as master
@@ -49,7 +49,7 @@ Feature: Redis auto failover
Scenario: Successful double redis master switch with multiple failover sets
Given a redis server "redis-3" exists as master
And a redis server "redis-4" exists as slave of "redis-3"
- Given a redis configuration server using redis servers "a/redis-1,redis-2;b/redis-3,redis-4" with clients "rc-client-1,rc-client-2" exists
+ Given a redis configuration server using redis servers "system/redis-1,redis-2;b/redis-3,redis-4" with clients "rc-client-1,rc-client-2" exists
And a redis configuration client "rc-client-1" using redis servers "redis-1,redis-2" exists
And a redis configuration client "rc-client-2" using redis servers "redis-1,redis-2" exists
And a beetle handler using the redis-master file from "rc-client-1" exists
@@ -60,10 +60,10 @@ Feature: Redis auto failover
And the role of redis server "redis-4" should be "master"
And the redis master file of the redis configuration server should contain "redis-2"
And the redis master file of the redis configuration server should contain "redis-4"
- And the redis master of "rc-client-1" in system "a" should be "redis-2"
- And the redis master of "rc-client-2" in system "a" should be "redis-2"
- And the redis master of "rc-client-1" in system "b" should be "redis-4"
- And the redis master of "rc-client-2" in system "b" should be "redis-4"
+ And the redis master of "rc-client-1" in system "system" should be "redis-2"
+ And the redis master of "rc-client-2" in system "system" should be "redis-2"
+ And the redis master of "rc-client-1" in system "system2" should be "redis-4"
+ And the redis master of "rc-client-2" in system "system2" should be "redis-4"
And the redis master of the beetle handler should be "redis-2"
Given a redis server "redis-1" exists as master
Then the role of redis server "redis-1" should be "slave"

MODIFY
features/support/beetle_handler
features/support/beetle_handler
@@ -8,19 +8,16 @@ require File.expand_path("../../lib/beetle", File.dirname(__FILE__))
tmp_path = File.expand_path("../../tmp", File.dirname(__FILE__))
-$redis_master_file_path = ""
-
Daemons.run_proc("beetle_handler", :log_output => true, :dir_mode => :normal, :dir => tmp_path) do
opts = OptionParser.new
- opts.on("-f", "--redis-master-file PATH", String) do |val|
- $redis_master_file_path = val
+ opts.on("-f", "--redis-master-file path", String) do |val|
+ Beetle.config.redis_server = val
end
opts.parse!(ARGV - ["start", "--"])
Beetle.config.servers = "127.0.0.1:5672" # rabbitmq
- Beetle.config.redis_server = "127.0.0.1:6379"
# set Beetle log level to info, less noisy than debug
Beetle.config.logger.level = Logger::INFO
@@ -30,13 +27,10 @@ Daemons.run_proc("beetle_handler", :log_output => true, :dir_mode => :normal, :d
config.message(:echo)
config.handler(:echo) do |message|
begin
- master_file_content = File.read($redis_master_file_path)
- master = client.deduplication_store.extract_redis_master(master_file_content)
- if master != ""
- master
- else
- "no redis master: master_file: '#{master_file_content}'"
- end
+ client.deduplication_store.redis.server
+ rescue
+ master_file_content = File.read(Beetle.config.redis_server)
+ "no redis master: exception: #{$!.class}(#{$!}), master_file: '#{master_file_content}'"
end
end
config.handler(Beetle.config.beetle_policy_updates_queue_name) do |message|

Use correct redis for beetle_handler in features again