Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
8404f6ce
Commit
8404f6ce
authored
Feb 24, 2015
by
David Danzilio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Taking a stab at a test for the facter facts
parent
d1445bc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
provisioner/puppet-masterless/provisioner_test.go
provisioner/puppet-masterless/provisioner_test.go
+44
-0
No files found.
provisioner/puppet-masterless/provisioner_test.go
View file @
8404f6ce
...
...
@@ -133,3 +133,47 @@ func TestProvisionerPrepare_modulePaths(t *testing.T) {
t
.
Fatalf
(
"err: %s"
,
err
)
}
}
func
TestProvisionerPrepare_facterFacts
(
t
*
testing
.
T
)
{
config
:=
testConfig
()
delete
(
config
,
"facter"
)
p
:=
new
(
Provisioner
)
err
:=
p
.
Prepare
(
config
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
// Test with malformed fact
config
[
"facter"
]
=
"fact=stringified"
p
=
new
(
Provisioner
)
err
=
p
.
Prepare
(
config
)
if
err
==
nil
{
t
.
Fatal
(
"should be an error"
)
}
// Test with a good one
td
,
err
:=
ioutil
.
TempDir
(
""
,
"packer"
)
if
err
!=
nil
{
t
.
Fatalf
(
"error: %s"
,
err
)
}
defer
os
.
RemoveAll
(
td
)
facts
:=
make
(
map
[
string
]
string
)
facts
[
"fact_name"
]
=
"fact_value"
config
[
"facter"
]
=
facts
p
=
new
(
Provisioner
)
err
=
p
.
Prepare
(
config
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
// Make sure the default facts are present
delete
(
config
,
"facter"
)
p
=
new
(
Provisioner
)
err
=
p
.
Prepare
(
config
)
if
p
.
config
.
Facter
==
nil
{
t
.
Fatalf
(
"err: Default facts are not set in the Puppet provisioner!"
)
}
}
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