mirror of https://github.com/goharbor/harbor.git
455 lines
12 KiB
Go
455 lines
12 KiB
Go
// Code generated by mockery v2.22.1. DO NOT EDIT.
|
|
|
|
package flow
|
|
|
|
import (
|
|
distribution "github.com/docker/distribution"
|
|
|
|
io "io"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
model "github.com/goharbor/harbor/src/pkg/reg/model"
|
|
)
|
|
|
|
// mockAdapter is an autogenerated mock type for the registryAdapter type
|
|
type mockAdapter struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// BlobExist provides a mock function with given fields: repository, digest
|
|
func (_m *mockAdapter) BlobExist(repository string, digest string) (bool, error) {
|
|
ret := _m.Called(repository, digest)
|
|
|
|
var r0 bool
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string, string) (bool, error)); ok {
|
|
return rf(repository, digest)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string) bool); ok {
|
|
r0 = rf(repository, digest)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string) error); ok {
|
|
r1 = rf(repository, digest)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// CanBeMount provides a mock function with given fields: digest
|
|
func (_m *mockAdapter) CanBeMount(digest string) (bool, string, error) {
|
|
ret := _m.Called(digest)
|
|
|
|
var r0 bool
|
|
var r1 string
|
|
var r2 error
|
|
if rf, ok := ret.Get(0).(func(string) (bool, string, error)); ok {
|
|
return rf(digest)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string) bool); ok {
|
|
r0 = rf(digest)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string) string); ok {
|
|
r1 = rf(digest)
|
|
} else {
|
|
r1 = ret.Get(1).(string)
|
|
}
|
|
|
|
if rf, ok := ret.Get(2).(func(string) error); ok {
|
|
r2 = rf(digest)
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// DeleteManifest provides a mock function with given fields: repository, reference
|
|
func (_m *mockAdapter) DeleteManifest(repository string, reference string) error {
|
|
ret := _m.Called(repository, reference)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, string) error); ok {
|
|
r0 = rf(repository, reference)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// DeleteTag provides a mock function with given fields: repository, tag
|
|
func (_m *mockAdapter) DeleteTag(repository string, tag string) error {
|
|
ret := _m.Called(repository, tag)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, string) error); ok {
|
|
r0 = rf(repository, tag)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// FetchArtifacts provides a mock function with given fields: filters
|
|
func (_m *mockAdapter) FetchArtifacts(filters []*model.Filter) ([]*model.Resource, error) {
|
|
ret := _m.Called(filters)
|
|
|
|
var r0 []*model.Resource
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func([]*model.Filter) ([]*model.Resource, error)); ok {
|
|
return rf(filters)
|
|
}
|
|
if rf, ok := ret.Get(0).(func([]*model.Filter) []*model.Resource); ok {
|
|
r0 = rf(filters)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.Resource)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func([]*model.Filter) error); ok {
|
|
r1 = rf(filters)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// HealthCheck provides a mock function with given fields:
|
|
func (_m *mockAdapter) HealthCheck() (string, error) {
|
|
ret := _m.Called()
|
|
|
|
var r0 string
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func() (string, error)); ok {
|
|
return rf()
|
|
}
|
|
if rf, ok := ret.Get(0).(func() string); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func() error); ok {
|
|
r1 = rf()
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Info provides a mock function with given fields:
|
|
func (_m *mockAdapter) Info() (*model.RegistryInfo, error) {
|
|
ret := _m.Called()
|
|
|
|
var r0 *model.RegistryInfo
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func() (*model.RegistryInfo, error)); ok {
|
|
return rf()
|
|
}
|
|
if rf, ok := ret.Get(0).(func() *model.RegistryInfo); ok {
|
|
r0 = rf()
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.RegistryInfo)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func() error); ok {
|
|
r1 = rf()
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// ListTags provides a mock function with given fields: repository
|
|
func (_m *mockAdapter) ListTags(repository string) ([]string, error) {
|
|
ret := _m.Called(repository)
|
|
|
|
var r0 []string
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string) ([]string, error)); ok {
|
|
return rf(repository)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string) []string); ok {
|
|
r0 = rf(repository)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]string)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string) error); ok {
|
|
r1 = rf(repository)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// ManifestExist provides a mock function with given fields: repository, reference
|
|
func (_m *mockAdapter) ManifestExist(repository string, reference string) (bool, *distribution.Descriptor, error) {
|
|
ret := _m.Called(repository, reference)
|
|
|
|
var r0 bool
|
|
var r1 *distribution.Descriptor
|
|
var r2 error
|
|
if rf, ok := ret.Get(0).(func(string, string) (bool, *distribution.Descriptor, error)); ok {
|
|
return rf(repository, reference)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string) bool); ok {
|
|
r0 = rf(repository, reference)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string) *distribution.Descriptor); ok {
|
|
r1 = rf(repository, reference)
|
|
} else {
|
|
if ret.Get(1) != nil {
|
|
r1 = ret.Get(1).(*distribution.Descriptor)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(2).(func(string, string) error); ok {
|
|
r2 = rf(repository, reference)
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// MountBlob provides a mock function with given fields: srcRepository, digest, dstRepository
|
|
func (_m *mockAdapter) MountBlob(srcRepository string, digest string, dstRepository string) error {
|
|
ret := _m.Called(srcRepository, digest, dstRepository)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, string, string) error); ok {
|
|
r0 = rf(srcRepository, digest, dstRepository)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// PrepareForPush provides a mock function with given fields: _a0
|
|
func (_m *mockAdapter) PrepareForPush(_a0 []*model.Resource) error {
|
|
ret := _m.Called(_a0)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func([]*model.Resource) error); ok {
|
|
r0 = rf(_a0)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// PullBlob provides a mock function with given fields: repository, digest
|
|
func (_m *mockAdapter) PullBlob(repository string, digest string) (int64, io.ReadCloser, error) {
|
|
ret := _m.Called(repository, digest)
|
|
|
|
var r0 int64
|
|
var r1 io.ReadCloser
|
|
var r2 error
|
|
if rf, ok := ret.Get(0).(func(string, string) (int64, io.ReadCloser, error)); ok {
|
|
return rf(repository, digest)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string) int64); ok {
|
|
r0 = rf(repository, digest)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string) io.ReadCloser); ok {
|
|
r1 = rf(repository, digest)
|
|
} else {
|
|
if ret.Get(1) != nil {
|
|
r1 = ret.Get(1).(io.ReadCloser)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(2).(func(string, string) error); ok {
|
|
r2 = rf(repository, digest)
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// PullBlobChunk provides a mock function with given fields: repository, digest, blobSize, start, end
|
|
func (_m *mockAdapter) PullBlobChunk(repository string, digest string, blobSize int64, start int64, end int64) (int64, io.ReadCloser, error) {
|
|
ret := _m.Called(repository, digest, blobSize, start, end)
|
|
|
|
var r0 int64
|
|
var r1 io.ReadCloser
|
|
var r2 error
|
|
if rf, ok := ret.Get(0).(func(string, string, int64, int64, int64) (int64, io.ReadCloser, error)); ok {
|
|
return rf(repository, digest, blobSize, start, end)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string, int64, int64, int64) int64); ok {
|
|
r0 = rf(repository, digest, blobSize, start, end)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string, int64, int64, int64) io.ReadCloser); ok {
|
|
r1 = rf(repository, digest, blobSize, start, end)
|
|
} else {
|
|
if ret.Get(1) != nil {
|
|
r1 = ret.Get(1).(io.ReadCloser)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(2).(func(string, string, int64, int64, int64) error); ok {
|
|
r2 = rf(repository, digest, blobSize, start, end)
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// PullManifest provides a mock function with given fields: repository, reference, accepttedMediaTypes
|
|
func (_m *mockAdapter) PullManifest(repository string, reference string, accepttedMediaTypes ...string) (distribution.Manifest, string, error) {
|
|
_va := make([]interface{}, len(accepttedMediaTypes))
|
|
for _i := range accepttedMediaTypes {
|
|
_va[_i] = accepttedMediaTypes[_i]
|
|
}
|
|
var _ca []interface{}
|
|
_ca = append(_ca, repository, reference)
|
|
_ca = append(_ca, _va...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
var r0 distribution.Manifest
|
|
var r1 string
|
|
var r2 error
|
|
if rf, ok := ret.Get(0).(func(string, string, ...string) (distribution.Manifest, string, error)); ok {
|
|
return rf(repository, reference, accepttedMediaTypes...)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string, ...string) distribution.Manifest); ok {
|
|
r0 = rf(repository, reference, accepttedMediaTypes...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(distribution.Manifest)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string, ...string) string); ok {
|
|
r1 = rf(repository, reference, accepttedMediaTypes...)
|
|
} else {
|
|
r1 = ret.Get(1).(string)
|
|
}
|
|
|
|
if rf, ok := ret.Get(2).(func(string, string, ...string) error); ok {
|
|
r2 = rf(repository, reference, accepttedMediaTypes...)
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// PushBlob provides a mock function with given fields: repository, digest, size, blob
|
|
func (_m *mockAdapter) PushBlob(repository string, digest string, size int64, blob io.Reader) error {
|
|
ret := _m.Called(repository, digest, size, blob)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, string, int64, io.Reader) error); ok {
|
|
r0 = rf(repository, digest, size, blob)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// PushBlobChunk provides a mock function with given fields: repository, digest, size, chunk, start, end, location
|
|
func (_m *mockAdapter) PushBlobChunk(repository string, digest string, size int64, chunk io.Reader, start int64, end int64, location string) (string, int64, error) {
|
|
ret := _m.Called(repository, digest, size, chunk, start, end, location)
|
|
|
|
var r0 string
|
|
var r1 int64
|
|
var r2 error
|
|
if rf, ok := ret.Get(0).(func(string, string, int64, io.Reader, int64, int64, string) (string, int64, error)); ok {
|
|
return rf(repository, digest, size, chunk, start, end, location)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string, int64, io.Reader, int64, int64, string) string); ok {
|
|
r0 = rf(repository, digest, size, chunk, start, end, location)
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string, int64, io.Reader, int64, int64, string) int64); ok {
|
|
r1 = rf(repository, digest, size, chunk, start, end, location)
|
|
} else {
|
|
r1 = ret.Get(1).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(2).(func(string, string, int64, io.Reader, int64, int64, string) error); ok {
|
|
r2 = rf(repository, digest, size, chunk, start, end, location)
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// PushManifest provides a mock function with given fields: repository, reference, mediaType, payload
|
|
func (_m *mockAdapter) PushManifest(repository string, reference string, mediaType string, payload []byte) (string, error) {
|
|
ret := _m.Called(repository, reference, mediaType, payload)
|
|
|
|
var r0 string
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string, string, string, []byte) (string, error)); ok {
|
|
return rf(repository, reference, mediaType, payload)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string, string, []byte) string); ok {
|
|
r0 = rf(repository, reference, mediaType, payload)
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string, string, []byte) error); ok {
|
|
r1 = rf(repository, reference, mediaType, payload)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
type mockConstructorTestingTnewMockAdapter interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}
|
|
|
|
// newMockAdapter creates a new instance of mockAdapter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
func newMockAdapter(t mockConstructorTestingTnewMockAdapter) *mockAdapter {
|
|
mock := &mockAdapter{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|