add a BackupStore to pkg/persistence that supports prefixes

Signed-off-by: Steve Kriss <steve@heptio.com>
This commit is contained in:
Steve Kriss
2018-09-06 10:53:58 -06:00
parent af64069d65
commit f0edf7335f
28 changed files with 1391 additions and 1068 deletions
+10
View File
@@ -110,3 +110,13 @@ func AssertDeepEqual(t *testing.T, expected, actual interface{}) bool {
return true
}
// AssertErrorMatches asserts that if expected is the empty string, actual
// is nil, otherwise, that actual's error string matches expected.
func AssertErrorMatches(t *testing.T, expected string, actual error) bool {
if expected != "" {
return assert.EqualError(t, actual, expected)
}
return assert.NoError(t, actual)
}
+7 -7
View File
@@ -98,13 +98,13 @@ func (_m *ObjectStore) Init(config map[string]string) error {
return r0
}
// ListCommonPrefixes provides a mock function with given fields: bucket, delimiter
func (_m *ObjectStore) ListCommonPrefixes(bucket string, delimiter string) ([]string, error) {
ret := _m.Called(bucket, delimiter)
// ListCommonPrefixes provides a mock function with given fields: bucket, prefix, delimiter
func (_m *ObjectStore) ListCommonPrefixes(bucket string, prefix string, delimiter string) ([]string, error) {
ret := _m.Called(bucket, prefix, delimiter)
var r0 []string
if rf, ok := ret.Get(0).(func(string, string) []string); ok {
r0 = rf(bucket, delimiter)
if rf, ok := ret.Get(0).(func(string, string, string) []string); ok {
r0 = rf(bucket, prefix, delimiter)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
@@ -112,8 +112,8 @@ func (_m *ObjectStore) ListCommonPrefixes(bucket string, delimiter string) ([]st
}
var r1 error
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(bucket, delimiter)
if rf, ok := ret.Get(1).(func(string, string, string) error); ok {
r1 = rf(bucket, prefix, delimiter)
} else {
r1 = ret.Error(1)
}