Skip to content

Commit

Permalink
chore(deps): bump github.com/vmware/govmomi from 0.36.2 to 0.37.1
Browse files Browse the repository at this point in the history
- Updates `vmware/govmom` from 0.36.2 to 0.37.1.
- Due to a change in 0.37.0 of `vmware/govmom`, the `ReconfigureFail` needed to be removed. The CreateTask method in the TaskManager struct was updated. The new method now checks if the provided TaskTypeId is valid before proceeding. If it's not valid, it returns a SOAP fault with an InvalidArgument error.

Ref: vmware/govmomi@9c59e9c#diff-b69f2c4e19456b811639643ed5dfe09357a280ac81b47249a14d6e625ef46317

Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
  • Loading branch information
tenthirtyam authored and lbajolet-hashicorp committed May 9, 2024
1 parent af545bc commit f0b7325
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 32 deletions.
30 changes: 1 addition & 29 deletions builder/vsphere/driver/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,17 @@ 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 {
t.Fatalf("should not fail: %s", err.Error())
}
defer sim.Close()

vm, machine := sim.ChooseSimulatorPreCreatedVM()
vm, _ := sim.ChooseSimulatorPreCreatedVM()

// Happy test
hardwareConfig := &HardwareConfig{
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit f0b7325

Please sign in to comment.