From fbd5a3c534cefd87d91419d10bf30719f21ac282 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 2 Oct 2013 08:28:51 -0700 Subject: [PATCH] provisioner/chef-solo: alphabetize tests and such /cc @netshade --- provisioner/chef-solo/provisioner.go | 2 +- provisioner/chef-solo/provisioner_test.go | 56 +++++++++++------------ 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/provisioner/chef-solo/provisioner.go b/provisioner/chef-solo/provisioner.go index c49c69625..a089356e6 100644 --- a/provisioner/chef-solo/provisioner.go +++ b/provisioner/chef-solo/provisioner.go @@ -18,12 +18,12 @@ import ( type Config struct { common.PackerConfig `mapstructure:",squash"` + ChefEnvironment string `mapstructure:"chef_environment"` ConfigTemplate string `mapstructure:"config_template"` CookbookPaths []string `mapstructure:"cookbook_paths"` RolesPath string `mapstructure:"roles_path"` DataBagsPath string `mapstructure:"data_bags_path"` EnvironmentsPath string `mapstructure:"environments_path"` - ChefEnvironment string `mapstructure:"chef_environment"` ExecuteCommand string `mapstructure:"execute_command"` InstallCommand string `mapstructure:"install_command"` RemoteCookbookPaths []string `mapstructure:"remote_cookbook_paths"` diff --git a/provisioner/chef-solo/provisioner_test.go b/provisioner/chef-solo/provisioner_test.go index 4cd744c30..46da3c465 100644 --- a/provisioner/chef-solo/provisioner_test.go +++ b/provisioner/chef-solo/provisioner_test.go @@ -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) { var err error 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) { 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 - config := testConfig() - config["chef_environment"] = "some-env" + rolesPath, err := ioutil.TempDir("", "roles") + 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 { t.Fatalf("err: %s", err) } - if p.config.ChefEnvironment != "some-env" { - t.Fatalf("unexpected: %#v", p.config.ChefEnvironment) + if p.config.RolesPath != rolesPath { + t.Fatalf("unexpected: %#v", p.config.RolesPath) } }