Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Puppet Camptocamp Postfix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Projets publics
Puppet Camptocamp Postfix
Commits
2ff84825
Commit
2ff84825
authored
May 23, 2013
by
Raphaël Pinson
Browse files
Options
Downloads
Patches
Plain Diff
Add spec for postfix::config
parent
f3d4c00e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
manifests/config.pp
+5
-0
5 additions, 0 deletions
manifests/config.pp
spec/defines/postfix_config_spec.rb
+77
-0
77 additions, 0 deletions
spec/defines/postfix_config_spec.rb
with
82 additions
and
0 deletions
manifests/config.pp
+
5
−
0
View file @
2ff84825
...
...
@@ -29,6 +29,11 @@
#
define
postfix::config
(
$value
,
$ensure
=
present
)
{
validate_string
(
$value
)
validate_string
(
$ensure
)
validate_re
(
$ensure
,
[
'present'
,
'absent'
],
"
\$
ensure must be either 'present' or 'absent', got '
${ensure}
'"
)
Augeas
{
incl
=>
'/etc/postfix/main.cf'
,
lens
=>
'Postfix_Main.lns'
,
...
...
This diff is collapsed.
Click to expand it.
spec/defines/postfix_config_spec.rb
0 → 100644
+
77
−
0
View file @
2ff84825
require
'spec_helper'
describe
'postfix::config'
do
let
(
:title
)
{
'foo'
}
let
(
:facts
)
{
{
:osfamily
=>
'Debian'
,
}
}
context
'when not passing value'
do
it
'should fail'
do
expect
{
should
contain_augeas
(
"set postfix 'foo'"
)
}.
to
raise_error
(
Puppet
::
Error
,
/Must pass value to Postfix::Config/
)
end
end
context
'when passing wrong type for value'
do
let
(
:params
)
{
{
:value
=>
[
'bar'
],
}
}
it
'should fail'
do
expect
{
should
contain_augeas
(
"set postfix 'foo'"
)
}.
to
raise_error
(
Puppet
::
Error
,
/\["bar"\] is not a string/
)
end
end
context
'when passing wrong type for ensure'
do
let
(
:params
)
{
{
:value
=>
'bar'
,
:ensure
=>
[
'present'
],
}
}
it
'should fail'
do
expect
{
should
contain_augeas
(
"set postfix 'foo'"
)
}.
to
raise_error
(
Puppet
::
Error
,
/\["present"\] is not a string/
)
end
end
context
'when passing wrong value for ensure'
do
let
(
:params
)
{
{
:value
=>
'bar'
,
:ensure
=>
'running'
,
}
}
it
'should fail'
do
expect
{
should
contain_augeas
(
"set postfix 'foo'"
)
}.
to
raise_error
(
Puppet
::
Error
,
/must be either 'present' or 'absent'/
)
end
end
context
'when ensuring presence'
do
let
(
:params
)
{
{
:value
=>
'bar'
,
:ensure
=>
'present'
,
}
}
it
{
should
contain_augeas
(
"set postfix 'foo' to 'bar'"
).
with
(
:incl
=>
'/etc/postfix/main.cf'
,
:lens
=>
'Postfix_Main.lns'
,
:changes
=>
"set foo 'bar'"
)
}
end
context
'when ensuring absence'
do
let
(
:params
)
{
{
:value
=>
'bar'
,
:ensure
=>
'absent'
,
}
}
it
{
should
contain_augeas
(
"rm postfix 'foo'"
).
with
(
:incl
=>
'/etc/postfix/main.cf'
,
:lens
=>
'Postfix_Main.lns'
,
:changes
=>
"rm foo"
)
}
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment