|
|
|
|
@ -122,3 +122,32 @@ func TestBuilderPrepare_ISOUrl(t *testing.T) {
|
|
|
|
|
t.Fatalf("iso_url should be modified: %s", b.config.ISOUrl)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestBuilderPrepare_SSHHostPort(t *testing.T) {
|
|
|
|
|
var b Builder
|
|
|
|
|
config := testConfig()
|
|
|
|
|
|
|
|
|
|
// Bad
|
|
|
|
|
config["ssh_host_port_min"] = 1000
|
|
|
|
|
config["ssh_host_port_max"] = 500
|
|
|
|
|
err := b.Prepare(config)
|
|
|
|
|
if err == nil {
|
|
|
|
|
t.Fatal("should have error")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Bad
|
|
|
|
|
config["ssh_host_port_min"] = -500
|
|
|
|
|
err = b.Prepare(config)
|
|
|
|
|
if err == nil {
|
|
|
|
|
t.Fatal("should have error")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Good
|
|
|
|
|
config["ssh_host_port_min"] = 500
|
|
|
|
|
config["ssh_host_port_max"] = 1000
|
|
|
|
|
err = b.Prepare(config)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|