Skip to content

Commit

Permalink
tests: remove unnecessary AddCdromCalled (#352)
Browse files Browse the repository at this point in the history
There is an AddCdromCalledTimes which serves the same purpose
  • Loading branch information
Hi-Angel authored Jan 9, 2024
1 parent 830cace commit 46983ba
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 7 deletions.
4 changes: 0 additions & 4 deletions builder/vsphere/common/step_add_cdrom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ func TestStepAddCDRom_Run(t *testing.T) {
expectedAction: multistep.ActionContinue,
expectedVmMock: &driver.VirtualMachineMock{
FindSATAControllerCalled: true,
AddCdromCalled: true,
AddCdromCalledTimes: 3,
AddCdromTypes: []string{"sata", "sata", "sata"},
AddCdromPaths: []string{"remote/path", "iso/path", "cd/path"},
Expand Down Expand Up @@ -154,7 +153,6 @@ func TestStepAddCDRom_Run(t *testing.T) {
vmMock: new(driver.VirtualMachineMock),
expectedAction: multistep.ActionContinue,
expectedVmMock: &driver.VirtualMachineMock{
AddCdromCalled: true,
AddCdromCalledTimes: 1,
AddCdromTypes: []string{"ide"},
AddCdromPaths: []string{"iso/path"},
Expand All @@ -175,7 +173,6 @@ func TestStepAddCDRom_Run(t *testing.T) {
},
expectedAction: multistep.ActionHalt,
expectedVmMock: &driver.VirtualMachineMock{
AddCdromCalled: true,
AddCdromCalledTimes: 1,
AddCdromTypes: []string{""},
AddCdromPaths: []string{"iso/path"},
Expand All @@ -194,7 +191,6 @@ func TestStepAddCDRom_Run(t *testing.T) {
},
expectedAction: multistep.ActionHalt,
expectedVmMock: &driver.VirtualMachineMock{
AddCdromCalled: true,
AddCdromCalledTimes: 1,
AddCdromTypes: []string{""},
AddCdromPaths: []string{"remote/path"},
Expand Down
1 change: 0 additions & 1 deletion builder/vsphere/common/step_reattach_cdrom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func TestStepReattachCDRom_Run(t *testing.T) {
RemoveCdromsCalled: true,
ReattachCDRomsCalled: true,
FindSATAControllerCalled: true,
AddCdromCalled: true,
AddCdromCalledTimes: 8,
AddCdromTypes: []string{
"sata", "sata",
Expand Down
2 changes: 0 additions & 2 deletions builder/vsphere/driver/vm_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type VirtualMachineMock struct {
AddSATAControllerCalled bool
AddSATAControllerErr error

AddCdromCalled bool
AddCdromCalledTimes int
AddCdromErr error
AddCdromTypes []string
Expand Down Expand Up @@ -188,7 +187,6 @@ func (vm *VirtualMachineMock) GetDir() (string, error) {

func (vm *VirtualMachineMock) AddCdrom(cdromType string, isoPath string) error {
vm.AddCdromCalledTimes++
vm.AddCdromCalled = true
vm.AddCdromTypes = append(vm.AddCdromTypes, cdromType)
vm.AddCdromPaths = append(vm.AddCdromPaths, isoPath)
return vm.AddCdromErr
Expand Down

0 comments on commit 46983ba

Please # to comment.