Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Puppet Camptocamp Postfix
Commits
80d4fbbe
Commit
80d4fbbe
authored
Sep 19, 2014
by
Mickaël Canévet
Browse files
Fix unit tests
parent
b61e5a9b
Changes
9
Hide whitespace changes
Inline
Side-by-side
spec/classes/postfix_augeas_spec.rb
View file @
80d4fbbe
...
...
@@ -2,9 +2,15 @@ require 'spec_helper'
describe
'postfix::augeas'
do
let
(
:facts
)
{
{
:augeasversion
=>
'1.2.0'
,
:lsbdistcodename
=>
'wheezy'
,
:operatingsystem
=>
'Debian'
,
:osfamily
=>
'Debian'
,
:rubyversion
=>
'1.9.3'
,
}
}
let
:pre_condition
do
"include ::augeas"
end
it
{
should
contain_augeas__lens
(
'postfix_transport'
).
with
(
:ensure
=>
'present'
,
...
...
spec/classes/postfix_mta_spec.rb
View file @
80d4fbbe
...
...
@@ -2,9 +2,16 @@ require 'spec_helper'
describe
'postfix::mta'
do
let
(
:facts
)
{
{
:
needs_postfix_class_with_par
am
s
=>
true
,
:osfamily
=>
'Debian'
,
:
lsbdistcoden
am
e
=>
'wheezy'
,
:osfamily
=>
'Debian'
,
}
}
let
:pre_condition
do
"class { 'postfix':
mydestination => 'bar',
mynetworks => 'baz',
relayhost => 'foo',
}"
end
it
{
should
contain_postfix__config
(
'mydestination'
).
with_value
(
'bar'
)
}
it
{
should
contain_postfix__config
(
'mynetworks'
).
with_value
(
'baz'
)
}
...
...
spec/classes/postfix_satellite_spec.rb
View file @
80d4fbbe
...
...
@@ -3,9 +3,19 @@ require 'spec_helper'
describe
'postfix::satellite'
do
let
(
:node
)
{
'foo.example.com'
}
let
(
:facts
)
{
{
:osfamily
=>
'Debian'
,
:needs_postfix_class_with_params
=>
true
,
:augeasversion
=>
'1.2.0'
,
:lsbdistcodename
=>
'wheezy'
,
:osfamily
=>
'Debian'
,
:rubyversion
=>
'1.9.3'
,
}
}
let
:pre_condition
do
" class { 'augeas': }
class { 'postfix':
relayhost => 'foo',
mydestination => 'bar',
mynetworks => 'baz',
}"
end
it
{
should
contain_class
(
'postfix::mta'
)
}
it
{
should
contain_postfix__virtual
(
'@foo.example.com'
).
with
(
:ensure
=>
'present'
,
...
...
spec/classes/postfix_spec.rb
View file @
80d4fbbe
...
...
@@ -4,6 +4,7 @@ describe 'postfix' do
context
'when using defaults'
do
context
'when on Debian'
do
let
(
:facts
)
{
{
:lsbdistcodename
=>
'wheezy'
,
:operatingsystem
=>
'Debian'
,
:osfamily
=>
'Debian'
,
:fqdn
=>
'fqdn.example.com'
,
...
...
@@ -35,9 +36,10 @@ describe 'postfix' do
context
'when on RedHat'
do
let
(
:facts
)
{
{
:operatingsystem
=>
'RedHat'
,
:osfamily
=>
'RedHat'
,
:fqdn
=>
'fqdn.example.com'
,
:lsbmajdistrelease
=>
'7'
,
:operatingsystem
=>
'RedHat'
,
:osfamily
=>
'RedHat'
,
:fqdn
=>
'fqdn.example.com'
,
}
}
it
{
should
contain_package
(
'postfix'
)
}
...
...
@@ -72,6 +74,7 @@ describe 'postfix' do
context
'when on Debian'
do
context
"when setting smtp_listen to 'all'"
do
let
(
:facts
)
{
{
:lsbdistcodename
=>
'wheezy'
,
:operatingsystem
=>
'Debian'
,
:osfamily
=>
'Debian'
,
:fqdn
=>
'fqdn.example.com'
,
...
...
@@ -139,8 +142,11 @@ describe 'postfix' do
end
context
'when on RedHat'
do
let
(
:facts
)
{
{
:augeasversion
=>
'1.2.0'
,
:lsbdistcodename
=>
'wheezy'
,
:operatingsystem
=>
'Debian'
,
:osfamily
=>
'Debian'
,
:rubyversion
=>
'1.9.7'
,
:fqdn
=>
'fqdn.example.com'
,
}
}
context
'when specifying inet_interfaces'
do
...
...
@@ -246,6 +252,9 @@ describe 'postfix' do
end
context
'when specifying satellite'
do
let
(
:params
)
{
{
:satellite
=>
true
,
:mydestination
=>
'1.2.3.4'
,
:relayhost
=>
'2.3.4.5'
}
}
let
:pre_condition
do
"class { 'augeas': }"
end
it
'should configure all local email to be forwarded to $root_mail_recipient delivered through $relayhost'
do
should
contain_postfix__config
(
'mydestination'
).
with_value
(
'1.2.3.4'
)
should
contain_postfix__config
(
'mynetworks'
).
with_value
(
'127.0.0.0/8'
)
...
...
spec/defines/postfix_config_spec.rb
View file @
80d4fbbe
...
...
@@ -3,9 +3,12 @@ require 'spec_helper'
describe
'postfix::config'
do
let
(
:title
)
{
'foo'
}
let
(
:facts
)
{
{
:
osfamily
=>
'Debian
'
,
:
needs_postfix_class
=>
true
,
:
lsbdistcodename
=>
'wheezy
'
,
:
osfamily
=>
'Debian'
,
}
}
let
:pre_condition
do
"class { 'postfix': }"
end
context
'when not passing value'
do
it
'should fail'
do
...
...
spec/defines/postfix_hash_spec.rb
View file @
80d4fbbe
...
...
@@ -3,9 +3,12 @@ require 'spec_helper'
describe
'postfix::hash'
do
let
(
:title
)
{
'/tmp/foo'
}
let
(
:facts
)
{
{
:
osfamily
=>
'Debian
'
,
:
needs_postfix_class
=>
true
,
:
lsbdistcodename
=>
'wheezy
'
,
:
osfamily
=>
'Debian'
,
}
}
let
:pre_condition
do
"class { '::postfix': }"
end
context
'when passing wrong type for ensure'
do
let
(
:params
)
{
{
...
...
spec/defines/postfix_transport_spec.rb
View file @
80d4fbbe
...
...
@@ -3,8 +3,13 @@ require 'spec_helper'
describe
'postfix::transport'
do
let
(
:title
)
{
'foo'
}
let
(
:facts
)
{
{
:osfamily
=>
'Debian'
,
:augeasversion
=>
'1.2.0'
,
:osfamily
=>
'Debian'
,
:rubyversion
=>
'1.9.3'
,
}
}
let
:pre_condition
do
"class { 'augeas': }"
end
context
'when sending wrong type for destination'
do
let
(
:params
)
{
{
...
...
spec/defines/postfix_virtual_spec.rb
View file @
80d4fbbe
...
...
@@ -3,8 +3,13 @@ require 'spec_helper'
describe
'postfix::virtual'
do
let
(
:title
)
{
'foo'
}
let
(
:facts
)
{
{
:osfamily
=>
'Debian'
,
:augeasversion
=>
'1.2.0'
,
:osfamily
=>
'Debian'
,
:rubyversion
=>
'1.9.3'
,
}
}
let
:pre_condition
do
"class { 'augeas': }"
end
context
'when not sending destination'
do
it
'should fail'
do
...
...
spec/fixtures/manifests/site.pp
deleted
100644 → 0
View file @
b61e5a9b
include
::augeas
if
$::needs_postfix_class
{
include
::postfix
}
if
$::needs_postfix_class_with_params
{
class
{
'::postfix'
:
relayhost
=>
'foo'
,
mydestination
=>
'bar'
,
mynetworks
=>
'baz'
,
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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