Add tests to validate 'none' communicator in the virtualbox builder

pull/7419/head
Vadym Haidamaka 7 years ago
parent 0263503c45
commit 414d0750f0

@ -0,0 +1,17 @@
package common
import (
"testing"
)
func TestGuestAdditionsConfigPrepare(t *testing.T) {
c := new(GuestAdditionsConfig)
var errs []error
c.GuestAdditionsMode = "disable"
c.Communicator = "none"
errs = c.Prepare(testConfigTemplate(t))
if len(errs) > 0 {
t.Fatalf("should not have error: %s", errs)
}
}

@ -62,3 +62,18 @@ func TestVBoxVersionConfigPrepare_empty(t *testing.T) {
t.Fatalf("bad value: %s", *c.VBoxVersionFile)
}
}
func TestVBoxVersionConfigPrepare_communicator(t *testing.T) {
var c *VBoxVersionConfig
var errs []error
// Test with 'none' communicator and non-empty virtualbox_version_file
c = new(VBoxVersionConfig)
filename := "test"
c.VBoxVersionFile = &filename
c.Communicator = "none"
errs = c.Prepare(testConfigTemplate(t))
if len(errs) == 0 {
t.Fatalf("should have an error")
}
}

Loading…
Cancel
Save