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
a65dc929
Commit
a65dc929
authored
Nov 25, 2014
by
Emil Hessman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
post-processor/vagrant: test if vagrantfile_template exists
Test for #801
parent
3a8e0211
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
4 deletions
+29
-4
post-processor/vagrant/post-processor_test.go
post-processor/vagrant/post-processor_test.go
+29
-4
No files found.
post-processor/vagrant/post-processor_test.go
View file @
a65dc929
...
@@ -84,16 +84,22 @@ func TestPostProcessorPrepare_outputPath(t *testing.T) {
...
@@ -84,16 +84,22 @@ func TestPostProcessorPrepare_outputPath(t *testing.T) {
func
TestPostProcessorPrepare_subConfigs
(
t
*
testing
.
T
)
{
func
TestPostProcessorPrepare_subConfigs
(
t
*
testing
.
T
)
{
var
p
PostProcessor
var
p
PostProcessor
f
,
err
:=
ioutil
.
TempFile
(
""
,
"packer"
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
defer
os
.
Remove
(
f
.
Name
())
// Default
// Default
c
:=
testConfig
()
c
:=
testConfig
()
c
[
"compression_level"
]
=
42
c
[
"compression_level"
]
=
42
c
[
"vagrantfile_template"
]
=
"foo"
c
[
"vagrantfile_template"
]
=
f
.
Name
()
c
[
"override"
]
=
map
[
string
]
interface
{}{
c
[
"override"
]
=
map
[
string
]
interface
{}{
"aws"
:
map
[
string
]
interface
{}{
"aws"
:
map
[
string
]
interface
{}{
"compression_level"
:
7
,
"compression_level"
:
7
,
},
},
}
}
err
:
=
p
.
Configure
(
c
)
err
=
p
.
Configure
(
c
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
t
.
Fatalf
(
"err: %s"
,
err
)
}
}
...
@@ -102,7 +108,7 @@ func TestPostProcessorPrepare_subConfigs(t *testing.T) {
...
@@ -102,7 +108,7 @@ func TestPostProcessorPrepare_subConfigs(t *testing.T) {
t
.
Fatalf
(
"bad: %#v"
,
p
.
configs
[
""
]
.
CompressionLevel
)
t
.
Fatalf
(
"bad: %#v"
,
p
.
configs
[
""
]
.
CompressionLevel
)
}
}
if
p
.
configs
[
""
]
.
VagrantfileTemplate
!=
"foo"
{
if
p
.
configs
[
""
]
.
VagrantfileTemplate
!=
f
.
Name
()
{
t
.
Fatalf
(
"bad: %#v"
,
p
.
configs
[
""
]
.
VagrantfileTemplate
)
t
.
Fatalf
(
"bad: %#v"
,
p
.
configs
[
""
]
.
VagrantfileTemplate
)
}
}
...
@@ -110,11 +116,30 @@ func TestPostProcessorPrepare_subConfigs(t *testing.T) {
...
@@ -110,11 +116,30 @@ func TestPostProcessorPrepare_subConfigs(t *testing.T) {
t
.
Fatalf
(
"bad: %#v"
,
p
.
configs
[
"aws"
]
.
CompressionLevel
)
t
.
Fatalf
(
"bad: %#v"
,
p
.
configs
[
"aws"
]
.
CompressionLevel
)
}
}
if
p
.
configs
[
"aws"
]
.
VagrantfileTemplate
!=
"foo"
{
if
p
.
configs
[
"aws"
]
.
VagrantfileTemplate
!=
f
.
Name
()
{
t
.
Fatalf
(
"bad: %#v"
,
p
.
configs
[
"aws"
]
.
VagrantfileTemplate
)
t
.
Fatalf
(
"bad: %#v"
,
p
.
configs
[
"aws"
]
.
VagrantfileTemplate
)
}
}
}
}
func
TestPostProcessorPrepare_vagrantfileTemplateExists
(
t
*
testing
.
T
)
{
var
p
PostProcessor
f
,
err
:=
ioutil
.
TempFile
(
""
,
"packer"
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
c
:=
testConfig
()
c
[
"vagrantfile_template"
]
=
f
.
Name
()
os
.
Remove
(
f
.
Name
())
err
=
p
.
Configure
(
c
)
if
err
==
nil
{
t
.
Fatal
(
"expected an error since vagrantfile_template does not exist"
)
}
}
func
TestPostProcessorPostProcess_badId
(
t
*
testing
.
T
)
{
func
TestPostProcessorPostProcess_badId
(
t
*
testing
.
T
)
{
artifact
:=
&
packer
.
MockArtifact
{
artifact
:=
&
packer
.
MockArtifact
{
BuilderIdValue
:
"invalid.packer"
,
BuilderIdValue
:
"invalid.packer"
,
...
...
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