diff --git a/TODO.md b/TODO.md index fdbe7b6d6..2bc590232 100644 --- a/TODO.md +++ b/TODO.md @@ -1,7 +1,7 @@ * builder/amazonebs: Copy AMI to multiple regions * builder/amazonebs: Add unique ID to AMI name so multiple can be made * builder/vmware: Downloading the ISO -* builder/vmware: Find open port for HTTP/VNC +* builder/vmware: Find open port for HTTP * builder/vmware: VMX templates * builder/vmware: VMX key/values * communicator/ssh: Ability to re-establish connection diff --git a/builder/vmware/builder_test.go b/builder/vmware/builder_test.go index ab4ce436a..3d01b73cd 100644 --- a/builder/vmware/builder_test.go +++ b/builder/vmware/builder_test.go @@ -137,3 +137,31 @@ func TestBuilderPrepare_SSHWaitTimeout(t *testing.T) { t.Fatalf("should not have error: %s", err) } } + +func TestBuilderPrepare_VNCPort(t *testing.T) { + var b Builder + config := testConfig() + + // Bad + config["vnc_port_min"] = 1000 + config["vnc_port_max"] = 500 + err := b.Prepare(config) + if err == nil { + t.Fatal("should have error") + } + + // Bad + config["vnc_port_min"] = -500 + err = b.Prepare(config) + if err == nil { + t.Fatal("should have error") + } + + // Good + config["vnc_port_min"] = 500 + config["vnc_port_max"] = 1000 + err = b.Prepare(config) + if err != nil { + t.Fatalf("should not have error: %s", err) + } +}