Navigation Menu

Skip to content

Commit

Permalink
timer tests, log output cleanup, rakefile, gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed Oct 26, 2007
1 parent 79188ab commit f867b54
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
coverage
pkg
*.log
7 changes: 7 additions & 0 deletions Rakefile
Expand Up @@ -25,4 +25,11 @@ end
desc "Upload site to Rubyforge"
task :site_edge do
sh "scp -r site/* mojombo@god.rubyforge.org:/var/www/gforge-projects/god/edge"
end

desc "Run rcov"
task :coverage do
`rm -fr coverage`
`rcov test/test_*.rb`
`open coverage/index.html`
end
3 changes: 2 additions & 1 deletion lib/god.rb
Expand Up @@ -89,7 +89,8 @@ module Kernel
def abort(text = nil)
$run = false
applog(nil, :error, text) if text
text ? abort_orig(text) : exit(1)
# text ? abort_orig(text) : exit(1)
exit(1)
end

alias_method :exit_orig, :exit
Expand Down
1 change: 1 addition & 0 deletions lib/god/timer.rb
Expand Up @@ -53,6 +53,7 @@ def initialize
message = format("Unhandled exception (%s): %s\n%s",
e.class, e.message, e.backtrace.join("\n"))
applog(nil, :fatal, message)
sleep INTERVAL
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/configs/child_events/child_events.god
Expand Up @@ -19,7 +19,7 @@ God.watch do |w|
# determine when process has finished starting
w.transition([:start, :restart], :up) do |on|
on.condition(:process_running) do |c|
# c.running = true
c.running = true
end

# failsafe
Expand Down
9 changes: 9 additions & 0 deletions test/test_timer.rb
Expand Up @@ -51,6 +51,15 @@ def test_unschedule_should_remove_conditions
assert_equal 1, @t.events.size
end

def test_time_should_recover_from_exceptions
@t.expects(:trigger).raises(Exception.new)
no_stdout do
@t.schedule(stub(:interval => 0))
sleep(0.3)
@t.schedule(stub(:interval => 0))
end
end

# join

def test_join_should_join
Expand Down

0 comments on commit f867b54

Please sign in to comment.