Skip to content

Commit

Permalink
fixed integration tests; added bin script for monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jfranzoi committed Oct 3, 2011
1 parent 84839e2 commit d20f292
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 13 deletions.
7 changes: 5 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ Try to run it:

Finally, you can schedule a cron job (with crontab -e), like this:

*/5 * * * * /bin/bash -l -c 'cd $path_to_cruise_monitor && rake monitor'
*/5 * * * * $path_to_cruise_monitor/bin/monitor.sh

where $path_to_cruise_monitor links to the folder you have copied Cruise-monitor into.
where $path_to_cruise_monitor links to the folder you have copied Cruise-monitor into. Don't forget to set
monitor.sh as an executable file, with:

chmod +x bin/monitor.sh

That's it. Have fun, and keep the build clean!

Expand Down
5 changes: 5 additions & 0 deletions bin/monitor.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off
set CURRENT_FOLDER=%~dp0

cd %CURRENT_FOLDER%
rake monitor
5 changes: 5 additions & 0 deletions bin/monitor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
CURRENT_FOLDER="$( cd "$( dirname "$0" )" && pwd )"

cd $CURRENT_FOLDER
rake monitor
1 change: 1 addition & 0 deletions bin/say.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@echo off
set CURRENT_FOLDER=%~dp0

%CURRENT_FOLDER%\say.vbs %1
5 changes: 0 additions & 5 deletions test/integration/base_integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
module CruiseMonitor
class BaseIntegrationTest < Test::Unit::TestCase

STORAGE_FILE = Utils.temp_file('/latest.info')

def setup
Utils.delete_if_exists(STORAGE_FILE)

@server = FeedServer.new(10123)
@server.start

Expand All @@ -16,7 +12,6 @@ def setup

def teardown
@server.stop
Utils.delete_if_exists(STORAGE_FILE)
end

def test_ignore_this; end
Expand Down
10 changes: 5 additions & 5 deletions test/integration/build_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ module CruiseMonitor
class BuildTest < Test::Unit::TestCase
include Build

STORAGE_FILE = Utils.temp_file('latest.info')
ANY_STORAGE = Utils.temp_file('any.file')

def test_set_parser_for_cruise_rb
server = cruise_at("", STORAGE_FILE)
server = cruise_at("", ANY_STORAGE)
assert_parser_type CruiseControlRbParser, server
end

def test_set_parser_for_hudson
server = hudson_at("", STORAGE_FILE)
server = hudson_at("", ANY_STORAGE)
assert_parser_type HudsonParser, server
end

def test_set_parser_for_ccnet_with_feed_url
feed_url = 'http://anyserver/ccnet/server/local/project/myproject/RSSFeed.aspx'
server = ccnet_at(feed_url, STORAGE_FILE)
server = ccnet_at(feed_url, ANY_STORAGE)

assert_parser_type CruiseControlNetParser, server
end

def test_set_parser_for_ccnet_with_page_url
feed_url = 'http://anyserver/ccnet/server/local/project/myproject/ViewAllBuilds.aspx'
server = ccnet_at(feed_url, STORAGE_FILE)
server = ccnet_at(feed_url, ANY_STORAGE)

assert_parser_type CruiseControlNetHtmlParser, server
end
Expand Down
14 changes: 13 additions & 1 deletion test/integration/monitoring_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
require File.dirname(__FILE__) + '/../test_helper'

module CruiseMonitor
class RssAndFileTest < BaseIntegrationTest
class MonitoringTest < BaseIntegrationTest
include Build

STORAGE_FILE = Utils.temp_file('/latest.info')

def setup
Utils.delete_if_exists(STORAGE_FILE)
super
end

def teardown
super
Utils.delete_if_exists(STORAGE_FILE)
end

def test_should_connect_to_local_feed_and_notify_success_on_build_back_clean
Utils.write_content(STORAGE_FILE, 'myproject build 1000 failed')
Expand Down

0 comments on commit d20f292

Please sign in to comment.