Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F8394701
usergroup_spec.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Subscribers
None
usergroup_spec.rb
View Options
require
'spec_helper'
describe
(
'icinga2::object::usergroup'
,
: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'
}
}
it
{
is_expected
.
to
contain_concat
(
'/bar/baz'
)
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::UserGroup::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/object UserGroup "bar"/
)
.
without_content
(
/groups =/
)
.
without_content
(
/assign where/
)
.
without_content
(
/ignore where/
)
}
it
{
is_expected
.
to
contain_icinga2__object
(
'icinga2::object::UserGroup::bar'
)
.
that_notifies
(
'Class[icinga2::service]'
)
}
end
context
"
#{
os
}
with usergroup_name => foo"
do
let
(
:params
)
{
{
:usergroup_name
=>
'foo'
,
:target
=>
'/bar/baz'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::UserGroup::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/object UserGroup "foo"/
)
}
end
context
"
#{
os
}
with display_name => foo"
do
let
(
:params
)
{
{
:display_name
=>
'foo'
,
:target
=>
'/bar/baz'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::UserGroup::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/display_name = "foo"/
)
}
end
context
"
#{
os
}
with groups => [foo, bar]"
do
let
(
:params
)
{
{
:groups
=>
[
'foo'
,
'bar'
]
,
:target
=>
'/bar/baz'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::UserGroup::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/groups = \[ "foo", "bar", \]/
)
}
end
context
"
#{
os
}
with groups => foo"
do
let
(
:params
)
{
{
:groups
=>
'foo'
,
:target
=>
'/bar/baz'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::UserGroup::bar'
)
.
with
({
'target'
=>
'/bar/baz'
})
.
with_content
(
/groups = \[ "foo", \]/
)
}
end
context
"
#{
os
}
with assign => [] and ignore => [ foo ]"
do
let
(
:params
)
{
{
:assign
=>
[]
,
:ignore
=>
[
'foo'
]
,
:target
=>
'/bar/baz'
}
}
it
{
is_expected
.
to
raise_error
(
Puppet
::
Error
,
/When attribute ignore is used, assign must be set/
)
}
end
end
end
describe
(
'icinga2::object::usergroup'
,
: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'
}
}
it
{
is_expected
.
to
contain_concat
(
'C:/bar/baz'
)
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::UserGroup::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/object UserGroup "bar"/
)
.
without_content
(
/groups =/
)
.
without_content
(
/assign where/
)
.
without_content
(
/ignore where/
)
}
it
{
is_expected
.
to
contain_icinga2__object
(
'icinga2::object::UserGroup::bar'
)
.
that_notifies
(
'Class[icinga2::service]'
)
}
end
context
"Windows 2012 R2 with usergroup_name => foo"
do
let
(
:params
)
{
{
:usergroup_name
=>
'foo'
,
:target
=>
'C:/bar/baz'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::UserGroup::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/object UserGroup "foo"/
)
}
end
context
"Windows 2012 R2 with display_name => foo"
do
let
(
:params
)
{
{
:display_name
=>
'foo'
,
:target
=>
'C:/bar/baz'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::UserGroup::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/display_name = "foo"/
)
}
end
context
"Windows 2012 R2 with groups => [foo, bar]"
do
let
(
:params
)
{
{
:groups
=>
[
'foo'
,
'bar'
]
,
:target
=>
'C:/bar/baz'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::UserGroup::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/groups = \[ "foo", "bar", \]/
)
}
end
context
"Windows 2012 R2 with groups => foo"
do
let
(
:params
)
{
{
:groups
=>
'foo'
,
:target
=>
'C:/bar/baz'
}
}
it
{
is_expected
.
to
contain_concat__fragment
(
'icinga2::object::UserGroup::bar'
)
.
with
({
'target'
=>
'C:/bar/baz'
})
.
with_content
(
/groups = \[ "foo", \]/
)
}
end
context
"Windows 2012 R2 with assign => [] and ignore => [ foo ]"
do
let
(
:params
)
{
{
:assign
=>
[]
,
:ignore
=>
[
'foo'
]
,
:target
=>
'C:/bar/baz'
}
}
it
{
is_expected
.
to
raise_error
(
Puppet
::
Error
,
/When attribute ignore is used, assign must be set/
)
}
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Jun 4 2025, 7:27 PM (9 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3397079
Attached To
rSPICI Icinga 2 Puppet Module
Event Timeline
Log In to Comment