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
30fadde2
Commit
30fadde2
authored
Jun 28, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox: Tests for the defaults [GH-44]
parent
4abd1c22
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
builder/virtualbox/builder.go
builder/virtualbox/builder.go
+4
-4
builder/virtualbox/builder_test.go
builder/virtualbox/builder_test.go
+16
-1
No files found.
builder/virtualbox/builder.go
View file @
30fadde2
...
...
@@ -181,6 +181,10 @@ func (b *Builder) Prepare(raws ...interface{}) error {
b
.
config
.
RawShutdownTimeout
=
"5m"
}
if
b
.
config
.
RawSSHWaitTimeout
==
""
{
b
.
config
.
RawSSHWaitTimeout
=
"20m"
}
b
.
config
.
ShutdownTimeout
,
err
=
time
.
ParseDuration
(
b
.
config
.
RawShutdownTimeout
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Failed parsing shutdown_timeout: %s"
,
err
))
...
...
@@ -194,10 +198,6 @@ func (b *Builder) Prepare(raws ...interface{}) error {
errs
=
append
(
errs
,
errors
.
New
(
"An ssh_username must be specified."
))
}
if
b
.
config
.
RawSSHWaitTimeout
==
""
{
b
.
config
.
RawSSHWaitTimeout
=
"20m"
}
b
.
config
.
SSHWaitTimeout
,
err
=
time
.
ParseDuration
(
b
.
config
.
RawSSHWaitTimeout
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Failed parsing ssh_wait_timeout: %s"
,
err
))
...
...
builder/virtualbox/builder_test.go
View file @
30fadde2
...
...
@@ -68,6 +68,10 @@ func TestBuilderPrepare_BootWait(t *testing.T) {
t
.
Fatalf
(
"err: %s"
,
err
)
}
if
b
.
config
.
RawBootWait
!=
"10s"
{
t
.
Fatalf
(
"bad value: %s"
,
b
.
config
.
RawBootWait
)
}
// Test with a bad boot_wait
config
[
"boot_wait"
]
=
"this is not good"
err
=
b
.
Prepare
(
config
)
...
...
@@ -324,9 +328,20 @@ func TestBuilderPrepare_SSHWaitTimeout(t *testing.T) {
var
b
Builder
config
:=
testConfig
()
// Test a default boot_wait
delete
(
config
,
"ssh_wait_timeout"
)
err
:=
b
.
Prepare
(
config
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
if
b
.
config
.
RawSSHWaitTimeout
!=
"20m"
{
t
.
Fatalf
(
"bad value: %s"
,
b
.
config
.
RawSSHWaitTimeout
)
}
// Test with a bad value
config
[
"ssh_wait_timeout"
]
=
"this is not good"
err
:
=
b
.
Prepare
(
config
)
err
=
b
.
Prepare
(
config
)
if
err
==
nil
{
t
.
Fatal
(
"should have error"
)
}
...
...
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