forked from wvanbergen/request-log-analyzer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
munin_plugins_rails_spec.rb
58 lines (47 loc) · 1.52 KB
/
munin_plugins_rails_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
require File.dirname(__FILE__) + '/../spec_helper.rb'
describe RequestLogAnalyzer, 'when harvesting like munin-plugins-rails the YAML output' do
before(:each) do
cleanup_temp_files!
run("#{log_fixture(:rails_1x)} --dump #{temp_output_file(:yaml)}")
@rla = YAML::load(File.read(temp_output_file(:yaml)))
end
after(:each) do
cleanup_temp_files!
end
it "should contain database times" do
@rla["Database time"].each do |item|
item[1][:min].should_not be_nil
item[1][:max].should_not be_nil
item[1][:hits].should_not be_nil
item[1][:sum].should_not be_nil
end
end
it "should contain request times" do
@rla["Request duration"].each do |item|
item[1][:min].should_not be_nil
item[1][:max].should_not be_nil
item[1][:hits].should_not be_nil
item[1][:sum].should_not be_nil
end
end
it "should contain failed requests" do
@rla.keys.should include("Failed requests")
end
it "should contain Process blockers" do
@rla.keys.should include("Process blockers (> 1 sec duration)")
end
it "should contain HTTP Methods" do
@rla["HTTP methods"]["GET"].should_not be_nil
end
it "should contain HTTP Methods" do
@rla["HTTP methods"]["GET"].should_not be_nil
end
it "should contain view rendering times" do
@rla["View rendering time"].each do |item|
item[1][:min].should_not be_nil
item[1][:max].should_not be_nil
item[1][:hits].should_not be_nil
item[1][:sum].should_not be_nil
end
end
end