Skip to content

Commit

Permalink
move ObjectStore mock into pkg/cloudprovider/mocks
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Kriss <steve@heptio.com>
  • Loading branch information
skriss committed Sep 6, 2018
1 parent f0edf73 commit 7d8813a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/persistence/object_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (

api "github.com/heptio/ark/pkg/apis/ark/v1"
"github.com/heptio/ark/pkg/cloudprovider"
cloudprovidermocks "github.com/heptio/ark/pkg/cloudprovider/mocks"
"github.com/heptio/ark/pkg/util/encode"
arktest "github.com/heptio/ark/pkg/util/test"
)
Expand Down Expand Up @@ -265,7 +266,7 @@ func TestDeleteBackup(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
objectStore := new(arktest.ObjectStore)
objectStore := new(cloudprovidermocks.ObjectStore)
backupStore := &objectBackupStore{
objectStore: objectStore,
bucket: "test-bucket",
Expand Down
13 changes: 7 additions & 6 deletions pkg/plugin/restartable_object_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ import (
"testing"
"time"

"github.com/heptio/ark/pkg/util/test"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

cloudprovidermocks "github.com/heptio/ark/pkg/cloudprovider/mocks"
)

func TestRestartableGetObjectStore(t *testing.T) {
Expand All @@ -47,7 +48,7 @@ func TestRestartableGetObjectStore(t *testing.T) {
},
{
name: "happy path",
plugin: new(test.ObjectStore),
plugin: new(cloudprovidermocks.ObjectStore),
},
}

Expand Down Expand Up @@ -95,7 +96,7 @@ func TestRestartableObjectStoreReinitialize(t *testing.T) {
err := r.reinitialize(3)
assert.EqualError(t, err, "int is not a cloudprovider.ObjectStore!")

objectStore := new(test.ObjectStore)
objectStore := new(cloudprovidermocks.ObjectStore)
objectStore.Test(t)
defer objectStore.AssertExpectations(t)

Expand Down Expand Up @@ -127,7 +128,7 @@ func TestRestartableObjectStoreGetDelegate(t *testing.T) {

// Happy path
p.On("resetIfNeeded").Return(nil)
objectStore := new(test.ObjectStore)
objectStore := new(cloudprovidermocks.ObjectStore)
objectStore.Test(t)
defer objectStore.AssertExpectations(t)
p.On("getByKindAndName", key).Return(objectStore, nil)
Expand Down Expand Up @@ -158,7 +159,7 @@ func TestRestartableObjectStoreInit(t *testing.T) {
assert.EqualError(t, err, "getByKindAndName error")

// Delegate returns error
objectStore := new(test.ObjectStore)
objectStore := new(cloudprovidermocks.ObjectStore)
objectStore.Test(t)
defer objectStore.AssertExpectations(t)
p.On("getByKindAndName", key).Return(objectStore, nil)
Expand Down Expand Up @@ -192,7 +193,7 @@ func TestRestartableObjectStoreDelegatedFunctions(t *testing.T) {
}
},
func() mockable {
return new(test.ObjectStore)
return new(cloudprovidermocks.ObjectStore)
},
restartableDelegateTest{
function: "PutObject",
Expand Down

0 comments on commit 7d8813a

Please sign in to comment.