provisioner/chef-solo: alphabetize tests and such
/cc @netshade
This commit is contained in:
parent
710db8ded0
commit
543a1a21e8
|
@ -18,12 +18,12 @@ import (
|
||||||
type Config struct {
|
type Config struct {
|
||||||
common.PackerConfig `mapstructure:",squash"`
|
common.PackerConfig `mapstructure:",squash"`
|
||||||
|
|
||||||
|
ChefEnvironment string `mapstructure:"chef_environment"`
|
||||||
ConfigTemplate string `mapstructure:"config_template"`
|
ConfigTemplate string `mapstructure:"config_template"`
|
||||||
CookbookPaths []string `mapstructure:"cookbook_paths"`
|
CookbookPaths []string `mapstructure:"cookbook_paths"`
|
||||||
RolesPath string `mapstructure:"roles_path"`
|
RolesPath string `mapstructure:"roles_path"`
|
||||||
DataBagsPath string `mapstructure:"data_bags_path"`
|
DataBagsPath string `mapstructure:"data_bags_path"`
|
||||||
EnvironmentsPath string `mapstructure:"environments_path"`
|
EnvironmentsPath string `mapstructure:"environments_path"`
|
||||||
ChefEnvironment string `mapstructure:"chef_environment"`
|
|
||||||
ExecuteCommand string `mapstructure:"execute_command"`
|
ExecuteCommand string `mapstructure:"execute_command"`
|
||||||
InstallCommand string `mapstructure:"install_command"`
|
InstallCommand string `mapstructure:"install_command"`
|
||||||
RemoteCookbookPaths []string `mapstructure:"remote_cookbook_paths"`
|
RemoteCookbookPaths []string `mapstructure:"remote_cookbook_paths"`
|
||||||
|
|
|
@ -19,6 +19,22 @@ func TestProvisioner_Impl(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestProvisionerPrepare_chefEnvironment(t *testing.T) {
|
||||||
|
var p Provisioner
|
||||||
|
|
||||||
|
config := testConfig()
|
||||||
|
config["chef_environment"] = "some-env"
|
||||||
|
|
||||||
|
err := p.Prepare(config)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("err: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.config.ChefEnvironment != "some-env" {
|
||||||
|
t.Fatalf("unexpected: %#v", p.config.ChefEnvironment)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestProvisionerPrepare_configTemplate(t *testing.T) {
|
func TestProvisionerPrepare_configTemplate(t *testing.T) {
|
||||||
var err error
|
var err error
|
||||||
var p Provisioner
|
var p Provisioner
|
||||||
|
@ -139,28 +155,6 @@ func TestProvisionerPrepare_dataBagsPath(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProvisionerPrepare_rolesPath(t *testing.T) {
|
|
||||||
var p Provisioner
|
|
||||||
|
|
||||||
rolesPath, err := ioutil.TempDir("", "roles")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("err: %s", err)
|
|
||||||
}
|
|
||||||
defer os.Remove(rolesPath)
|
|
||||||
|
|
||||||
config := testConfig()
|
|
||||||
config["roles_path"] = rolesPath
|
|
||||||
|
|
||||||
err = p.Prepare(config)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("err: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if p.config.RolesPath != rolesPath {
|
|
||||||
t.Fatalf("unexpected: %#v", p.config.RolesPath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestProvisionerPrepare_environmentsPath(t *testing.T) {
|
func TestProvisionerPrepare_environmentsPath(t *testing.T) {
|
||||||
var p Provisioner
|
var p Provisioner
|
||||||
|
|
||||||
|
@ -183,19 +177,25 @@ func TestProvisionerPrepare_environmentsPath(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProvisionerPrepare_chefEnvironment(t *testing.T) {
|
func TestProvisionerPrepare_rolesPath(t *testing.T) {
|
||||||
var p Provisioner
|
var p Provisioner
|
||||||
|
|
||||||
config := testConfig()
|
rolesPath, err := ioutil.TempDir("", "roles")
|
||||||
config["chef_environment"] = "some-env"
|
if err != nil {
|
||||||
|
t.Fatalf("err: %s", err)
|
||||||
|
}
|
||||||
|
defer os.Remove(rolesPath)
|
||||||
|
|
||||||
err := p.Prepare(config)
|
config := testConfig()
|
||||||
|
config["roles_path"] = rolesPath
|
||||||
|
|
||||||
|
err = p.Prepare(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.config.ChefEnvironment != "some-env" {
|
if p.config.RolesPath != rolesPath {
|
||||||
t.Fatalf("unexpected: %#v", p.config.ChefEnvironment)
|
t.Fatalf("unexpected: %#v", p.config.RolesPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue