Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F8391065
dependency_spec.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
14 KB
Subscribers
None
dependency_spec.rb
View Options
require
'spec_helper'
describe
(
'icinga2::object::dependency'
,
:type
=>
:define
)
do
let
(
:title
)
{
'bar'
}
let
(
:pre_condition
)
{
[
"class { 'icinga2': }"
]
}
on_supported_os
.
each
do
|
os
,
facts
|
let
:facts
do
facts
end
context
"
#{
os
}
with all defaults and target => /bar/baz"
do
let
(
:params
)
{
{
:target
=>
'/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat
(
'/bar/baz'
)
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/object Dependency "bar"/
)
.
without_content
(
/assign where/
)
.
without_content
(
/ignore where/
)
}
it
{
is_expected
.
to
contain_icinga2__object
(
'icinga2::object::Dependency::bar'
)
.
that_notifies
(
'Class[icinga2::service]'
)
}
end
context
"
#{
os
}
with dependency_name => foo"
do
let
(
:params
)
{
{
:dependency_name
=>
'foo'
,
:target
=>
'/bar/baz'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/object Dependency "foo"/
)
}
end
context
"
#{
os
}
with parent_host_name => foo"
do
let
(
:params
)
{
{
:parent_host_name
=>
'foo'
,
:target
=>
'/bar/baz'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/parent_host_name = "foo"/
)
}
end
context
"
#{
os
}
with parent_service_name => foo"
do
let
(
:params
)
{
{
:parent_service_name
=>
'foo'
,
:target
=>
'/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/parent_service_name = "foo"/
)
}
end
context
"
#{
os
}
with child_host_name => foo"
do
let
(
:params
)
{
{
:child_host_name
=>
'foo'
,
:target
=>
'/bar/baz'
,
:parent_host_name
=>
'parentfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/child_host_name = "foo"/
)
}
end
context
"
#{
os
}
with child_service_name => foo"
do
let
(
:params
)
{
{
:child_service_name
=>
'foo'
,
:target
=>
'/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/child_service_name = "foo"/
)
}
end
context
"
#{
os
}
with disable_checks => false"
do
let
(
:params
)
{
{
:disable_checks
=>
false
,
:target
=>
'/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/disable_checks = false/
)
}
end
context
"
#{
os
}
with disable_checks => foo (not a valid boolean)"
do
let
(
:params
)
{
{
:disable_checks
=>
'foo'
,
:target
=>
'/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
raise_error
(
Puppet
::
Error
,
/expects a value of type Undef or Boolean/
)
}
end
context
"
#{
os
}
with disable_notifications => false"
do
let
(
:params
)
{
{
:disable_notifications
=>
false
,
:target
=>
'/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/disable_notifications = false/
)
}
end
context
"
#{
os
}
with disable_notifications => foo (not a valid boolean)"
do
let
(
:params
)
{
{
:disable_notifications
=>
'foo'
,
:target
=>
'/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
raise_error
(
Puppet
::
Error
,
/expects a value of type Undef or Boolean/
)
}
end
context
"
#{
os
}
with ignore_soft_states => false"
do
let
(
:params
)
{
{
:ignore_soft_states
=>
false
,
:target
=>
'/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/ignore_soft_states = false/
)
}
end
context
"
#{
os
}
with ignore_soft_states => foo (not a valid boolean)"
do
let
(
:params
)
{
{
:ignore_soft_states
=>
'foo'
,
:target
=>
'/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
raise_error
(
Puppet
::
Error
,
/expects a value of type Undef or Boolean/
)
}
end
context
"
#{
os
}
with period => foo"
do
let
(
:params
)
{
{
:period
=>
'foo'
,
:target
=>
'/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/period = "foo"/
)
}
end
context
"
#{
os
}
with states => [foo, bar]"
do
let
(
:params
)
{
{
:states
=>
[
'foo'
,
'bar'
]
,
:target
=>
'/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/states = \[ "foo", "bar", \]/
)
}
end
context
"
#{
os
}
with states => foo (not a valid array)"
do
let
(
:params
)
{
{
:states
=>
'foo'
,
:target
=>
'/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
raise_error
(
Puppet
::
Error
,
/expects a value of type Undef or Array/
)
}
end
end
end
describe
(
'icinga2::object::dependency'
,
:type
=>
:define
)
do
let
(
:facts
)
{
{
:kernel
=>
'Windows'
,
:architecture
=>
'x86_64'
,
:osfamily
=>
'Windows'
,
:operatingsystem
=>
'Windows'
,
:operatingsystemmajrelease
=>
'2012 R2'
,
:path
=>
'C:\Program Files\Puppet Labs\Puppet\puppet
\b
in;
C:\Program Files\Puppet Labs\Puppet
\f
acter
\b
in;
C:\Program Files\Puppet Labs\Puppet\hiera
\b
in;
C:\Program Files\Puppet Labs\Puppet\mcollective
\b
in;
C:\Program Files\Puppet Labs\Puppet
\b
in;
C:\Program Files\Puppet Labs\Puppet
\s
ys
\r
uby
\b
in;
C:\Program Files\Puppet Labs\Puppet
\s
ys
\t
ools
\b
in;
C:\Windows
\s
ystem32;C:\Windows;C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell
\v
1.0\;
C:\ProgramData\chocolatey
\b
in;'
,
}
}
let
(
:title
)
{
'bar'
}
let
(
:pre_condition
)
{
[
"class { 'icinga2': }"
]
}
context
"Windows 2012 R2 with all defaults and target => C:/bar/baz"
do
let
(
:params
)
{
{
:target
=>
'C:/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat
(
'C:/bar/baz'
)
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/object Dependency "bar"/
)
.
without_content
(
/assign where/
)
.
without_content
(
/ignore where/
)
}
it
{
is_expected
.
to
contain_icinga2__object
(
'icinga2::object::Dependency::bar'
)
.
that_notifies
(
'Class[icinga2::service]'
)
}
end
context
"Windows 2012 R2 with dependency_name => foo"
do
let
(
:params
)
{
{
:dependency_name
=>
'foo'
,
:target
=>
'C:/bar/baz'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/object Dependency "foo"/
)
}
end
context
"Windows 2012 R2 with parent_host_name => foo"
do
let
(
:params
)
{
{
:parent_host_name
=>
'foo'
,
:target
=>
'C:/bar/baz'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/parent_host_name = "foo"/
)
}
end
context
"Windows 2012 R2 with parent_service_name => foo"
do
let
(
:params
)
{
{
:parent_service_name
=>
'foo'
,
:target
=>
'C:/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/parent_service_name = "foo"/
)
}
end
context
"Windows 2012 R2 with child_host_name => foo"
do
let
(
:params
)
{
{
:child_host_name
=>
'foo'
,
:target
=>
'C:/bar/baz'
,
:parent_host_name
=>
'parentfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/child_host_name = "foo"/
)
}
end
context
"Windows 2012 R2 with child_service_name => foo"
do
let
(
:params
)
{
{
:child_service_name
=>
'foo'
,
:target
=>
'C:/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/child_service_name = "foo"/
)
}
end
context
"Windows 2012 R2 with disable_checks => false"
do
let
(
:params
)
{
{
:disable_checks
=>
false
,
:target
=>
'C:/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/disable_checks = false/
)
}
end
context
"Windows 2012 R2 with disable_checks => foo (not a valid boolean)"
do
let
(
:params
)
{
{
:disable_checks
=>
'foo'
,
:target
=>
'C:/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
raise_error
(
Puppet
::
Error
,
/expects a value of type Undef or Boolean/
)
}
end
context
"Windows 2012 R2 with disable_notifications => false"
do
let
(
:params
)
{
{
:disable_notifications
=>
false
,
:target
=>
'C:/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/disable_notifications = false/
)
}
end
context
"Windows 2012 R2 with disable_notifications => foo (not a valid boolean)"
do
let
(
:params
)
{
{
:disable_notifications
=>
'foo'
,
:target
=>
'C:/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
raise_error
(
Puppet
::
Error
,
/expects a value of type Undef or Boolean/
)
}
end
context
"Windows 2012 R2 with ignore_soft_states => false"
do
let
(
:params
)
{
{
:ignore_soft_states
=>
false
,
:target
=>
'C:/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/ignore_soft_states = false/
)
}
end
context
"Windows 2012 R2 with ignore_soft_states => foo (not a valid boolean)"
do
let
(
:params
)
{
{
:ignore_soft_states
=>
'foo'
,
:target
=>
'C:/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
raise_error
(
Puppet
::
Error
,
/expects a value of type Undef or Boolean/
)
}
end
context
"Windows 2012 R2 with period => foo"
do
let
(
:params
)
{
{
:period
=>
'foo'
,
:target
=>
'C:/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/period = "foo"/
)
}
end
context
"Windows 2012 R2 with states => [foo, bar]"
do
let
(
:params
)
{
{
:states
=>
[
'foo'
,
'bar'
]
,
:target
=>
'C:/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::Dependency::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/states = \[ "foo", "bar", \]/
)
}
end
context
"Windows 2012 R2 with states => foo (not a valid array)"
do
let
(
:params
)
{
{
:states
=>
'foo'
,
:target
=>
'C:/bar/baz'
,
:parent_host_name
=>
'parentfoo'
,
:child_host_name
=>
'childfoo'
}
}
it
{
is_expected
.
to
raise_error
(
Puppet
::
Error
,
/expects a value of type Undef or Array/
)
}
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Jun 4 2025, 6:37 PM (14 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3373367
Attached To
rSPICI Icinga 2 Puppet Module
Event Timeline
Log In to Comment