public
Fork of mojombo/god
Description: Ruby process monitor
Homepage: http://god.rubyforge.org
Clone URL: git://github.com/Bertg/god.git
fix test_watch
mojombo (author)
Fri Jan 25 13:46:45 -0800 2008
commit  f0c22dc03cabd961a8969905a9e485966a6cacdb
tree    2f8ef0f15cc399e8ee7f476567f11b903f13faed
parent  c6804137e4bacd86dd5791c31e3a5d0ceec18d8b
...
67
68
69
70
 
71
72
73
...
67
68
69
 
70
71
72
73
0
@@ -67,7 +67,7 @@ LOG = God::Logger.new
0
 LOG.datetime_format = "%Y-%m-%d %H:%M:%S "
0
 
0
 def applog(watch, level, text)
0
- # LOG.log(watch, level, text)
0
+ LOG.log(watch, level, text)
0
 end
0
 
0
 # The $run global determines whether god should be started when the
...
317
318
319
320
321
 
 
322
323
324
...
317
318
319
 
 
320
321
322
323
324
0
@@ -317,8 +317,8 @@ module God
0
       result = condition.test
0
       
0
       # log
0
- # messages = self.log_line(self, metric, condition, result)
0
- messages = []
0
+ messages = self.log_line(self, metric, condition, result)
0
+ # messages = []
0
       
0
       # notify
0
       if condition.notify && self.trigger?(metric, result)
...
37
38
39
40
41
42
43
44
45
46
47
48
...
132
133
134
 
 
 
135
136
137
...
150
151
152
 
 
 
153
154
155
...
170
171
172
 
 
 
173
174
175
176
177
178
 
 
 
179
180
181
...
184
185
186
 
 
 
187
188
189
...
204
205
206
 
 
 
207
208
209
...
212
213
214
 
 
 
215
216
217
...
219
220
221
 
 
 
222
223
224
...
37
38
39
 
 
 
 
 
 
40
41
42
...
126
127
128
129
130
131
132
133
134
...
147
148
149
150
151
152
153
154
155
...
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
...
190
191
192
193
194
195
196
197
198
...
213
214
215
216
217
218
219
220
221
...
224
225
226
227
228
229
230
231
232
...
234
235
236
237
238
239
240
241
242
0
@@ -37,12 +37,6 @@ class TestWatch < Test::Unit::TestCase
0
     assert_equal :unmonitored, @watch.state
0
   end
0
   
0
- # mutex
0
-
0
- def test_mutex_should_return_the_same_mutex_each_time
0
- assert_equal @watch.mutex, @watch.mutex
0
- end
0
-
0
   # valid?
0
   
0
   def test_valid?
0
@@ -132,6 +126,9 @@ class TestWatch < Test::Unit::TestCase
0
   # move
0
   
0
   def test_move_should_not_clean_up_if_from_state_is_nil
0
+ Thread.current.stubs(:==).returns(true)
0
+ @watch.driver.expects(:message).never
0
+
0
     metric = nil
0
     
0
     @watch.instance_eval do
0
@@ -150,6 +147,9 @@ class TestWatch < Test::Unit::TestCase
0
   end
0
   
0
   def test_move_should_clean_up_from_state_if_not_nil
0
+ Thread.current.stubs(:==).returns(true)
0
+ @watch.driver.expects(:message).never
0
+
0
     metric = nil
0
     
0
     @watch.instance_eval do
0
@@ -170,12 +170,18 @@ class TestWatch < Test::Unit::TestCase
0
   end
0
   
0
   def test_move_should_call_action
0
+ Thread.current.stubs(:==).returns(true)
0
+ @watch.driver.expects(:message).never
0
+
0
     @watch.expects(:action).with(:start)
0
     
0
     no_stdout { @watch.move(:start) }
0
   end
0
   
0
   def test_move_should_move_to_up_state_if_no_start_or_restart_metric
0
+ Thread.current.stubs(:==).returns(true)
0
+ @watch.driver.expects(:message).never
0
+
0
     [:start, :restart].each do |state|
0
       @watch.expects(:action)
0
       no_stdout { @watch.move(state) }
0
@@ -184,6 +190,9 @@ class TestWatch < Test::Unit::TestCase
0
   end
0
   
0
   def test_move_should_enable_destination_metric
0
+ Thread.current.stubs(:==).returns(true)
0
+ @watch.driver.expects(:message).never
0
+
0
     metric = nil
0
     
0
     @watch.instance_eval do
0
@@ -204,6 +213,9 @@ class TestWatch < Test::Unit::TestCase
0
   # action
0
   
0
   def test_action_should_pass_start_and_stop_actions_to_call_action
0
+ Thread.current.stubs(:==).returns(true)
0
+ @watch.driver.expects(:message).never
0
+
0
     c = Conditions::FakePollCondition.new
0
     [:start, :stop].each do |cmd|
0
       @watch.expects(:call_action).with(c, cmd)
0
@@ -212,6 +224,9 @@ class TestWatch < Test::Unit::TestCase
0
   end
0
   
0
   def test_action_should_do_stop_then_start_if_no_restart_command
0
+ Thread.current.stubs(:==).returns(true)
0
+ @watch.driver.expects(:message).never
0
+
0
     c = Conditions::FakePollCondition.new
0
     @watch.expects(:call_action).with(c, :stop)
0
     @watch.expects(:call_action).with(c, :start)
0
@@ -219,6 +234,9 @@ class TestWatch < Test::Unit::TestCase
0
   end
0
   
0
   def test_action_should_restart_to_call_action_if_present
0
+ Thread.current.stubs(:==).returns(true)
0
+ @watch.driver.expects(:message).never
0
+
0
     @watch.restart = lambda { }
0
     c = Conditions::FakePollCondition.new
0
     @watch.expects(:call_action).with(c, :restart)

Comments

    No one has commented yet.