big_brother 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,13 +15,21 @@ Stopped:
15
15
  CONTENT
16
16
  end
17
17
 
18
- before "/cluster/:name" do |name|
18
+ before %r{/cluster/([^/]+).*$} do |name|
19
19
  @cluster = BigBrother.clusters[name]
20
20
  halt 404, "Cluster #{name} not found" if @cluster.nil?
21
21
  end
22
22
 
23
+ get "/cluster/:name/status" do |name|
24
+ _cluster_status
25
+ end
26
+
23
27
  get "/cluster/:name" do |name|
24
28
  @cluster.synchronize! unless @cluster.monitored?
29
+ _cluster_status
30
+ end
31
+
32
+ def _cluster_status
25
33
  [200, "Running: #{@cluster.monitored?}\nCombinedWeight: #{@cluster.combined_weight}\n"]
26
34
  end
27
35
 
@@ -1,3 +1,3 @@
1
1
  module BigBrother
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
@@ -81,6 +81,55 @@ CombinedWeight: 60
81
81
  end
82
82
  end
83
83
 
84
+ describe "GET /cluster/:name/status" do
85
+ it "returns 'Running: false' when the cluster isn't running" do
86
+ BigBrother.clusters['test'] = Factory.cluster(:name => 'test')
87
+
88
+ get "/cluster/test/status"
89
+
90
+ last_response.status.should == 200
91
+ last_response.body.should =~ /^Running: false$/
92
+ end
93
+
94
+ it "returns 'Running: true' and the combined weight when the cluster is running" do
95
+ BigBrother.clusters['test'] = Factory.cluster(
96
+ :name => 'test',
97
+ :nodes => [
98
+ Factory.node(:weight => 10),
99
+ Factory.node(:weight => 20),
100
+ Factory.node(:weight => 30)
101
+ ]
102
+ )
103
+
104
+ put "/cluster/test"
105
+ get "/cluster/test/status"
106
+
107
+ last_response.status.should == 200
108
+ last_response.body.should == <<-RESPONSE_BODY
109
+ Running: true
110
+ CombinedWeight: 60
111
+ RESPONSE_BODY
112
+ end
113
+
114
+ it "does not synchronize the cluster, so litmus_paper can call this route often" do
115
+ cluster = Factory.cluster(:name => 'test')
116
+ BigBrother.clusters['test'] = cluster
117
+
118
+ cluster.should_receive(:synchronize!).never
119
+
120
+ get "/cluster/test/status"
121
+
122
+ last_response.status.should == 200
123
+ last_response.body.should =~ /^Running: false$/
124
+ end
125
+
126
+ it "returns a 404 http status when the cluster is not found" do
127
+ get "/cluster/not_found/status"
128
+
129
+ last_response.status.should == 404
130
+ end
131
+ end
132
+
84
133
  describe "PUT /cluster/:name" do
85
134
  it "marks the cluster as monitored" do
86
135
  BigBrother.clusters['test'] = Factory.cluster(:name => 'test')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: big_brother
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-08-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thin
16
- requirement: &70326700803540 !ruby/object:Gem::Requirement
16
+ requirement: &70206819206640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.3.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70326700803540
24
+ version_requirements: *70206819206640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: async-rack
27
- requirement: &70326700802400 !ruby/object:Gem::Requirement
27
+ requirement: &70206819205540 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.5.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70326700802400
35
+ version_requirements: *70206819205540
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sinatra
38
- requirement: &70326700801720 !ruby/object:Gem::Requirement
38
+ requirement: &70206819204740 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '1.0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70326700801720
46
+ version_requirements: *70206819204740
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rack-fiber_pool
49
- requirement: &70326700800420 !ruby/object:Gem::Requirement
49
+ requirement: &70206819203640 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0.9'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70326700800420
57
+ version_requirements: *70206819203640
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: eventmachine
60
- requirement: &70326700799700 !ruby/object:Gem::Requirement
60
+ requirement: &70206819202880 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>'
@@ -68,10 +68,10 @@ dependencies:
68
68
  version: 1.0.0.beta.100
69
69
  type: :runtime
70
70
  prerelease: false
71
- version_requirements: *70326700799700
71
+ version_requirements: *70206819202880
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: em-http-request
74
- requirement: &70326700826080 !ruby/object:Gem::Requirement
74
+ requirement: &70206819229160 !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
77
77
  - - ~>
@@ -79,10 +79,10 @@ dependencies:
79
79
  version: '1.0'
80
80
  type: :runtime
81
81
  prerelease: false
82
- version_requirements: *70326700826080
82
+ version_requirements: *70206819229160
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: em-synchrony
85
- requirement: &70326700825260 !ruby/object:Gem::Requirement
85
+ requirement: &70206819228380 !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
88
88
  - - ~>
@@ -90,10 +90,10 @@ dependencies:
90
90
  version: '1.0'
91
91
  type: :runtime
92
92
  prerelease: false
93
- version_requirements: *70326700825260
93
+ version_requirements: *70206819228380
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: em-resolv-replace
96
- requirement: &70326700824360 !ruby/object:Gem::Requirement
96
+ requirement: &70206819227500 !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - ~>
@@ -101,10 +101,10 @@ dependencies:
101
101
  version: '1.1'
102
102
  type: :runtime
103
103
  prerelease: false
104
- version_requirements: *70326700824360
104
+ version_requirements: *70206819227500
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: em-syslog
107
- requirement: &70326700823500 !ruby/object:Gem::Requirement
107
+ requirement: &70206819226640 !ruby/object:Gem::Requirement
108
108
  none: false
109
109
  requirements:
110
110
  - - ~>
@@ -112,10 +112,10 @@ dependencies:
112
112
  version: 0.0.2
113
113
  type: :runtime
114
114
  prerelease: false
115
- version_requirements: *70326700823500
115
+ version_requirements: *70206819226640
116
116
  - !ruby/object:Gem::Dependency
117
117
  name: rspec
118
- requirement: &70326700822660 !ruby/object:Gem::Requirement
118
+ requirement: &70206819225740 !ruby/object:Gem::Requirement
119
119
  none: false
120
120
  requirements:
121
121
  - - ~>
@@ -123,10 +123,10 @@ dependencies:
123
123
  version: 2.9.0
124
124
  type: :development
125
125
  prerelease: false
126
- version_requirements: *70326700822660
126
+ version_requirements: *70206819225740
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: rack-test
129
- requirement: &70326700821800 !ruby/object:Gem::Requirement
129
+ requirement: &70206819224860 !ruby/object:Gem::Requirement
130
130
  none: false
131
131
  requirements:
132
132
  - - ~>
@@ -134,10 +134,10 @@ dependencies:
134
134
  version: 0.6.1
135
135
  type: :development
136
136
  prerelease: false
137
- version_requirements: *70326700821800
137
+ version_requirements: *70206819224860
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: rake
140
- requirement: &70326700821080 !ruby/object:Gem::Requirement
140
+ requirement: &70206819224020 !ruby/object:Gem::Requirement
141
141
  none: false
142
142
  requirements:
143
143
  - - ! '>='
@@ -145,10 +145,10 @@ dependencies:
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
- version_requirements: *70326700821080
148
+ version_requirements: *70206819224020
149
149
  - !ruby/object:Gem::Dependency
150
150
  name: rake_commit
151
- requirement: &70326700819800 !ruby/object:Gem::Requirement
151
+ requirement: &70206819222600 !ruby/object:Gem::Requirement
152
152
  none: false
153
153
  requirements:
154
154
  - - ~>
@@ -156,10 +156,10 @@ dependencies:
156
156
  version: '0.13'
157
157
  type: :development
158
158
  prerelease: false
159
- version_requirements: *70326700819800
159
+ version_requirements: *70206819222600
160
160
  - !ruby/object:Gem::Dependency
161
161
  name: vagrant
162
- requirement: &70326700818860 !ruby/object:Gem::Requirement
162
+ requirement: &70206819247040 !ruby/object:Gem::Requirement
163
163
  none: false
164
164
  requirements:
165
165
  - - ! '>='
@@ -167,7 +167,7 @@ dependencies:
167
167
  version: '0'
168
168
  type: :development
169
169
  prerelease: false
170
- version_requirements: *70326700818860
170
+ version_requirements: *70206819247040
171
171
  description: IPVS backend supervisor
172
172
  email:
173
173
  - code@getbraintree.com