update tests for mapstructure behavior changes

This commit is contained in:
Matthew Hooker 2018-01-26 12:40:34 -08:00
parent 0e5be59947
commit fad4d5c272
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 12 additions and 2 deletions

View File

@ -71,11 +71,16 @@ func TestBuilderPrepare_ChrootMounts(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("err: %s", err) t.Errorf("err: %s", err)
} }
}
func TestBuilderPrepare_ChrootMountsBadDefaults(t *testing.T) {
b := &Builder{}
config := testConfig()
config["chroot_mounts"] = [][]string{ config["chroot_mounts"] = [][]string{
{"bad"}, {"bad"},
} }
warnings, err = b.Prepare(config) warnings, err := b.Prepare(config)
if len(warnings) > 0 { if len(warnings) > 0 {
t.Fatalf("bad: %#v", warnings) t.Fatalf("bad: %#v", warnings)
} }
@ -135,9 +140,14 @@ func TestBuilderPrepare_CopyFiles(t *testing.T) {
if len(b.config.CopyFiles) != 1 && b.config.CopyFiles[0] != "/etc/resolv.conf" { if len(b.config.CopyFiles) != 1 && b.config.CopyFiles[0] != "/etc/resolv.conf" {
t.Errorf("Was expecting default value for copy_files.") t.Errorf("Was expecting default value for copy_files.")
} }
}
func TestBuilderPrepare_CopyFilesNoDefault(t *testing.T) {
b := &Builder{}
config := testConfig()
config["copy_files"] = []string{} config["copy_files"] = []string{}
warnings, err = b.Prepare(config) warnings, err := b.Prepare(config)
if len(warnings) > 0 { if len(warnings) > 0 {
t.Fatalf("bad: %#v", warnings) t.Fatalf("bad: %#v", warnings)
} }