github.com/sneal/packer@v0.5.2/builder/vmware/common/run_config_test.go (about) 1 package common 2 3 import ( 4 "testing" 5 ) 6 7 func TestRunConfigPrepare(t *testing.T) { 8 var c *RunConfig 9 10 // Test a default boot_wait 11 c = new(RunConfig) 12 c.RawBootWait = "" 13 errs := c.Prepare(testConfigTemplate(t)) 14 if len(errs) > 0 { 15 t.Fatalf("bad: %#v", errs) 16 } 17 if c.RawBootWait != "10s" { 18 t.Fatalf("bad value: %s", c.RawBootWait) 19 } 20 21 // Test with a bad boot_wait 22 c = new(RunConfig) 23 c.RawBootWait = "this is not good" 24 errs = c.Prepare(testConfigTemplate(t)) 25 if len(errs) == 0 { 26 t.Fatal("should error") 27 } 28 29 // Test with a good one 30 c = new(RunConfig) 31 c.RawBootWait = "5s" 32 errs = c.Prepare(testConfigTemplate(t)) 33 if len(errs) > 0 { 34 t.Fatalf("bad: %#v", errs) 35 } 36 }