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
1de1350e
Commit
1de1350e
authored
Nov 24, 2014
by
Emil Hessman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
post-processor/vagrant: test for user variables in vagrantfile_template [GH-1125]
Previously fixed in
a4761087
Closes #1125
parent
87001dba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
post-processor/vagrant/post-processor_test.go
post-processor/vagrant/post-processor_test.go
+37
-0
No files found.
post-processor/vagrant/post-processor_test.go
View file @
1de1350e
...
...
@@ -4,6 +4,8 @@ import (
"bytes"
"compress/flate"
"github.com/mitchellh/packer/packer"
"io/ioutil"
"os"
"strings"
"testing"
)
...
...
@@ -124,6 +126,41 @@ func TestPostProcessorPostProcess_badId(t *testing.T) {
}
}
func
TestPostProcessorPostProcess_vagrantfileUserVariable
(
t
*
testing
.
T
)
{
var
p
PostProcessor
f
,
err
:=
ioutil
.
TempFile
(
""
,
"packer"
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
defer
os
.
Remove
(
f
.
Name
())
c
:=
map
[
string
]
interface
{}{
"packer_user_variables"
:
map
[
string
]
string
{
"foo"
:
f
.
Name
(),
},
"vagrantfile_template"
:
"{{user `foo`}}"
,
}
err
=
p
.
Configure
(
c
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
a
:=
&
packer
.
MockArtifact
{
BuilderIdValue
:
"packer.parallels"
,
}
a2
,
_
,
err
:=
p
.
PostProcess
(
testUi
(),
a
)
if
a2
!=
nil
{
for
_
,
fn
:=
range
a2
.
Files
()
{
defer
os
.
Remove
(
fn
)
}
}
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
}
func
TestProviderForName
(
t
*
testing
.
T
)
{
if
v
,
ok
:=
providerForName
(
"virtualbox"
)
.
(
*
VBoxProvider
);
!
ok
{
t
.
Fatalf
(
"bad: %#v"
,
v
)
...
...
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