scout 1.1.8 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README DELETED
@@ -1,34 +0,0 @@
1
- = ReadMe
2
-
3
- Scout by Highgroove Studios
4
-
5
- == Description
6
-
7
- A Monitoring and Reporting Tool a Developer can Understand.
8
-
9
- Scout makes monitoring and reporting on your web applications as flexible
10
- and simple as possible.
11
-
12
- Scout is a product of Highgroove Studios. Please visit http://scoutapp.com
13
- for more information.
14
-
15
- == Installing
16
-
17
- After installing the scout gem:
18
-
19
- $ sudo gem install scout --source http://gems.scoutapp.com
20
-
21
- Simply run:
22
-
23
- $ scout
24
-
25
- to run the installation wizard. You'll need your Client Key to continue.
26
-
27
-
28
-
29
-
30
-
31
- == Further Development / Test Suite
32
-
33
- To test, you will need a valid Scout Server, client key, and plugin id. See
34
- the test/scout_test.rb file for more details.
data/TODO DELETED
@@ -1,6 +0,0 @@
1
- = To Do List
2
-
3
- The following is a list of planned expansions for the Scout Client:
4
-
5
- * optionally find the "nice" command if available and use that in the
6
- crontab output
data/test/scout_test.rb DELETED
@@ -1,91 +0,0 @@
1
- require 'test/unit'
2
- require File.dirname(__FILE__) + '/../lib/scout'
3
- require "logger"
4
-
5
- class ScoutTest < Test::Unit::TestCase
6
-
7
- SCOUT_TEST_SERVER = "http://localhost:4000/"
8
- SCOUT_TEST_VALID_CLIENT_KEY = "valid key goes here"
9
- SCOUT_TEST_VALID_PLUGIN_ID = "valid plugin id goes here"
10
-
11
- def setup
12
- @log = Logger.new('test.log')
13
- @scout_server = create_scout_server(SCOUT_TEST_SERVER,
14
- SCOUT_TEST_VALID_CLIENT_KEY)
15
- end
16
-
17
- def teardown
18
- File.delete('test.log')
19
- end
20
-
21
- def test_create
22
- assert @scout_server
23
- end
24
-
25
- def test_should_initialize_new_server
26
- ["@history_file", "@client_key", "@logger", "@server", "@history"].each do |var|
27
- assert @scout_server.instance_variables.include?(var)
28
- end
29
- end
30
-
31
- def test_should_send_report
32
- report = {:server_load => "99.99"}
33
- assert_does_not_exit { @scout_server.send_report(report, SCOUT_TEST_VALID_PLUGIN_ID) }
34
- assert_log_contains("Report sent")
35
- end
36
-
37
- def test_should_not_send_report_with_invalid_client_key
38
- @scout_server_invalid_client_key = create_scout_server(SCOUT_TEST_SERVER,
39
- "1111-2222-3333-4444-5555")
40
- report = {:server_load => "99.99"}
41
- assert_does_exit { @scout_server_invalid_client_key.send_report(report, SCOUT_TEST_VALID_PLUGIN_ID) }
42
- assert_log_contains("Unable to send report to server")
43
- assert_log_contains("An HTTP error occurred: exit")
44
- end
45
-
46
- def test_should_not_send_report_with_invalid_plugin_id
47
- report = {:server_load => "99.99"}
48
- assert_does_exit { @scout_server.send_report(report, 9999999999) }
49
- assert_log_contains("Unable to send report to server")
50
- assert_log_contains("An HTTP error occurred: exit")
51
- end
52
-
53
- def test_should_not_send_report_with_plugin_not_belonging_to_client
54
- report = {:server_load => "99.99"}
55
- assert_does_exit { @scout_server.send_report(report, 4) }
56
- assert_log_contains("Unable to send report to server")
57
- assert_log_contains("An HTTP error occurred: exit")
58
- end
59
-
60
- def create_scout_server(server, client_key, history=File.join("/tmp", "client_history.yaml"), logger=@log)
61
- Scout::Server.new(server, client_key, history, logger)
62
- end
63
-
64
- def assert_log_contains(pattern)
65
- @log_file = File.read('test.log')
66
- assert @log_file.include?(pattern), "log does not include the pattern:\n#{pattern}\nlog contains:\n#{@log_file}"
67
- end
68
-
69
- # asserts that the program actually exits, terminating.
70
- def assert_does_exit(&block)
71
- begin
72
- yield
73
- rescue SystemExit
74
- assert true, "Expected program to not exit, but program did exit."
75
- return
76
- end
77
- flunk "Expected program to exit, but program did not exit."
78
- end
79
-
80
- # asserts that the program does not exit.
81
- def assert_does_not_exit(&block)
82
- begin
83
- yield
84
- rescue SystemExit
85
- flunk "Expected program to not exit, but program did exit."
86
- return
87
- end
88
- assert true, "Expected program to not exit, but program did exit."
89
- end
90
-
91
- end