2017-11-13 16:02:46 -05:00
|
|
|
package driver
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2018-10-31 17:42:24 -04:00
|
|
|
"math/rand"
|
2018-10-30 18:10:57 -04:00
|
|
|
"os"
|
2017-11-13 16:02:46 -05:00
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Defines whether acceptance tests should be run
|
2018-01-24 08:35:04 -05:00
|
|
|
const TestHostName = "esxi-1.vsphere65.test"
|
2017-11-13 16:02:46 -05:00
|
|
|
|
|
|
|
func newTestDriver(t *testing.T) *Driver {
|
2018-10-30 18:10:57 -04:00
|
|
|
username := os.Getenv("VSPHERE_USERNAME")
|
|
|
|
if username == "" {
|
|
|
|
username = "root"
|
|
|
|
}
|
|
|
|
password := os.Getenv("VSPHERE_PASSWORD")
|
|
|
|
if password == "" {
|
|
|
|
password = "jetbrains"
|
|
|
|
}
|
|
|
|
|
2018-05-16 09:53:32 -04:00
|
|
|
d, err := NewDriver(&ConnectConfig{
|
2018-01-23 14:51:05 -05:00
|
|
|
VCenterServer: "vcenter.vsphere65.test",
|
2018-10-30 18:10:57 -04:00
|
|
|
Username: username,
|
|
|
|
Password: password,
|
2017-11-13 16:02:46 -05:00
|
|
|
InsecureConnection: true,
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Cannot connect: %v", err)
|
|
|
|
}
|
|
|
|
return d
|
|
|
|
}
|
|
|
|
|
|
|
|
func newVMName() string {
|
|
|
|
rand.Seed(time.Now().UTC().UnixNano())
|
|
|
|
return fmt.Sprintf("test-%v", rand.Intn(1000))
|
|
|
|
}
|