diff --git a/builder/vsphere/driver/vm_test.go b/builder/vsphere/driver/vm_test.go index 3f05feca..e1596658 100644 --- a/builder/vsphere/driver/vm_test.go +++ b/builder/vsphere/driver/vm_test.go @@ -7,30 +7,9 @@ import ( "context" "testing" - "github.com/vmware/govmomi/simulator" - "github.com/vmware/govmomi/vim25/methods" - "github.com/vmware/govmomi/vim25/soap" "github.com/vmware/govmomi/vim25/types" ) -// ReconfigureFail changes the behavior of simulator.VirtualMachine -type ReconfigureFail struct { - *simulator.VirtualMachine -} - -// Override simulator.VirtualMachine.ReconfigVMTask to inject faults -func (vm *ReconfigureFail) ReconfigVMTask(req *types.ReconfigVM_Task) soap.HasFault { - task := simulator.CreateTask(req.This, "reconfigure", func(*simulator.Task) (types.AnyType, types.BaseMethodFault) { - return nil, &types.TaskInProgress{} - }) - - return &methods.ReconfigVM_TaskBody{ - Res: &types.ReconfigVM_TaskResponse{ - Returnval: task.Run(simulator.SpoofContext()), - }, - } -} - func TestVirtualMachineDriver_Configure(t *testing.T) { sim, err := NewVCenterSimulator() if err != nil { @@ -38,7 +17,7 @@ func TestVirtualMachineDriver_Configure(t *testing.T) { } defer sim.Close() - vm, machine := sim.ChooseSimulatorPreCreatedVM() + vm, _ := sim.ChooseSimulatorPreCreatedVM() // Happy test hardwareConfig := &HardwareConfig{ @@ -58,13 +37,6 @@ func TestVirtualMachineDriver_Configure(t *testing.T) { if err = vm.Configure(hardwareConfig); err != nil { t.Fatalf("should not fail: %s", err.Error()) } - - //Fail test - //Wrap the existing vm object with the mocked reconfigure task which will return a fault - simulator.Map.Put(&ReconfigureFail{machine}) - if err = vm.Configure(&HardwareConfig{}); err == nil { - t.Fatalf("Configure should fail") - } } func TestVirtualMachineDriver_CreateVMWithMultipleDisks(t *testing.T) { diff --git a/go.mod b/go.mod index 9073523c..41dbc558 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/vmware-tanzu/image-registry-operator-api v0.0.0-20230523235530-62ec5758f097 github.com/vmware-tanzu/vm-operator/api v0.0.0-20230424164826-7ee71aebc7b1 - github.com/vmware/govmomi v0.36.2 + github.com/vmware/govmomi v0.37.1 github.com/zclconf/go-cty v1.13.3 golang.org/x/mobile v0.0.0-20210901025245-1fde1d6c3ca1 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index db4c83b1..14e880ec 100644 --- a/go.sum +++ b/go.sum @@ -499,8 +499,8 @@ github.com/vmware-tanzu/image-registry-operator-api v0.0.0-20230523235530-62ec57 github.com/vmware-tanzu/image-registry-operator-api v0.0.0-20230523235530-62ec5758f097/go.mod h1:S0HMBgdo3S/0a5hwq+Ya4XZI2aEDtGkSGeojU1cINOg= github.com/vmware-tanzu/vm-operator/api v0.0.0-20230424164826-7ee71aebc7b1 h1:krW4K3Vj8DkVqLMUOlW1OMLr1BY9Lg+PLZ7mAzlJz/A= github.com/vmware-tanzu/vm-operator/api v0.0.0-20230424164826-7ee71aebc7b1/go.mod h1:vauVboD3sQxP+pb28TnI9wfrj+0nH2zSEc9Q7AzWJ54= -github.com/vmware/govmomi v0.36.2 h1:fFTicZmjwPCiBJGyKLZ5Ty9JbTgBPVSXJDv1Duw0r7c= -github.com/vmware/govmomi v0.36.2/go.mod h1:mtGWtM+YhTADHlCgJBiskSRPOZRsN9MSjPzaZLte/oQ= +github.com/vmware/govmomi v0.37.1 h1:SpI+Ofq+lC1zsLcJ9szLSb7fL4TypReVvUoWIgk2b6U= +github.com/vmware/govmomi v0.37.1/go.mod h1:mtGWtM+YhTADHlCgJBiskSRPOZRsN9MSjPzaZLte/oQ= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=