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
e51dde13
Commit
e51dde13
authored
Dec 22, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox: tests for StepUploadVerison
parent
5f1c5972
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
16 deletions
+77
-16
builder/virtualbox/common/step_upload_version_test.go
builder/virtualbox/common/step_upload_version_test.go
+61
-0
builder/virtualbox/iso/builder.go
builder/virtualbox/iso/builder.go
+8
-8
builder/virtualbox/ovf/config.go
builder/virtualbox/ovf/config.go
+8
-8
No files found.
builder/virtualbox/common/step_upload_version_test.go
0 → 100644
View file @
e51dde13
package
common
import
(
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"testing"
)
func
TestStepUploadVersion_impl
(
t
*
testing
.
T
)
{
var
_
multistep
.
Step
=
new
(
StepUploadVersion
)
}
func
TestStepUploadVersion
(
t
*
testing
.
T
)
{
state
:=
testState
(
t
)
step
:=
new
(
StepUploadVersion
)
step
.
Path
=
"foopath"
comm
:=
new
(
packer
.
MockCommunicator
)
state
.
Put
(
"communicator"
,
comm
)
driver
:=
state
.
Get
(
"driver"
)
.
(
*
DriverMock
)
driver
.
VersionResult
=
"foo"
// 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"
)
}
// Verify
if
comm
.
UploadPath
!=
"foopath"
{
t
.
Fatalf
(
"bad: %#v"
,
comm
.
UploadPath
)
}
if
comm
.
UploadData
!=
"foo"
{
t
.
Fatalf
(
"upload data bad: %#v"
,
comm
.
UploadData
)
}
}
func
TestStepUploadVersion_noPath
(
t
*
testing
.
T
)
{
state
:=
testState
(
t
)
step
:=
new
(
StepUploadVersion
)
step
.
Path
=
""
comm
:=
new
(
packer
.
MockCommunicator
)
state
.
Put
(
"communicator"
,
comm
)
// 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"
)
}
// Verify
if
comm
.
UploadCalled
{
t
.
Fatal
(
"bad"
)
}
}
builder/virtualbox/iso/builder.go
View file @
e51dde13
...
...
@@ -27,14 +27,14 @@ type Builder struct {
}
type
config
struct
{
common
.
PackerConfig
`mapstructure:",squash"`
vboxcommon
.
ExportConfig
`mapstructure:",squash"`
vboxcommon
.
FloppyConfig
`mapstructure:",squash"`
vboxcommon
.
OutputConfig
`mapstructure:",squash"`
vboxcommon
.
RunConfig
`mapstructure:",squash"`
vboxcommon
.
ShutdownConfig
`mapstructure:",squash"`
vboxcommon
.
SSHConfig
`mapstructure:",squash"`
vboxcommon
.
VBoxManageConfig
`mapstructure:",squash"`
common
.
PackerConfig
`mapstructure:",squash"`
vboxcommon
.
ExportConfig
`mapstructure:",squash"`
vboxcommon
.
FloppyConfig
`mapstructure:",squash"`
vboxcommon
.
OutputConfig
`mapstructure:",squash"`
vboxcommon
.
RunConfig
`mapstructure:",squash"`
vboxcommon
.
ShutdownConfig
`mapstructure:",squash"`
vboxcommon
.
SSHConfig
`mapstructure:",squash"`
vboxcommon
.
VBoxManageConfig
`mapstructure:",squash"`
vboxcommon
.
VBoxVersionConfig
`mapstructure:",squash"`
BootCommand
[]
string
`mapstructure:"boot_command"`
...
...
builder/virtualbox/ovf/config.go
View file @
e51dde13
...
...
@@ -8,14 +8,14 @@ import (
// Config is the configuration structure for the builder.
type
Config
struct
{
common
.
PackerConfig
`mapstructure:",squash"`
vboxcommon
.
ExportConfig
`mapstructure:",squash"`
vboxcommon
.
FloppyConfig
`mapstructure:",squash"`
vboxcommon
.
OutputConfig
`mapstructure:",squash"`
vboxcommon
.
RunConfig
`mapstructure:",squash"`
vboxcommon
.
SSHConfig
`mapstructure:",squash"`
vboxcommon
.
ShutdownConfig
`mapstructure:",squash"`
vboxcommon
.
VBoxManageConfig
`mapstructure:",squash"`
common
.
PackerConfig
`mapstructure:",squash"`
vboxcommon
.
ExportConfig
`mapstructure:",squash"`
vboxcommon
.
FloppyConfig
`mapstructure:",squash"`
vboxcommon
.
OutputConfig
`mapstructure:",squash"`
vboxcommon
.
RunConfig
`mapstructure:",squash"`
vboxcommon
.
SSHConfig
`mapstructure:",squash"`
vboxcommon
.
ShutdownConfig
`mapstructure:",squash"`
vboxcommon
.
VBoxManageConfig
`mapstructure:",squash"`
vboxcommon
.
VBoxVersionConfig
`mapstructure:",squash"`
tpl
*
packer
.
ConfigTemplate
...
...
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