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
85e615bb
Commit
85e615bb
authored
9 years ago
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer: a lot more provisioner tests
parent
b25ae21e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
0 deletions
+88
-0
packer/core_test.go
packer/core_test.go
+68
-0
packer/test-fixtures/build-prov-skip-include.json
packer/test-fixtures/build-prov-skip-include.json
+10
-0
packer/test-fixtures/build-prov-skip.json
packer/test-fixtures/build-prov-skip.json
+10
-0
No files found.
packer/core_test.go
View file @
85e615bb
...
...
@@ -154,6 +154,74 @@ func TestCoreBuild_prov(t *testing.T) {
}
}
func
TestCoreBuild_provSkip
(
t
*
testing
.
T
)
{
config
:=
TestCoreConfig
(
t
)
testCoreTemplate
(
t
,
config
,
fixtureDir
(
"build-prov-skip.json"
))
b
:=
TestBuilder
(
t
,
config
,
"test"
)
p
:=
TestProvisioner
(
t
,
config
,
"test"
)
core
:=
TestCore
(
t
,
config
)
b
.
ArtifactId
=
"hello"
build
,
err
:=
core
.
Build
(
"test"
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
if
_
,
err
:=
build
.
Prepare
();
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
artifact
,
err
:=
build
.
Run
(
nil
,
nil
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
if
len
(
artifact
)
!=
1
{
t
.
Fatalf
(
"bad: %#v"
,
artifact
)
}
if
artifact
[
0
]
.
Id
()
!=
b
.
ArtifactId
{
t
.
Fatalf
(
"bad: %s"
,
artifact
[
0
]
.
Id
())
}
if
p
.
ProvCalled
{
t
.
Fatal
(
"provisioner should not be called"
)
}
}
func
TestCoreBuild_provSkipInclude
(
t
*
testing
.
T
)
{
config
:=
TestCoreConfig
(
t
)
testCoreTemplate
(
t
,
config
,
fixtureDir
(
"build-prov-skip-include.json"
))
b
:=
TestBuilder
(
t
,
config
,
"test"
)
p
:=
TestProvisioner
(
t
,
config
,
"test"
)
core
:=
TestCore
(
t
,
config
)
b
.
ArtifactId
=
"hello"
build
,
err
:=
core
.
Build
(
"test"
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
if
_
,
err
:=
build
.
Prepare
();
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
artifact
,
err
:=
build
.
Run
(
nil
,
nil
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
if
len
(
artifact
)
!=
1
{
t
.
Fatalf
(
"bad: %#v"
,
artifact
)
}
if
artifact
[
0
]
.
Id
()
!=
b
.
ArtifactId
{
t
.
Fatalf
(
"bad: %s"
,
artifact
[
0
]
.
Id
())
}
if
!
p
.
ProvCalled
{
t
.
Fatal
(
"provisioner should be called"
)
}
}
func
TestCoreValidate
(
t
*
testing
.
T
)
{
cases
:=
[]
struct
{
File
string
...
...
This diff is collapsed.
Click to expand it.
packer/test-fixtures/build-prov-skip-include.json
0 → 100644
View file @
85e615bb
{
"builders"
:
[{
"type"
:
"test"
}],
"provisioners"
:
[{
"type"
:
"test"
,
"only"
:
[
"test"
]
}]
}
This diff is collapsed.
Click to expand it.
packer/test-fixtures/build-prov-skip.json
0 → 100644
View file @
85e615bb
{
"builders"
:
[{
"type"
:
"test"
}],
"provisioners"
:
[{
"type"
:
"test"
,
"only"
:
[
"foo"
]
}]
}
This diff is collapsed.
Click to expand it.
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