github.phpd.cn/hashicorp/packer@v1.3.2/builder/parallels/common/prlctl_version_config_test.go (about) 1 package common 2 3 import ( 4 "testing" 5 ) 6 7 func TestPrlctlVersionConfigPrepare_BootWait(t *testing.T) { 8 var c *PrlctlVersionConfig 9 var errs []error 10 11 // Test empty 12 c = new(PrlctlVersionConfig) 13 errs = c.Prepare(testConfigTemplate(t)) 14 if len(errs) > 0 { 15 t.Fatalf("should not have error: %s", errs) 16 } 17 18 if c.PrlctlVersionFile != ".prlctl_version" { 19 t.Fatalf("bad value: %s", c.PrlctlVersionFile) 20 } 21 22 // Test with a good one 23 c = new(PrlctlVersionConfig) 24 c.PrlctlVersionFile = "foo" 25 errs = c.Prepare(testConfigTemplate(t)) 26 if len(errs) > 0 { 27 t.Fatalf("should not have error: %s", errs) 28 } 29 30 if c.PrlctlVersionFile != "foo" { 31 t.Fatalf("bad value: %s", c.PrlctlVersionFile) 32 } 33 }