From 8082cd5199e120c7131fd700977853d99414fb22 Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Tue, 26 Dec 2023 17:25:31 +0300 Subject: [PATCH] tests: remove unnecessary AddCdromCalled There is an AddCdromCalledTimes which serves the same purpose --- builder/vsphere/common/step_add_cdrom_test.go | 4 ---- builder/vsphere/common/step_reattach_cdrom_test.go | 1 - builder/vsphere/driver/vm_mock.go | 2 -- 3 files changed, 7 deletions(-) diff --git a/builder/vsphere/common/step_add_cdrom_test.go b/builder/vsphere/common/step_add_cdrom_test.go index 2e997830..18018cfd 100644 --- a/builder/vsphere/common/step_add_cdrom_test.go +++ b/builder/vsphere/common/step_add_cdrom_test.go @@ -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"}, @@ -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"}, @@ -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"}, @@ -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"}, diff --git a/builder/vsphere/common/step_reattach_cdrom_test.go b/builder/vsphere/common/step_reattach_cdrom_test.go index d624ae72..6d80a4b0 100644 --- a/builder/vsphere/common/step_reattach_cdrom_test.go +++ b/builder/vsphere/common/step_reattach_cdrom_test.go @@ -46,7 +46,6 @@ func TestStepReattachCDRom_Run(t *testing.T) { RemoveCdromsCalled: true, ReattachCDRomsCalled: true, FindSATAControllerCalled: true, - AddCdromCalled: true, AddCdromCalledTimes: 8, AddCdromTypes: []string{ "sata", "sata", diff --git a/builder/vsphere/driver/vm_mock.go b/builder/vsphere/driver/vm_mock.go index 9868875d..34aa2d7a 100644 --- a/builder/vsphere/driver/vm_mock.go +++ b/builder/vsphere/driver/vm_mock.go @@ -30,7 +30,6 @@ type VirtualMachineMock struct { AddSATAControllerCalled bool AddSATAControllerErr error - AddCdromCalled bool AddCdromCalledTimes int AddCdromErr error AddCdromTypes []string @@ -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