spec/lib/flapjack/data/event_spec.rb in flapjack-0.8.10 vs spec/lib/flapjack/data/event_spec.rb in flapjack-0.8.11
- old
+ new
@@ -7,20 +7,21 @@
let(:check) { 'ping' }
let(:mock_redis) { double(::Redis) }
let!(:time) { Time.now}
- let(:event_data) { {'type' => 'service',
- 'state' => 'critical',
- 'entity' => entity_name,
- 'check' => check,
- 'time' => time.to_i,
- 'summary' => 'timeout',
- 'details' => "couldn't access",
+ let(:event_data) { {'type' => 'service',
+ 'state' => 'critical',
+ 'entity' => entity_name,
+ 'check' => check,
+ 'time' => time.to_i,
+ 'summary' => 'timeout',
+ 'details' => "couldn't access",
+ 'perfdata' => "/=5504MB;5554;6348;0;7935",
'acknowledgement_id' => '1234',
'duration' => (60 * 60),
- 'tags' => ['dev'] }
+ 'tags' => ['dev'] }
}
context 'class' do
it "returns the next event (blocking, archiving)" do
@@ -148,10 +149,10 @@
:archive_events => false, :redis => mock_redis)
expect(result).to be_nil
end
end
- ['time', 'details', 'acknowledgement_id', 'duration', 'tags'].each do |optional_key|
+ ['time', 'details', 'perfdata', 'acknowledgement_id', 'duration', 'tags'].each do |optional_key|
it "rejects an event with invalid '#{optional_key}' key (archiving)" do
bad_event_data = event_data.clone
bad_event_data[optional_key] = {'hello' => 'there'}
bad_event_json = bad_event_data.to_json
expect(mock_redis).to receive(:brpoplpush).