Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
Noah
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Noah
Commits
bad01f0d
Commit
bad01f0d
authored
Jan 31, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quick cleanup of test structure
parent
9fc817d8
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
733 additions
and
709 deletions
+733
-709
index.html
doc/coverage/index.html
+38
-38
lib-helpers_rb.html
doc/coverage/lib-helpers_rb.html
+6
-6
lib-models_rb.html
doc/coverage/lib-models_rb.html
+280
-274
noah_rb.html
doc/coverage/noah_rb.html
+210
-204
host_spec.rb
spec/host_spec.rb
+103
-99
service_spec.rb
spec/service_spec.rb
+96
-88
No files found.
doc/coverage/index.html
View file @
bad01f0d
...
...
@@ -48,46 +48,30 @@
<tfoot>
<tr>
<td
class=
"left_align"
>
TOTAL
</td>
<td
class=
'right_align'
><tt>
61
0
</tt></td>
<td
class=
'right_align'
><tt>
5
18
</tt></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
55.25
%
</tt></div>
<td
class=
'right_align'
><tt>
61
2
</tt></td>
<td
class=
'right_align'
><tt>
5
21
</tt></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
83.33
%
</tt></div>
<div
class=
"percent_graph"
>
<div
class=
"covered"
style=
"width:
55
px"
></div>
<div
class=
"uncovered"
style=
"width:
45
px"
></div>
<div
class=
"covered"
style=
"width:
83
px"
></div>
<div
class=
"uncovered"
style=
"width:
17
px"
></div>
</div></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
'coverage_total'
>
50.58
%
</tt></div>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
'coverage_total'
>
81.96
%
</tt></div>
<div
class=
"percent_graph"
>
<div
class=
"covered"
style=
"width:
51
px"
></div>
<div
class=
"uncovered"
style=
"width:
49
px"
></div>
<div
class=
"covered"
style=
"width:
82
px"
></div>
<div
class=
"uncovered"
style=
"width:
18
px"
></div>
</div></td>
</tr>
</tfoot>
<tbody>
<tr
class=
"all_files all_coverage 50 60 70 80 90 100 even"
>
<td
class=
"left_align"
><a
href=
"noah_rb.html"
>
noah.rb
</a></td>
<td
class=
'right_align'
><tt>
325
</tt></td>
<td
class=
'right_align'
><tt>
283
</tt></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
48.31%
</tt></div>
<div
class=
"percent_graph"
>
<div
class=
"covered"
style=
"width:48px"
></div>
<div
class=
"uncovered"
style=
"width:52px"
></div>
</div></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
42.40%
</tt></div>
<div
class=
"percent_graph"
>
<div
class=
"covered"
style=
"width:42px"
></div>
<div
class=
"uncovered"
style=
"width:58px"
></div>
</div></td>
</tr>
<tr
class=
"all_files all_coverage 60 70 80 90 100 lib odd"
>
<tr
class=
"all_files all_coverage 60 70 80 90 100 lib even"
>
<td
class=
"left_align"
><a
href=
"lib-helpers_rb.html"
>
lib/helpers.rb
</a></td>
<td
class=
'right_align'
><tt>
55
</tt></td>
<td
class=
'right_align'
><tt>
45
</tt></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
5
4.55
%
</tt></div>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
5
6.36
%
</tt></div>
<div
class=
"percent_graph"
>
<div
class=
"covered"
style=
"width:5
5
px"
></div>
<div
class=
"uncovered"
style=
"width:4
5
px"
></div>
<div
class=
"covered"
style=
"width:5
6
px"
></div>
<div
class=
"uncovered"
style=
"width:4
4
px"
></div>
</div></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
57.78%
</tt></div>
<div
class=
"percent_graph"
>
...
...
@@ -96,19 +80,35 @@
</div></td>
</tr>
<tr
class=
"all_files all_coverage 70 80 90 100 lib even"
>
<tr
class=
"all_files all_coverage 90 100 odd"
>
<td
class=
"left_align"
><a
href=
"noah_rb.html"
>
noah.rb
</a></td>
<td
class=
'right_align'
><tt>
326
</tt></td>
<td
class=
'right_align'
><tt>
285
</tt></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
82.52%
</tt></div>
<div
class=
"percent_graph"
>
<div
class=
"covered"
style=
"width:83px"
></div>
<div
class=
"uncovered"
style=
"width:17px"
></div>
</div></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
81.05%
</tt></div>
<div
class=
"percent_graph"
>
<div
class=
"covered"
style=
"width:81px"
></div>
<div
class=
"uncovered"
style=
"width:19px"
></div>
</div></td>
</tr>
<tr
class=
"all_files all_coverage 90 100 lib even"
>
<td
class=
"left_align"
><a
href=
"lib-models_rb.html"
>
lib/models.rb
</a></td>
<td
class=
'right_align'
><tt>
23
0
</tt></td>
<td
class=
'right_align'
><tt>
19
0
</tt></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
65.22
%
</tt></div>
<td
class=
'right_align'
><tt>
23
1
</tt></td>
<td
class=
'right_align'
><tt>
19
1
</tt></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
90.91
%
</tt></div>
<div
class=
"percent_graph"
>
<div
class=
"covered"
style=
"width:
65
px"
></div>
<div
class=
"uncovered"
style=
"width:
35
px"
></div>
<div
class=
"covered"
style=
"width:
91
px"
></div>
<div
class=
"uncovered"
style=
"width:
9
px"
></div>
</div></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
61.05
%
</tt></div>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
89.01
%
</tt></div>
<div
class=
"percent_graph"
>
<div
class=
"covered"
style=
"width:
61
px"
></div>
<div
class=
"uncovered"
style=
"width:
39
px"
></div>
<div
class=
"covered"
style=
"width:
89
px"
></div>
<div
class=
"uncovered"
style=
"width:
11
px"
></div>
</div></td>
</tr>
...
...
@@ -116,7 +116,7 @@
</table>
</div>
<p>
Generated on 2011-01-
27 21:32:1
2 -0500 with
<a
href=
"http://github.com/relevance/rcov"
>
rcov 0.9.8
</a></p>
<p>
Generated on 2011-01-
31 05:03:3
2 -0500 with
<a
href=
"http://github.com/relevance/rcov"
>
rcov 0.9.8
</a></p>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
(){
$
(
"
#report_table
"
).
tablesorter
({
widgets
:
[
'
zebra
'
],
textExtraction
:
'
complex
'
});});
...
...
doc/coverage/lib-helpers_rb.html
View file @
bad01f0d
...
...
@@ -30,10 +30,10 @@
<td
class=
"left_align"
><a
href=
"lib-helpers_rb.html"
>
lib/helpers.rb
</a></td>
<td
class=
'right_align'
><tt>
55
</tt></td>
<td
class=
'right_align'
><tt>
45
</tt></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
5
4.55
%
</tt></div>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
5
6.36
%
</tt></div>
<div
class=
"percent_graph"
>
<div
class=
"covered"
style=
"width:5
5
px"
></div>
<div
class=
"uncovered"
style=
"width:4
5
px"
></div>
<div
class=
"covered"
style=
"width:5
6
px"
></div>
<div
class=
"uncovered"
style=
"width:4
4
px"
></div>
</div></td>
<td
class=
"left_align"
><div
class=
"percent_graph_legend"
><tt
class=
''
>
57.78%
</tt></div>
<div
class=
"percent_graph"
>
...
...
@@ -158,13 +158,13 @@
<tr
class=
"
inferr
ed"
>
<tr
class=
"
mark
ed"
>
<td><pre><a
name=
"line18"
>
18
</a>
end
</pre></td>
</tr>
<tr
class=
"
uncover
ed"
>
<tr
class=
"
mark
ed"
>
<td><pre><a
name=
"line19"
>
19
</a>
</pre></td>
</tr>
...
...
@@ -387,7 +387,7 @@
</tbody>
</table>
<p>
Generated on 2011-01-
27 21:32:1
2 -0500 with
<a
href=
"http://github.com/relevance/rcov"
>
rcov 0.9.8
</a></p>
<p>
Generated on 2011-01-
31 05:03:3
2 -0500 with
<a
href=
"http://github.com/relevance/rcov"
>
rcov 0.9.8
</a></p>
</body>
</html>
doc/coverage/lib-models_rb.html
View file @
bad01f0d
This diff is collapsed.
Click to expand it.
doc/coverage/noah_rb.html
View file @
bad01f0d
This diff is collapsed.
Click to expand it.
spec/host_spec.rb
View file @
bad01f0d
require
File
.
expand_path
(
File
.
dirname
(
__FILE__
)
+
'/spec_helper'
)
describe
"
Noah
Host Model"
,
:reset_redis
=>
true
do
describe
"
Using the
Host Model"
,
:reset_redis
=>
true
do
it
"should create a new Host with no services"
do
describe
"should"
do
it
"create a new Host with no services"
do
hostname
=
"host1.domain.com"
hoststatus
=
"up"
host
=
Host
.
create
(
:name
=>
hostname
,
:status
=>
hoststatus
)
...
...
@@ -13,7 +14,7 @@ describe "Noah Host Model", :reset_redis => true do
host
.
services
.
size
.
should
==
0
end
it
"should
create a new Host with services"
do
it
"
create a new Host with services"
do
hostname
=
"host2.domain.com"
hoststatus
=
"down"
servicename
=
'myservice'
...
...
@@ -31,7 +32,7 @@ describe "Noah Host Model", :reset_redis => true do
host
.
services
[
1
].
host_id
.
should
==
host
.
id
end
it
"should
create a Host via find_or_create"
do
it
"
create a Host via find_or_create"
do
hostname
=
"host3.domain.com"
hoststatus
=
"up"
host
=
Host
.
find_or_create
(
:name
=>
hostname
,
:status
=>
hoststatus
)
...
...
@@ -40,7 +41,7 @@ describe "Noah Host Model", :reset_redis => true do
host
.
is_new?
.
should
==
true
end
it
"should
update a Host via find_or_create"
do
it
"
update a Host via find_or_create"
do
hostname
=
"host3.domain.com"
hoststatus
=
"pending"
newstatus
=
"down"
...
...
@@ -54,7 +55,7 @@ describe "Noah Host Model", :reset_redis => true do
host1
.
is_new?
.
should
==
false
end
it
"should
delete a Host"
do
it
"
delete a Host"
do
hostname
=
"host3.domain.com"
hoststatus
=
"pending"
host
=
Host
.
create
(
:name
=>
hostname
,
:status
=>
hoststatus
)
...
...
@@ -63,21 +64,40 @@ describe "Noah Host Model", :reset_redis => true do
Host
.
find
(
:name
=>
hostname
).
empty?
.
should
==
true
end
it
"should not create a new Host with missing status"
do
it
"should return all Hosts"
do
hostname1
=
"host1.domain.com"
status1
=
"up"
hostname2
=
"host2.domain.com"
status2
=
"down"
host1
=
Host
.
create
(
:name
=>
hostname1
,
:status
=>
status1
)
host2
=
Host
.
create
(
:name
=>
hostname2
,
:status
=>
status2
)
host1
.
save
host2
.
save
Hosts
.
all
.
class
.
should
==
Array
Hosts
.
all
.
size
.
should
==
2
Hosts
.
all
.
first
.
name
.
should
==
hostname1
Hosts
.
all
.
first
.
status
.
should
==
status1
Hosts
.
all
.
last
.
name
.
should
==
hostname2
Hosts
.
all
.
last
.
status
.
should
==
status2
end
end
describe
"should not"
do
it
"create a new Host with missing status"
do
hostname
=
"host3.domain.com"
host
=
Host
.
create
(
:name
=>
hostname
)
host
.
valid?
.
should
==
false
host
.
errors
.
should
==
[[
:status
,
:not_present
],
[
:status
,
:not_member
]]
end
it
"should not
create a new Host with missing hostname"
do
it
"
create a new Host with missing hostname"
do
status
=
"up"
host
=
Host
.
create
(
:status
=>
status
)
host
.
valid?
.
should
==
false
host
.
errors
.
should
==
[[
:name
,
:not_present
]]
end
it
"should not
create a new Host with an invalid status"
do
it
"
create a new Host with an invalid status"
do
hostname
=
"host3.domain.com"
status
=
"online"
host
=
Host
.
create
(
:name
=>
hostname
,
:status
=>
status
)
...
...
@@ -85,7 +105,7 @@ describe "Noah Host Model", :reset_redis => true do
host
.
errors
.
should
==
[[
:status
,
:not_member
]]
end
it
"should not
create a duplicate Host"
do
it
"
create a duplicate Host"
do
hostname
=
"host1.domain.com"
status
=
"up"
host1
=
Host
.
create
(
:name
=>
hostname
,
:status
=>
status
)
...
...
@@ -94,22 +114,6 @@ describe "Noah Host Model", :reset_redis => true do
host2
.
valid?
.
should
==
false
host2
.
errors
.
should
==
[[
:name
,
:not_unique
]]
end
it
"should return all Hosts"
do
hostname1
=
"host1.domain.com"
status1
=
"up"
hostname2
=
"host2.domain.com"
status2
=
"down"
host1
=
Host
.
create
(
:name
=>
hostname1
,
:status
=>
status1
)
host2
=
Host
.
create
(
:name
=>
hostname2
,
:status
=>
status2
)
host1
.
save
host2
.
save
Hosts
.
all
.
class
.
should
==
Array
Hosts
.
all
.
size
.
should
==
2
Hosts
.
all
.
first
.
name
.
should
==
hostname1
Hosts
.
all
.
first
.
status
.
should
==
status1
Hosts
.
all
.
last
.
name
.
should
==
hostname2
Hosts
.
all
.
last
.
status
.
should
==
status2
end
end
spec/service_spec.rb
View file @
bad01f0d
require
File
.
expand_path
(
File
.
dirname
(
__FILE__
)
+
'/spec_helper'
)
describe
"Noah Service Model"
,
:reset_redis
=>
true
do
describe
"should"
do
it
"should
create a new Service"
do
it
"
create a new Service"
do
servicename
=
"myservice"
servicestatus
=
"up"
hostname
=
"mytesthost1"
...
...
@@ -18,7 +19,53 @@ describe "Noah Service Model", :reset_redis => true do
host
.
services
[
1
].
name
.
should
==
servicename
end
it
"should not create a new Service when missing a Host"
do
it
"create a new Service with find_or_create"
do
host
=
Host
.
create
(
:name
=>
"h1"
,
:status
=>
"up"
)
host
.
save
service
=
Service
.
find_or_create
(
:name
=>
"s1"
,
:status
=>
"up"
,
:host
=>
host
)
service
.
save
service
.
is_new?
.
should
==
true
end
it
"update an existing Service with find_or_create"
do
host
=
Host
.
create
(
:name
=>
"h2"
,
:status
=>
"up"
)
host
.
save
service
=
Service
.
find_or_create
(
:name
=>
"s2"
,
:status
=>
"up"
,
:host
=>
host
)
service
.
save
sleep
1
service2
=
Service
.
find_or_create
(
:name
=>
"s2"
,
:status
=>
"up"
,
:host
=>
host
)
service2
.
save
service2
.
is_new?
.
should
==
false
end
it
"delete a Service"
do
h
=
Host
.
create
(
:name
=>
"h1"
,
:status
=>
"up"
)
h
.
save
s
=
Service
.
create
(
:name
=>
"s1"
,
:status
=>
"up"
,
:host
=>
h
)
s
.
save
s
=
Service
.
find
(
:name
=>
"s1"
).
first
s
.
delete
s
=
Service
.
find
(
:name
=>
"s1"
).
first
s
.
should
==
nil
end
it
"find multiple Services"
do
h
=
Host
.
create
(
:name
=>
"h1"
,
:status
=>
"up"
)
if
h
.
valid?
h
.
services
<<
Service
.
create
(
:name
=>
"s1"
,
:status
=>
"up"
,
:host
=>
h
)
h
.
services
<<
Service
.
create
(
:name
=>
"s2"
,
:status
=>
"up"
,
:host
=>
h
)
h
.
save
end
Services
.
all
.
size
.
should
==
2
Services
.
all
.
first
.
name
.
should
==
"s1"
Services
.
all
.
last
.
name
.
should
==
"s2"
end
end
describe
"should not"
do
it
"create a new Service when missing a Host"
do
servicename
=
"myservice1"
servicestatus
=
"up"
service
=
Service
.
create
(
:name
=>
servicename
,
:status
=>
servicestatus
)
...
...
@@ -26,7 +73,7 @@ describe "Noah Service Model", :reset_redis => true do
service
.
errors
.
should
==
[[
:host_id
,
:not_present
]]
end
it
"should not
create a new Service when missing a name"
do
it
"
create a new Service when missing a name"
do
host
=
Host
.
create
(
:name
=>
"host1.domain.com"
,
:status
=>
"up"
)
host
.
save
service
=
Service
.
create
(
:status
=>
"up"
,
:host
=>
host
)
...
...
@@ -34,7 +81,7 @@ describe "Noah Service Model", :reset_redis => true do
service
.
errors
.
should
==
[[
:name
,
:not_present
]]
end
it
"should not
create a new Service when missing a status"
do
it
"
create a new Service when missing a status"
do
host
=
Host
.
create
(
:name
=>
"host1.domain.com"
,
:status
=>
"up"
)
host
.
save
service
=
Service
.
create
(
:name
=>
'foo'
,
:host
=>
host
)
...
...
@@ -42,7 +89,7 @@ describe "Noah Service Model", :reset_redis => true do
service
.
errors
.
should
==
[[
:status
,
:not_present
],
[
:status
,
:not_member
]]
end
it
"should not
create a new Service with an invalid status"
do
it
"
create a new Service with an invalid status"
do
host
=
Host
.
create
(
:name
=>
"host1.domain.com"
,
:status
=>
"up"
)
host
.
save
service
=
Service
.
create
(
:name
=>
"myservice"
,
:status
=>
"invalid_status"
,
:host
=>
host
)
...
...
@@ -50,7 +97,7 @@ describe "Noah Service Model", :reset_redis => true do
service
.
errors
.
should
==
[[
:status
,
:not_member
]]
end
it
"should not
create a duplicate Service"
do
it
"
create a duplicate Service"
do
host
=
Host
.
create
(
:name
=>
"host1.domain.com"
,
:status
=>
"up"
)
host
.
save
s
=
Service
.
create
(
:name
=>
"myservice"
,
:status
=>
"up"
,
:host
=>
host
)
...
...
@@ -60,45 +107,6 @@ describe "Noah Service Model", :reset_redis => true do
s1
.
errors
.
should
==
[[[
:name
,
:host_id
],
:not_unique
]]
end
it
"should create a new Service with find_or_create"
do
host
=
Host
.
create
(
:name
=>
"h1"
,
:status
=>
"up"
)
host
.
save
service
=
Service
.
find_or_create
(
:name
=>
"s1"
,
:status
=>
"up"
,
:host
=>
host
)
service
.
save
service
.
is_new?
.
should
==
true
end
it
"should update an existing Service with find_or_create"
do
host
=
Host
.
create
(
:name
=>
"h2"
,
:status
=>
"up"
)
host
.
save
service
=
Service
.
find_or_create
(
:name
=>
"s2"
,
:status
=>
"up"
,
:host
=>
host
)
service
.
save
sleep
1
service2
=
Service
.
find_or_create
(
:name
=>
"s2"
,
:status
=>
"up"
,
:host
=>
host
)
service2
.
save
service2
.
is_new?
.
should
==
false
end
it
"should delete a Service"
do
h
=
Host
.
create
(
:name
=>
"h1"
,
:status
=>
"up"
)
h
.
save
s
=
Service
.
create
(
:name
=>
"s1"
,
:status
=>
"up"
,
:host
=>
h
)
s
.
save
s
=
Service
.
find
(
:name
=>
"s1"
).
first
s
.
delete
s
=
Service
.
find
(
:name
=>
"s1"
).
first
s
.
should
==
nil
end
it
"should find multiple Services"
do
h
=
Host
.
create
(
:name
=>
"h1"
,
:status
=>
"up"
)
if
h
.
valid?
h
.
services
<<
Service
.
create
(
:name
=>
"s1"
,
:status
=>
"up"
,
:host
=>
h
)
h
.
services
<<
Service
.
create
(
:name
=>
"s2"
,
:status
=>
"up"
,
:host
=>
h
)
h
.
save
end
Services
.
all
.
size
.
should
==
2
Services
.
all
.
first
.
name
.
should
==
"s1"
Services
.
all
.
last
.
name
.
should
==
"s2"
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment