mirror of
https://github.com/harness/drone.git
synced 2025-05-03 12:12:22 +08:00

* fix merge conflicts * fix merge conflicts * fix review comment * fix review comment * fix review comment * fix: [AH-771]: gitness unit test refactoring * fix: [AH-771]: resolved review comments * fix: [AH-771]: resolved review comments * fix: [AH-771] Registry test refactoring and improvements - Refactored registry metadata test implementations - Improved code organization and readability - Fixed line length issues in test files - Removed unused fields from request.go - Added proper license headers - Fixed linting issues in mock files - Simplified test setup and assertions - Updated wire generation for cmd package - Added nolint:exhaustive directive for package type switch fix: [AH-771] Registry test refactoring and improvements - Refactored registry metadata test implementations - Improved code organization and readability - Fixed line length issues in test files - Removed unused fields from request.go - Added proper license headers - Fixed linting issues in mock files - Simplifi
233 lines
6.0 KiB
Go
233 lines
6.0 KiB
Go
// Code generated by mockery v2.53.3. DO NOT EDIT.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
context "context"
|
|
|
|
types "github.com/harness/gitness/registry/types"
|
|
|
|
digest "github.com/opencontainers/go-digest"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// BlobRepository is an autogenerated mock type for the BlobRepository type
|
|
type BlobRepository struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// CreateOrFind provides a mock function with given fields: ctx, b
|
|
func (_m *BlobRepository) CreateOrFind(ctx context.Context, b *types.Blob) (*types.Blob, bool, error) {
|
|
ret := _m.Called(ctx, b)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CreateOrFind")
|
|
}
|
|
|
|
var r0 *types.Blob
|
|
var r1 bool
|
|
var r2 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.Blob) (*types.Blob, bool, error)); ok {
|
|
return rf(ctx, b)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.Blob) *types.Blob); ok {
|
|
r0 = rf(ctx, b)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.Blob)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *types.Blob) bool); ok {
|
|
r1 = rf(ctx, b)
|
|
} else {
|
|
r1 = ret.Get(1).(bool)
|
|
}
|
|
|
|
if rf, ok := ret.Get(2).(func(context.Context, *types.Blob) error); ok {
|
|
r2 = rf(ctx, b)
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// DeleteByID provides a mock function with given fields: ctx, id
|
|
func (_m *BlobRepository) DeleteByID(ctx context.Context, id int64) error {
|
|
ret := _m.Called(ctx, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DeleteByID")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok {
|
|
r0 = rf(ctx, id)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// ExistsBlob provides a mock function with given fields: ctx, repoID, d, image
|
|
func (_m *BlobRepository) ExistsBlob(ctx context.Context, repoID int64, d digest.Digest, image string) (bool, error) {
|
|
ret := _m.Called(ctx, repoID, d, image)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ExistsBlob")
|
|
}
|
|
|
|
var r0 bool
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, digest.Digest, string) (bool, error)); ok {
|
|
return rf(ctx, repoID, d, image)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, digest.Digest, string) bool); ok {
|
|
r0 = rf(ctx, repoID, d, image)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, digest.Digest, string) error); ok {
|
|
r1 = rf(ctx, repoID, d, image)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// FindByDigestAndRepoID provides a mock function with given fields: ctx, d, repoID, imageName
|
|
func (_m *BlobRepository) FindByDigestAndRepoID(ctx context.Context, d digest.Digest, repoID int64, imageName string) (*types.Blob, error) {
|
|
ret := _m.Called(ctx, d, repoID, imageName)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for FindByDigestAndRepoID")
|
|
}
|
|
|
|
var r0 *types.Blob
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, digest.Digest, int64, string) (*types.Blob, error)); ok {
|
|
return rf(ctx, d, repoID, imageName)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, digest.Digest, int64, string) *types.Blob); ok {
|
|
r0 = rf(ctx, d, repoID, imageName)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.Blob)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, digest.Digest, int64, string) error); ok {
|
|
r1 = rf(ctx, d, repoID, imageName)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// FindByDigestAndRootParentID provides a mock function with given fields: ctx, d, rootParentID
|
|
func (_m *BlobRepository) FindByDigestAndRootParentID(ctx context.Context, d digest.Digest, rootParentID int64) (*types.Blob, error) {
|
|
ret := _m.Called(ctx, d, rootParentID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for FindByDigestAndRootParentID")
|
|
}
|
|
|
|
var r0 *types.Blob
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, digest.Digest, int64) (*types.Blob, error)); ok {
|
|
return rf(ctx, d, rootParentID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, digest.Digest, int64) *types.Blob); ok {
|
|
r0 = rf(ctx, d, rootParentID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.Blob)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, digest.Digest, int64) error); ok {
|
|
r1 = rf(ctx, d, rootParentID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// FindByID provides a mock function with given fields: ctx, id
|
|
func (_m *BlobRepository) FindByID(ctx context.Context, id int64) (*types.Blob, error) {
|
|
ret := _m.Called(ctx, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for FindByID")
|
|
}
|
|
|
|
var r0 *types.Blob
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) (*types.Blob, error)); ok {
|
|
return rf(ctx, id)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) *types.Blob); ok {
|
|
r0 = rf(ctx, id)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.Blob)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
r1 = rf(ctx, id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// TotalSizeByRootParentID provides a mock function with given fields: ctx, id
|
|
func (_m *BlobRepository) TotalSizeByRootParentID(ctx context.Context, id int64) (int64, error) {
|
|
ret := _m.Called(ctx, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for TotalSizeByRootParentID")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) (int64, error)); ok {
|
|
return rf(ctx, id)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) int64); ok {
|
|
r0 = rf(ctx, id)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
r1 = rf(ctx, id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// NewBlobRepository creates a new instance of BlobRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
// The first argument is typically a *testing.T value.
|
|
func NewBlobRepository(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *BlobRepository {
|
|
mock := &BlobRepository{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|