flapjack 0.7.34 → 0.7.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,9 +21,6 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
21
21
  set :raise_errors, true
22
22
  set :show_exceptions, false
23
23
  }
24
- Flapjack::Gateways::Web.instance_variable_get('@middleware').delete_if {|m|
25
- m[0] == Rack::FiberPool
26
- }
27
24
  end
28
25
 
29
26
  before(:each) do
@@ -40,6 +37,8 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
40
37
  redis.should_receive(:hgetall).twice.and_return({'all' => '8001', 'ok' => '8002'},
41
38
  {'all' => '9001', 'ok' => '9002'})
42
39
  redis.should_receive(:llen).with('events')
40
+ redis.should_receive(:zrange).with('current_entities', 0, -1).and_return(['foo-app-01.example.com'])
41
+ redis.should_receive(:zrange).with('current_checks:foo-app-01.example.com', 0, -1, {:withscores => true}).and_return([['ping', 1382329923.0]])
43
42
  end
44
43
 
45
44
  def expect_check_stats
@@ -87,7 +86,7 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
87
86
  Flapjack::Data::EntityCheck.should_receive(:for_entity).
88
87
  with(entity, 'ping', :redis => redis).and_return(entity_check)
89
88
 
90
- get '/checks_all'
89
+ aget '/checks_all'
91
90
  last_response.should be_ok
92
91
  end
93
92
 
@@ -106,7 +105,7 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
106
105
 
107
106
  Flapjack::Data::EntityCheck.should_receive(:for_entity).
108
107
  with(entity, 'ping', :redis => redis).and_return(entity_check)
109
- get '/checks_failing'
108
+ aget '/checks_failing'
110
109
  last_response.should be_ok
111
110
  end
112
111
 
@@ -117,7 +116,7 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
117
116
  expect_check_stats
118
117
  expect_entity_stats
119
118
 
120
- get '/self_stats'
119
+ aget '/self_stats'
121
120
  last_response.should be_ok
122
121
  end
123
122
 
@@ -152,7 +151,7 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
152
151
  Flapjack::Data::EntityCheck.should_receive(:for_entity).
153
152
  with(entity, 'ping', :redis => redis).and_return(entity_check)
154
153
 
155
- get "/check?entity=#{entity_name_esc}&check=ping"
154
+ aget "/check?entity=#{entity_name_esc}&check=ping"
156
155
  last_response.should be_ok
157
156
  # TODO test instance variables set to appropriate values
158
157
  end
@@ -161,7 +160,7 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
161
160
  Flapjack::Data::Entity.should_receive(:find_by_name).
162
161
  with(entity_name_esc, :redis => redis).and_return(nil)
163
162
 
164
- get "/check?entity=#{entity_name_esc}&check=ping"
163
+ aget "/check?entity=#{entity_name_esc}&check=ping"
165
164
  last_response.should be_not_found
166
165
  end
167
166
 
@@ -170,7 +169,7 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
170
169
  Flapjack::Data::Entity.should_receive(:find_by_name).
171
170
  with(entity_name, :redis => redis).and_return(entity)
172
171
 
173
- get "/check?entity=#{entity_name_esc}"
172
+ aget "/check?entity=#{entity_name_esc}"
174
173
  last_response.should be_not_found
175
174
  end
176
175
 
@@ -185,7 +184,7 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
185
184
  with(entity_name, 'ping', :summary => "", :duration => (4 * 60 * 60),
186
185
  :acknowledgement_id => '1234', :redis => redis)
187
186
 
188
- post "/acknowledgements/#{entity_name_esc}/ping?acknowledgement_id=1234"
187
+ apost "/acknowledgements/#{entity_name_esc}/ping?acknowledgement_id=1234"
189
188
  last_response.status.should == 302
190
189
  end
191
190
 
@@ -208,7 +207,7 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
208
207
  entity_check.should_receive(:create_scheduled_maintenance).
209
208
  with(start_time.to_i, duration, :summary => summary)
210
209
 
211
- post "/scheduled_maintenances/#{entity_name_esc}/ping?"+
210
+ apost "/scheduled_maintenances/#{entity_name_esc}/ping?"+
212
211
  "start_time=1+day+ago&duration=30+minutes&summary=wow"
213
212
 
214
213
  last_response.status.should == 302
@@ -227,14 +226,14 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
227
226
 
228
227
  entity_check.should_receive(:end_scheduled_maintenance).with(start_time)
229
228
 
230
- delete "/scheduled_maintenances/#{entity_name_esc}/ping?start_time=#{start_time}"
229
+ adelete "/scheduled_maintenances/#{entity_name_esc}/ping?start_time=#{start_time}"
231
230
  last_response.status.should == 302
232
231
  end
233
232
 
234
233
  it "shows a list of all known contacts" do
235
234
  Flapjack::Data::Contact.should_receive(:all)
236
235
 
237
- get "/contacts"
236
+ aget "/contacts"
238
237
  last_response.should be_ok
239
238
  end
240
239
 
@@ -248,7 +247,7 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
248
247
  Flapjack::Data::Contact.should_receive(:find_by_id).
249
248
  with('0362', :redis => redis).and_return(contact)
250
249
 
251
- get "/contacts/0362"
250
+ aget "/contacts/0362"
252
251
  last_response.should be_ok
253
252
  end
254
253
 
data/spec/spec_helper.rb CHANGED
@@ -48,6 +48,14 @@ class MockLogger
48
48
  ERRORS
49
49
  end
50
50
 
51
+ %w(debug info warn error fatal).each do |level|
52
+ class_eval <<-LEVELS
53
+ def #{level}?
54
+ true
55
+ end
56
+ LEVELS
57
+ end
58
+
51
59
  end
52
60
 
53
61
  JsonSpec.configure do
@@ -104,5 +112,6 @@ RSpec.configure do |config|
104
112
 
105
113
  config.include ErbViewHelper, :erb_view => true
106
114
  config.include Rack::Test::Methods, :sinatra => true
115
+ config.include AsyncRackTest::Methods, :sinatra => true
107
116
  config.include JsonSpec::Helpers, :json => true
108
117
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flapjack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.34
4
+ version: 0.7.35
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-11-19 00:00:00.000000000 Z
14
+ date: 2013-12-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: dante
@@ -406,8 +406,6 @@ files:
406
406
  - features/support/silent_system.rb
407
407
  - flapjack.gemspec
408
408
  - lib/flapjack.rb
409
- - lib/flapjack/checks/http_content
410
- - lib/flapjack/checks/ping
411
409
  - lib/flapjack/configuration.rb
412
410
  - lib/flapjack/coordinator.rb
413
411
  - lib/flapjack/data/alert.rb
@@ -456,7 +454,6 @@ files:
456
454
  - lib/flapjack/gateways/web/public/img/flapjack-2013-notext-transparent-25-25.png
457
455
  - lib/flapjack/gateways/web/public/img/flapjack-2013-notext-transparent-25-40.png
458
456
  - lib/flapjack/gateways/web/public/img/flapjack-2013-vertical-transparent-300-386.png
459
- - lib/flapjack/gateways/web/public/img/flapjack-favicon-32-16.ico
460
457
  - lib/flapjack/gateways/web/public/img/flapjack-favicon-64-32-24-16.ico
461
458
  - lib/flapjack/gateways/web/public/img/flapjack-transparent-300.png
462
459
  - lib/flapjack/gateways/web/public/img/flapjack-transparent-350-400.png
@@ -561,7 +558,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
561
558
  version: '0'
562
559
  segments:
563
560
  - 0
564
- hash: 2860293635329435962
561
+ hash: -1407852540467172414
565
562
  required_rubygems_version: !ruby/object:Gem::Requirement
566
563
  none: false
567
564
  requirements:
@@ -570,7 +567,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
570
567
  version: '0'
571
568
  segments:
572
569
  - 0
573
- hash: 2860293635329435962
570
+ hash: -1407852540467172414
574
571
  requirements: []
575
572
  rubyforge_project:
576
573
  rubygems_version: 1.8.23
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'open-uri'
4
-
5
- page = ARGV[0]
6
- string = ARGV[1]
7
-
8
- exit 2 unless page && string
9
-
10
- body = open(page).read
11
- if body =~ /#{string}/
12
- exit 0
13
- else
14
- exit 2
15
- end
@@ -1,10 +0,0 @@
1
- #!/bin/sh
2
-
3
- ping -c 3 $1
4
- retval=$?
5
-
6
- if [ "$retval" != 0 ]; then
7
- exit 2
8
- else
9
- exit 0
10
- fi