From 7646ecf8c64d4fb4f5a988809fa8a86628f0d55a Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Fri, 23 Oct 2020 15:35:37 -0700 Subject: [PATCH] fix tests --- builder/vsphere/common/step_remote_upload_test.go | 4 ++++ builder/vsphere/driver/datastore_mock.go | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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 == "" {