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
7e991af4
Commit
7e991af4
authored
May 10, 2014
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/vmware/common: tests for StepPrepareTools
/cc @rasa - an example
parent
1b1d8712
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
6 deletions
+62
-6
builder/vmware/common/step_prepare_tools.go
builder/vmware/common/step_prepare_tools.go
+4
-4
builder/vmware/common/step_prepare_tools_test.go
builder/vmware/common/step_prepare_tools_test.go
+58
-0
builder/vmware/iso/builder.go
builder/vmware/iso/builder.go
+0
-1
builder/vmware/vmx/builder.go
builder/vmware/vmx/builder.go
+0
-1
No files found.
builder/vmware/common/step_prepare_tools.go
View file @
7e991af4
...
...
@@ -2,14 +2,14 @@ package common
import
(
"fmt"
"github.com/mitchellh/multistep"
"os"
"github.com/mitchellh/multistep"
)
type
StepPrepareTools
struct
{
RemoteType
string
`mapstructure:"remote_type"`
ToolsUploadFlavor
string
`mapstructure:"tools_upload_flavor"`
ToolsUploadPath
string
`mapstructure:"tools_upload_path"`
RemoteType
string
ToolsUploadFlavor
string
}
func
(
c
*
StepPrepareTools
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
...
...
builder/vmware/common/step_prepare_tools_test.go
0 → 100644
View file @
7e991af4
package
common
import
(
"io/ioutil"
"os"
"testing"
"github.com/mitchellh/multistep"
)
func
TestStepPrepareTools_impl
(
t
*
testing
.
T
)
{
var
_
multistep
.
Step
=
new
(
StepPrepareTools
)
}
func
TestStepPrepareTools
(
t
*
testing
.
T
)
{
tf
,
err
:=
ioutil
.
TempFile
(
""
,
"packer"
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
tf
.
Close
()
defer
os
.
Remove
(
tf
.
Name
())
state
:=
testState
(
t
)
step
:=
&
StepPrepareTools
{
RemoteType
:
""
,
ToolsUploadFlavor
:
"foo"
,
}
driver
:=
state
.
Get
(
"driver"
)
.
(
*
DriverMock
)
// Mock results
driver
.
ToolsIsoPathResult
=
tf
.
Name
()
// Test the run
if
action
:=
step
.
Run
(
state
);
action
!=
multistep
.
ActionContinue
{
t
.
Fatalf
(
"bad action: %#v"
,
action
)
}
if
_
,
ok
:=
state
.
GetOk
(
"error"
);
ok
{
t
.
Fatal
(
"should NOT have error"
)
}
// Test the driver
if
!
driver
.
ToolsIsoPathCalled
{
t
.
Fatal
(
"tools iso path should be called"
)
}
if
driver
.
ToolsIsoPathFlavor
!=
"foo"
{
t
.
Fatalf
(
"bad: %#v"
,
driver
.
ToolsIsoPathFlavor
)
}
// Test the resulting state
path
,
ok
:=
state
.
GetOk
(
"tools_upload_source"
)
if
!
ok
{
t
.
Fatal
(
"should have tools_upload_source"
)
}
if
path
!=
tf
.
Name
()
{
t
.
Fatalf
(
"bad: %#v"
,
path
)
}
}
builder/vmware/iso/builder.go
View file @
7e991af4
...
...
@@ -312,7 +312,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&
vmwcommon
.
StepPrepareTools
{
RemoteType
:
b
.
config
.
RemoteType
,
ToolsUploadFlavor
:
b
.
config
.
ToolsUploadFlavor
,
ToolsUploadPath
:
b
.
config
.
ToolsUploadPath
,
},
&
common
.
StepDownload
{
Checksum
:
b
.
config
.
ISOChecksum
,
...
...
builder/vmware/vmx/builder.go
View file @
7e991af4
...
...
@@ -55,7 +55,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&
vmwcommon
.
StepPrepareTools
{
RemoteType
:
b
.
config
.
RemoteType
,
ToolsUploadFlavor
:
b
.
config
.
ToolsUploadFlavor
,
ToolsUploadPath
:
b
.
config
.
ToolsUploadPath
,
},
&
vmwcommon
.
StepOutputDir
{
Force
:
b
.
config
.
PackerForce
,
...
...
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