Fix tests
This commit is contained in:
parent
bce47bc1a9
commit
dae64707a5
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"testing"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/common"
|
||||
"context"
|
||||
)
|
||||
|
||||
func NewVMName() string {
|
||||
|
@ -35,7 +34,7 @@ func RenderConfig(config map[string]interface{}) string {
|
|||
|
||||
|
||||
func TestConn(t *testing.T) *driver.Driver {
|
||||
d, err := driver.NewDriver(context.TODO(), &driver.ConnectConfig{
|
||||
d, err := driver.NewDriver(&driver.ConnectConfig{
|
||||
VCenterServer: "vcenter.vsphere65.test",
|
||||
Username: "root",
|
||||
Password: "jetbrains",
|
||||
|
|
|
@ -5,14 +5,13 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
"math/rand"
|
||||
"context"
|
||||
)
|
||||
|
||||
// Defines whether acceptance tests should be run
|
||||
const TestHostName = "esxi-1.vsphere65.test"
|
||||
|
||||
func newTestDriver(t *testing.T) *Driver {
|
||||
d, err := NewDriver(context.TODO(), &ConnectConfig{
|
||||
d, err := NewDriver(&ConnectConfig{
|
||||
VCenterServer: "vcenter.vsphere65.test",
|
||||
Username: "root",
|
||||
Password: "jetbrains",
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"net"
|
||||
"testing"
|
||||
"time"
|
||||
"context"
|
||||
)
|
||||
|
||||
func TestVMAcc_clone(t *testing.T) {
|
||||
|
@ -38,7 +39,7 @@ func TestVMAcc_clone(t *testing.T) {
|
|||
}
|
||||
|
||||
log.Printf("[DEBUG] Clonning VM")
|
||||
vm, err := template.Clone(tc.config)
|
||||
vm, err := template.Clone(context.TODO(), tc.config)
|
||||
if err != nil {
|
||||
t.Fatalf("Cannot clone vm '%v': %v", templateName, err)
|
||||
}
|
||||
|
@ -227,7 +228,7 @@ func startAndStopCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) {
|
|||
stopper := startVM(t, vm, config.Name)
|
||||
defer stopper()
|
||||
|
||||
switch ip, err := vm.WaitForIP(); {
|
||||
switch ip, err := vm.WaitForIP(context.TODO()); {
|
||||
case err != nil:
|
||||
t.Errorf("Cannot obtain IP address from created vm '%v': %v", config.Name, err)
|
||||
case net.ParseIP(ip) == nil:
|
||||
|
@ -236,7 +237,7 @@ func startAndStopCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) {
|
|||
|
||||
vm.StartShutdown()
|
||||
log.Printf("[DEBUG] Waiting max 1m0s for shutdown to complete")
|
||||
vm.WaitForShutdown(1 * time.Minute)
|
||||
vm.WaitForShutdown(context.TODO(), 1 * time.Minute)
|
||||
}
|
||||
|
||||
func snapshotCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) {
|
||||
|
|
Loading…
Reference in New Issue