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
607372f7
Commit
607372f7
authored
Aug 27, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provisioner/chef-solo: massive refactor and style nitpick
parent
4a5a8c60
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
106 additions
and
269 deletions
+106
-269
provisioner/chef-solo/provisioner.go
provisioner/chef-solo/provisioner.go
+94
-242
provisioner/chef-solo/provisioner_test.go
provisioner/chef-solo/provisioner_test.go
+12
-27
No files found.
provisioner/chef-solo/provisioner.go
View file @
607372f7
This diff is collapsed.
Click to expand it.
provisioner/chef-solo/provisioner_test.go
View file @
607372f7
...
...
@@ -8,9 +8,7 @@ import (
)
func
testConfig
()
map
[
string
]
interface
{}
{
return
map
[
string
]
interface
{}{
// "inline": []interface{}{"foo", "bar"},
}
return
map
[
string
]
interface
{}{}
}
func
TestProvisioner_Impl
(
t
*
testing
.
T
)
{
...
...
@@ -21,48 +19,35 @@ func TestProvisioner_Impl(t *testing.T) {
}
}
// Cookbook paths
//////////////////
func
TestProvisionerPrepare_DefaultCookbookPathIsUsed
(
t
*
testing
.
T
)
{
var
p
Provisioner
config
:=
testConfig
()
err
:=
p
.
Prepare
(
config
)
if
err
==
nil
{
t
.
Errorf
(
"expected error to be thrown for unavailable cookbook path"
)
}
if
len
(
p
.
config
.
CookbooksPaths
)
!=
1
||
p
.
config
.
CookbooksPaths
[
0
]
!=
DefaultCookbooksPath
{
t
.
Errorf
(
"unexpected default cookbook path: %s"
,
p
.
config
.
CookbooksPaths
)
}
}
func
TestProvisionerPrepare_GivenCookbookPathsAreAddedToConfig
(
t
*
testing
.
T
)
{
func
TestProvisionerPrepare_cookbookPaths
(
t
*
testing
.
T
)
{
var
p
Provisioner
path1
,
err
:=
ioutil
.
TempDir
(
""
,
"cookbooks_one"
)
if
err
!=
nil
{
t
.
Error
f
(
"err: %s"
,
err
)
t
.
Fatal
f
(
"err: %s"
,
err
)
}
path2
,
err
:=
ioutil
.
TempDir
(
""
,
"cookbooks_two"
)
if
err
!=
nil
{
t
.
Error
f
(
"err: %s"
,
err
)
t
.
Fatal
f
(
"err: %s"
,
err
)
}
defer
os
.
Remove
(
path1
)
defer
os
.
Remove
(
path2
)
config
:=
testConfig
()
config
[
"cookbook
s
_paths"
]
=
[]
string
{
path1
,
path2
}
config
[
"cookbook_paths"
]
=
[]
string
{
path1
,
path2
}
err
=
p
.
Prepare
(
config
)
if
err
!=
nil
{
t
.
Errorf
(
"err: %s"
,
err
)
t
.
Fatalf
(
"err: %s"
,
err
)
}
if
len
(
p
.
config
.
CookbookPaths
)
!=
2
{
t
.
Fatalf
(
"unexpected: %#v"
,
p
.
config
.
CookbookPaths
)
}
if
len
(
p
.
config
.
CookbooksPaths
)
!=
2
||
p
.
config
.
CookbooksPaths
[
0
]
!=
path1
||
p
.
config
.
Cookbooks
Paths
[
1
]
!=
path2
{
t
.
Errorf
(
"unexpected default cookbook path: %s"
,
p
.
config
.
Cookbooks
Paths
)
if
p
.
config
.
CookbookPaths
[
0
]
!=
path1
||
p
.
config
.
Cookbook
Paths
[
1
]
!=
path2
{
t
.
Fatalf
(
"unexpected: %#v"
,
p
.
config
.
Cookbook
Paths
)
}
}
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