tusd/pkg/s3store/s3store_mock_test.go

258 lines
11 KiB
Go
Raw Normal View History

2019-09-15 12:33:02 +00:00
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/tus/tusd/pkg/s3store (interfaces: S3API)
2016-01-05 17:21:53 +00:00
2019-09-15 12:33:02 +00:00
// Package s3store is a generated GoMock package.
s3store: calculate part size based on upload size See https://github.com/tus/tusd/issues/149 and https://github.com/tus/tusd/pull/150 for more details. Squashed commit of the following: commit 78312ab26ea7ee664038e5b5d362bd534bfe0e37 Author: Marius <maerious@gmail.com> Date: Fri Sep 1 19:49:48 2017 +0200 Correct error assertions for exceeding max part size commit 9350712c0a46651e6a7a91d8819307ba4b08ec7e Author: Marius <maerious@gmail.com> Date: Fri Sep 1 19:44:28 2017 +0200 Make CalcOptimalPartSize unexported commit 593f3b2d37d16c51f229572c1d6b39fc2a234079 Author: Marius <maerious@gmail.com> Date: Fri Sep 1 19:38:46 2017 +0200 Add more output for debugging tests commit b7193bfe67b535c9b9dd441610b41af11fe4538f Author: Marius <maerious@gmail.com> Date: Fri Sep 1 19:35:48 2017 +0200 Extract size assertions into own function commit 7521de23194652519fbbf3d61a41ef0b44b005fa Author: Marius <maerious@gmail.com> Date: Fri Sep 1 19:26:48 2017 +0200 Move tests for CalcPartSize into own file commit 6c483de7710cc119c870271ccad629c98c15c9a3 Author: Marius <maerious@gmail.com> Date: Fri Sep 1 19:13:02 2017 +0200 Use same assertions in AllUploadSizes test commit 7b0290a07e7def09ea8ed982e7817a2ea7cd468a Author: Marius <maerious@gmail.com> Date: Fri Sep 1 18:30:02 2017 +0200 Split negative test case from TestCalcOptimalPartSize into own test commit 79c0a20d7bc71b494bc0824ad2aa8879b0c2900b Merge: 5240f9b 997961f Author: Marius <maerious@gmail.com> Date: Fri Sep 1 17:32:31 2017 +0200 Merge branch 'f-s3-part-size' of https://github.com/flaneurtv/tusd into flaneurtv-f-s3-part-size commit 997961ff5cc3d59c9055e54335926929f9ed570a Author: Markus Kienast <mark@rickkiste.at> Date: Fri Sep 1 00:59:38 2017 +0200 TestNewUploadLargerMaxObjectSize commit 0831bd79f8d34c0d5d079d1750852754db36ecdf Author: Markus Kienast <mark@rickkiste.at> Date: Thu Aug 31 23:08:03 2017 +0200 fmt.Sprintf removed, range from 0 - MaxObjectSize+1 commit 1be708152409f6a918a8dee86d704d1a9f25690b Author: Markus Kienast <mark@rickkiste.at> Date: Tue Aug 29 10:23:50 2017 +0200 turn off debug mode commit be9a9bec10e0681572c6a1aa588fd158d913c008 Author: Markus Kienast <mark@rickkiste.at> Date: Tue Aug 29 10:12:20 2017 +0200 moved MaxObjectSize check to NewUpload, refined tests * moved MaxObjectSize check to NewUpload * removed MaxObjectSize check from CalcOptimalPartSize * switched to assert in tests * added TestAllPartSizes, excluded in short mode TODO: TestNewUploadLargerMaxObjectSize needs to fail if MaxObjectSize > size commit 7c22847a451c8f70ef3b312111267b699ff00693 Author: Markus Kienast <mark@rickkiste.at> Date: Sat Aug 26 12:55:07 2017 +0200 adding debug code to TestCalcOptimalPartSize commit 5240f9b549000fac34be79ddfbe6e82404387f6b Merge: 63c011e 5b116e7 Author: Marius <maerious@gmail.com> Date: Sat Aug 26 12:50:51 2017 +0200 Merge branch 'f-s3-part-size' of https://github.com/flaneurtv/tusd into flaneurtv-f-s3-part-size commit 63c011ef768db42e99004df921c2b9e5c4776fd2 Author: Marius <maerious@gmail.com> Date: Sat Aug 26 12:50:45 2017 +0200 Format s3store_test commit 5b116e70875789eff95e490353b5d232c21f8660 Author: Markus Kienast <mark@rickkiste.at> Date: Sat Aug 26 12:24:22 2017 +0200 restructuring tests to accommodate optimalPartSize of 0 commit 93134a5696e3755d35e3ab360ba393cd3e52b6f0 Author: Markus Kienast <mark@rickkiste.at> Date: Sat Aug 26 12:03:18 2017 +0200 moving MaxObjectSize check to top commit 68e6bb8c41f92e29dfbf37bcb391bc5256ebb90a Author: Markus Kienast <mark@rickkiste.at> Date: Sat Aug 26 02:31:27 2017 +0200 enhance readability, comments and errors commit 8831a98c34d0a702fe24b6450928830569dac351 Author: Markus Kienast <mark@rickkiste.at> Date: Thu Aug 24 02:27:57 2017 +0200 separated partsize calc and error handling commit f059acc7ccc443405cf9d465f619319483ed947a Author: Markus Kienast <mark@rickkiste.at> Date: Thu Aug 24 01:29:26 2017 +0200 fixed edge cases; pre-cleanup commit e2e3b9ffe4aeef70ed44bc63b6afc5e4c353c159 Author: Markus Kienast <mark@rickkiste.at> Date: Wed Aug 23 13:28:59 2017 +0200 added error, when size > MaxObjectSize; additional case in algorithm + tests; go fmt commit 381d3326cb17a173b13eced781a1ae6efc88773b Author: Markus Kienast <mark@rickkiste.at> Date: Thu Aug 17 16:32:25 2017 +0200 calculating PartSize based on size of upload simplified algorithm, respect MaxObjectSize, updated tests, go fmt commit 1ad6187d6dc199018605e3e3a7d9d4c7d2c37cf8 Author: koenvo <info@koenvossen.nl> Date: Thu Aug 17 21:31:37 2017 +0200 Take IsTruncated field of S3 ListParts API response into account (#148) * Take IsTruncated field of S3 ListParts API response into account * Rename s3store.ListParts to ListAllParts * Use proper formatting + make listAllParts private + test listAllParts through TestGetInfo * Update TestFinishUpload to also test paged ListParts response
2017-09-03 08:57:06 +00:00
package s3store
2016-01-05 17:21:53 +00:00
import (
2019-09-15 12:33:02 +00:00
context "context"
reflect "reflect"
2019-09-15 12:33:02 +00:00
request "github.com/aws/aws-sdk-go/aws/request"
2016-01-05 17:21:53 +00:00
s3 "github.com/aws/aws-sdk-go/service/s3"
gomock "github.com/golang/mock/gomock"
)
2022-05-24 12:16:01 +00:00
// MockS3API is a mock of S3API interface.
2016-01-05 17:21:53 +00:00
type MockS3API struct {
ctrl *gomock.Controller
2019-09-15 12:33:02 +00:00
recorder *MockS3APIMockRecorder
2016-01-05 17:21:53 +00:00
}
2022-05-24 12:16:01 +00:00
// MockS3APIMockRecorder is the mock recorder for MockS3API.
2019-09-15 12:33:02 +00:00
type MockS3APIMockRecorder struct {
2016-01-05 17:21:53 +00:00
mock *MockS3API
}
2022-05-24 12:16:01 +00:00
// NewMockS3API creates a new mock instance.
2016-01-05 17:21:53 +00:00
func NewMockS3API(ctrl *gomock.Controller) *MockS3API {
mock := &MockS3API{ctrl: ctrl}
2019-09-15 12:33:02 +00:00
mock.recorder = &MockS3APIMockRecorder{mock}
2016-01-05 17:21:53 +00:00
return mock
}
2022-05-24 12:16:01 +00:00
// EXPECT returns an object that allows the caller to indicate expected use.
2019-09-15 12:33:02 +00:00
func (m *MockS3API) EXPECT() *MockS3APIMockRecorder {
return m.recorder
2016-01-05 17:21:53 +00:00
}
2022-05-24 12:16:01 +00:00
// AbortMultipartUploadWithContext mocks base method.
2019-09-15 12:33:02 +00:00
func (m *MockS3API) AbortMultipartUploadWithContext(arg0 context.Context, arg1 *s3.AbortMultipartUploadInput, arg2 ...request.Option) (*s3.AbortMultipartUploadOutput, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "AbortMultipartUploadWithContext", varargs...)
2016-01-05 17:21:53 +00:00
ret0, _ := ret[0].(*s3.AbortMultipartUploadOutput)
ret1, _ := ret[1].(error)
return ret0, ret1
}
2022-05-24 12:16:01 +00:00
// AbortMultipartUploadWithContext indicates an expected call of AbortMultipartUploadWithContext.
2019-09-15 12:33:02 +00:00
func (mr *MockS3APIMockRecorder) AbortMultipartUploadWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AbortMultipartUploadWithContext", reflect.TypeOf((*MockS3API)(nil).AbortMultipartUploadWithContext), varargs...)
2016-01-05 17:21:53 +00:00
}
2022-05-24 12:16:01 +00:00
// CompleteMultipartUploadWithContext mocks base method.
2019-09-15 12:33:02 +00:00
func (m *MockS3API) CompleteMultipartUploadWithContext(arg0 context.Context, arg1 *s3.CompleteMultipartUploadInput, arg2 ...request.Option) (*s3.CompleteMultipartUploadOutput, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "CompleteMultipartUploadWithContext", varargs...)
2016-01-05 17:21:53 +00:00
ret0, _ := ret[0].(*s3.CompleteMultipartUploadOutput)
ret1, _ := ret[1].(error)
return ret0, ret1
}
2022-05-24 12:16:01 +00:00
// CompleteMultipartUploadWithContext indicates an expected call of CompleteMultipartUploadWithContext.
2019-09-15 12:33:02 +00:00
func (mr *MockS3APIMockRecorder) CompleteMultipartUploadWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CompleteMultipartUploadWithContext", reflect.TypeOf((*MockS3API)(nil).CompleteMultipartUploadWithContext), varargs...)
2016-01-05 17:21:53 +00:00
}
2022-05-24 12:16:01 +00:00
// CreateMultipartUploadWithContext mocks base method.
2019-09-15 12:33:02 +00:00
func (m *MockS3API) CreateMultipartUploadWithContext(arg0 context.Context, arg1 *s3.CreateMultipartUploadInput, arg2 ...request.Option) (*s3.CreateMultipartUploadOutput, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "CreateMultipartUploadWithContext", varargs...)
2016-12-20 16:13:02 +00:00
ret0, _ := ret[0].(*s3.CreateMultipartUploadOutput)
2016-01-05 17:21:53 +00:00
ret1, _ := ret[1].(error)
return ret0, ret1
}
2022-05-24 12:16:01 +00:00
// CreateMultipartUploadWithContext indicates an expected call of CreateMultipartUploadWithContext.
2019-09-15 12:33:02 +00:00
func (mr *MockS3APIMockRecorder) CreateMultipartUploadWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateMultipartUploadWithContext", reflect.TypeOf((*MockS3API)(nil).CreateMultipartUploadWithContext), varargs...)
2016-01-05 17:21:53 +00:00
}
2022-05-24 12:16:01 +00:00
// DeleteObjectWithContext mocks base method.
2019-09-15 12:33:02 +00:00
func (m *MockS3API) DeleteObjectWithContext(arg0 context.Context, arg1 *s3.DeleteObjectInput, arg2 ...request.Option) (*s3.DeleteObjectOutput, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "DeleteObjectWithContext", varargs...)
ret0, _ := ret[0].(*s3.DeleteObjectOutput)
ret1, _ := ret[1].(error)
return ret0, ret1
}
2022-05-24 12:16:01 +00:00
// DeleteObjectWithContext indicates an expected call of DeleteObjectWithContext.
2019-09-15 12:33:02 +00:00
func (mr *MockS3APIMockRecorder) DeleteObjectWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObjectWithContext", reflect.TypeOf((*MockS3API)(nil).DeleteObjectWithContext), varargs...)
}
2022-05-24 12:16:01 +00:00
// DeleteObjectsWithContext mocks base method.
2019-09-15 12:33:02 +00:00
func (m *MockS3API) DeleteObjectsWithContext(arg0 context.Context, arg1 *s3.DeleteObjectsInput, arg2 ...request.Option) (*s3.DeleteObjectsOutput, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "DeleteObjectsWithContext", varargs...)
2016-12-20 16:13:02 +00:00
ret0, _ := ret[0].(*s3.DeleteObjectsOutput)
2016-05-24 15:32:21 +00:00
ret1, _ := ret[1].(error)
return ret0, ret1
}
2022-05-24 12:16:01 +00:00
// DeleteObjectsWithContext indicates an expected call of DeleteObjectsWithContext.
2019-09-15 12:33:02 +00:00
func (mr *MockS3APIMockRecorder) DeleteObjectsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObjectsWithContext", reflect.TypeOf((*MockS3API)(nil).DeleteObjectsWithContext), varargs...)
}
2022-05-24 12:16:01 +00:00
// GetObjectWithContext mocks base method.
2019-09-15 12:33:02 +00:00
func (m *MockS3API) GetObjectWithContext(arg0 context.Context, arg1 *s3.GetObjectInput, arg2 ...request.Option) (*s3.GetObjectOutput, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "GetObjectWithContext", varargs...)
2016-12-20 16:13:02 +00:00
ret0, _ := ret[0].(*s3.GetObjectOutput)
ret1, _ := ret[1].(error)
2016-05-24 15:32:21 +00:00
return ret0, ret1
}
2022-05-24 12:16:01 +00:00
// GetObjectWithContext indicates an expected call of GetObjectWithContext.
2019-09-15 12:33:02 +00:00
func (mr *MockS3APIMockRecorder) GetObjectWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObjectWithContext", reflect.TypeOf((*MockS3API)(nil).GetObjectWithContext), varargs...)
2016-05-24 15:32:21 +00:00
}
2022-05-24 12:16:01 +00:00
// HeadObjectWithContext mocks base method.
func (m *MockS3API) HeadObjectWithContext(arg0 context.Context, arg1 *s3.HeadObjectInput, arg2 ...request.Option) (*s3.HeadObjectOutput, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "HeadObjectWithContext", varargs...)
ret0, _ := ret[0].(*s3.HeadObjectOutput)
ret1, _ := ret[1].(error)
return ret0, ret1
}
2022-05-24 12:16:01 +00:00
// HeadObjectWithContext indicates an expected call of HeadObjectWithContext.
func (mr *MockS3APIMockRecorder) HeadObjectWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeadObjectWithContext", reflect.TypeOf((*MockS3API)(nil).HeadObjectWithContext), varargs...)
}
2022-05-24 12:16:01 +00:00
// ListPartsWithContext mocks base method.
2019-09-15 12:33:02 +00:00
func (m *MockS3API) ListPartsWithContext(arg0 context.Context, arg1 *s3.ListPartsInput, arg2 ...request.Option) (*s3.ListPartsOutput, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "ListPartsWithContext", varargs...)
2016-01-05 17:21:53 +00:00
ret0, _ := ret[0].(*s3.ListPartsOutput)
ret1, _ := ret[1].(error)
return ret0, ret1
}
2022-05-24 12:16:01 +00:00
// ListPartsWithContext indicates an expected call of ListPartsWithContext.
2019-09-15 12:33:02 +00:00
func (mr *MockS3APIMockRecorder) ListPartsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPartsWithContext", reflect.TypeOf((*MockS3API)(nil).ListPartsWithContext), varargs...)
2016-01-05 17:21:53 +00:00
}
2022-05-24 12:16:01 +00:00
// PutObjectWithContext mocks base method.
2019-09-15 12:33:02 +00:00
func (m *MockS3API) PutObjectWithContext(arg0 context.Context, arg1 *s3.PutObjectInput, arg2 ...request.Option) (*s3.PutObjectOutput, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "PutObjectWithContext", varargs...)
2016-01-05 17:21:53 +00:00
ret0, _ := ret[0].(*s3.PutObjectOutput)
ret1, _ := ret[1].(error)
return ret0, ret1
}
2022-05-24 12:16:01 +00:00
// PutObjectWithContext indicates an expected call of PutObjectWithContext.
2019-09-15 12:33:02 +00:00
func (mr *MockS3APIMockRecorder) PutObjectWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutObjectWithContext", reflect.TypeOf((*MockS3API)(nil).PutObjectWithContext), varargs...)
2016-01-05 17:21:53 +00:00
}
2022-05-24 12:16:01 +00:00
// UploadPartCopyWithContext mocks base method.
2019-09-15 12:33:02 +00:00
func (m *MockS3API) UploadPartCopyWithContext(arg0 context.Context, arg1 *s3.UploadPartCopyInput, arg2 ...request.Option) (*s3.UploadPartCopyOutput, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "UploadPartCopyWithContext", varargs...)
ret0, _ := ret[0].(*s3.UploadPartCopyOutput)
2016-01-05 17:21:53 +00:00
ret1, _ := ret[1].(error)
return ret0, ret1
}
2022-05-24 12:16:01 +00:00
// UploadPartCopyWithContext indicates an expected call of UploadPartCopyWithContext.
2019-09-15 12:33:02 +00:00
func (mr *MockS3APIMockRecorder) UploadPartCopyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadPartCopyWithContext", reflect.TypeOf((*MockS3API)(nil).UploadPartCopyWithContext), varargs...)
2016-01-05 17:21:53 +00:00
}
2022-05-24 12:16:01 +00:00
// UploadPartWithContext mocks base method.
2019-09-15 12:33:02 +00:00
func (m *MockS3API) UploadPartWithContext(arg0 context.Context, arg1 *s3.UploadPartInput, arg2 ...request.Option) (*s3.UploadPartOutput, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "UploadPartWithContext", varargs...)
ret0, _ := ret[0].(*s3.UploadPartOutput)
2016-01-05 17:21:53 +00:00
ret1, _ := ret[1].(error)
return ret0, ret1
}
2022-05-24 12:16:01 +00:00
// UploadPartWithContext indicates an expected call of UploadPartWithContext.
2019-09-15 12:33:02 +00:00
func (mr *MockS3APIMockRecorder) UploadPartWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadPartWithContext", reflect.TypeOf((*MockS3API)(nil).UploadPartWithContext), varargs...)
2016-01-05 17:21:53 +00:00
}