spec/lib/flapjack/coordinator_spec.rb in flapjack-1.1.0 vs spec/lib/flapjack/coordinator_spec.rb in flapjack-1.2.0rc1
- old
+ new
@@ -7,20 +7,26 @@
let(:fiber) { double(Fiber) }
let(:config) { double(Flapjack::Configuration) }
let(:logger) { double(Flapjack::Logger) }
+ let(:redis) { double(::Redis) }
+
let!(:time) { Time.now }
it "starts and stops a pikelet" do
expect(Flapjack::Logger).to receive(:new).and_return(logger)
cfg = {'processor' => {'enabled' => true}}
expect(EM).to receive(:synchrony).and_yield
expect(config).to receive(:for_redis).and_return({})
expect(config).to receive(:all).twice.and_return(cfg)
+ expect(redis).to receive(:keys).with('entity_tag:*').and_return([])
+ expect(redis).to receive(:keys).with('check_tag:*').and_return([])
+ expect(Flapjack::RedisPool).to receive(:new).and_return(redis)
+
processor = double('processor')
expect(processor).to receive(:start)
expect(processor).to receive(:stop)
expect(processor).to receive(:update_status)
expect(processor).to receive(:status).exactly(3).times.and_return('stopped')
@@ -50,10 +56,14 @@
cfg = {'processor' => {'enabled' => true}}
expect(EM).to receive(:synchrony).and_yield
expect(config).to receive(:for_redis).and_return({})
expect(config).to receive(:all).twice.and_return(cfg)
+ expect(redis).to receive(:keys).with('entity_tag:*').and_return([])
+ expect(redis).to receive(:keys).with('check_tag:*').and_return([])
+ expect(Flapjack::RedisPool).to receive(:new).and_return(redis)
+
processor = double('processor')
expect(processor).to receive(:start).and_raise(RuntimeError)
expect(processor).to receive(:stop)
expect(processor).to receive(:update_status)
expect(processor).to receive(:status).exactly(3).times.and_return('stopped')
@@ -77,10 +87,14 @@
cfg = {'executive' => {'enabled' => true}}
expect(EM).to receive(:synchrony).and_yield
expect(config).to receive(:for_redis).and_return({})
expect(config).to receive(:all).twice.and_return(cfg)
+ expect(redis).to receive(:keys).with('entity_tag:*').and_return([])
+ expect(redis).to receive(:keys).with('check_tag:*').and_return([])
+ expect(Flapjack::RedisPool).to receive(:new).and_return(redis)
+
processor = double('processor')
expect(processor).to receive(:start)
expect(processor).to receive(:stop)
expect(processor).to receive(:update_status)
expect(processor).to receive(:status).exactly(3).times.and_return('stopped')
@@ -118,9 +132,13 @@
'notifier' => {'enabled' => false}
}
expect(EM).to receive(:synchrony).and_yield
expect(config).to receive(:for_redis).and_return({})
expect(config).to receive(:all).twice.and_return(cfg)
+
+ expect(redis).to receive(:keys).with('entity_tag:*').and_return([])
+ expect(redis).to receive(:keys).with('check_tag:*').and_return([])
+ expect(Flapjack::RedisPool).to receive(:new).and_return(redis)
processor = double('processor')
expect(processor).to receive(:start)
expect(processor).to receive(:stop)
expect(processor).to receive(:update_status)