diff --git a/builder/vsphere/common/step_remote_upload_test.go b/builder/vsphere/common/step_remote_upload_test.go index 85526017d..44188dbfe 100644 --- a/builder/vsphere/common/step_remote_upload_test.go +++ b/builder/vsphere/common/step_remote_upload_test.go @@ -11,7 +11,11 @@ import ( func TestStepRemoteUpload_Run(t *testing.T) { state := basicStateBag(nil) + dsMock := driver.DatastoreMock{ + DirExistsReturn: false, + } driverMock := driver.NewDriverMock() + driverMock.DatastoreMock = &dsMock state.Put("driver", driverMock) state.Put("iso_path", "[datastore] iso/path") diff --git a/builder/vsphere/driver/datastore_mock.go b/builder/vsphere/driver/datastore_mock.go index 28757ee83..9330d9227 100644 --- a/builder/vsphere/driver/datastore_mock.go +++ b/builder/vsphere/driver/datastore_mock.go @@ -9,6 +9,9 @@ type DatastoreMock struct { FileExistsCalled bool FileExistsReturn bool + DirExistsCalled bool + DirExistsReturn bool + NameReturn string MakeDirectoryCalled bool @@ -38,7 +41,8 @@ func (ds *DatastoreMock) FileExists(path string) bool { } func (ds *DatastoreMock) DirExists(path string) bool { - return true + ds.DirExistsCalled = true + return ds.DirExistsReturn } func (ds *DatastoreMock) Name() string { if ds.NameReturn == "" {