mirror of
https://github.com/harness/drone.git
synced 2025-05-03 13:01:39 +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
478 lines
13 KiB
Go
478 lines
13 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"
|
|
)
|
|
|
|
// ManifestRepository is an autogenerated mock type for the ManifestRepository type
|
|
type ManifestRepository struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// AssociateLayerBlob provides a mock function with given fields: ctx, m, b
|
|
func (_m *ManifestRepository) AssociateLayerBlob(ctx context.Context, m *types.Manifest, b *types.Blob) error {
|
|
ret := _m.Called(ctx, m, b)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for AssociateLayerBlob")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.Manifest, *types.Blob) error); ok {
|
|
r0 = rf(ctx, m, b)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Count provides a mock function with given fields: ctx
|
|
func (_m *ManifestRepository) Count(ctx context.Context) (int, error) {
|
|
ret := _m.Called(ctx)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Count")
|
|
}
|
|
|
|
var r0 int
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context) (int, error)); ok {
|
|
return rf(ctx)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context) int); ok {
|
|
r0 = rf(ctx)
|
|
} else {
|
|
r0 = ret.Get(0).(int)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
|
|
r1 = rf(ctx)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Create provides a mock function with given fields: ctx, m
|
|
func (_m *ManifestRepository) Create(ctx context.Context, m *types.Manifest) error {
|
|
ret := _m.Called(ctx, m)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Create")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.Manifest) error); ok {
|
|
r0 = rf(ctx, m)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// CreateOrFind provides a mock function with given fields: ctx, m
|
|
func (_m *ManifestRepository) CreateOrFind(ctx context.Context, m *types.Manifest) error {
|
|
ret := _m.Called(ctx, m)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CreateOrFind")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.Manifest) error); ok {
|
|
r0 = rf(ctx, m)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Delete provides a mock function with given fields: ctx, registryID, id
|
|
func (_m *ManifestRepository) Delete(ctx context.Context, registryID int64, id int64) error {
|
|
ret := _m.Called(ctx, registryID, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Delete")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, int64) error); ok {
|
|
r0 = rf(ctx, registryID, id)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// DeleteManifest provides a mock function with given fields: ctx, repoID, imageName, d
|
|
func (_m *ManifestRepository) DeleteManifest(ctx context.Context, repoID int64, imageName string, d digest.Digest) (bool, error) {
|
|
ret := _m.Called(ctx, repoID, imageName, d)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DeleteManifest")
|
|
}
|
|
|
|
var r0 bool
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string, digest.Digest) (bool, error)); ok {
|
|
return rf(ctx, repoID, imageName, d)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string, digest.Digest) bool); ok {
|
|
r0 = rf(ctx, repoID, imageName, d)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, string, digest.Digest) error); ok {
|
|
r1 = rf(ctx, repoID, imageName, d)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// DissociateLayerBlob provides a mock function with given fields: ctx, m, b
|
|
func (_m *ManifestRepository) DissociateLayerBlob(ctx context.Context, m *types.Manifest, b *types.Blob) error {
|
|
ret := _m.Called(ctx, m, b)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DissociateLayerBlob")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.Manifest, *types.Blob) error); ok {
|
|
r0 = rf(ctx, m, b)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// FindAll provides a mock function with given fields: ctx
|
|
func (_m *ManifestRepository) FindAll(ctx context.Context) (types.Manifests, error) {
|
|
ret := _m.Called(ctx)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for FindAll")
|
|
}
|
|
|
|
var r0 types.Manifests
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context) (types.Manifests, error)); ok {
|
|
return rf(ctx)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context) types.Manifests); ok {
|
|
r0 = rf(ctx)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(types.Manifests)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
|
|
r1 = rf(ctx)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// FindManifestByDigest provides a mock function with given fields: ctx, repoID, imageName, _a3
|
|
func (_m *ManifestRepository) FindManifestByDigest(ctx context.Context, repoID int64, imageName string, _a3 types.Digest) (*types.Manifest, error) {
|
|
ret := _m.Called(ctx, repoID, imageName, _a3)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for FindManifestByDigest")
|
|
}
|
|
|
|
var r0 *types.Manifest
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string, types.Digest) (*types.Manifest, error)); ok {
|
|
return rf(ctx, repoID, imageName, _a3)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string, types.Digest) *types.Manifest); ok {
|
|
r0 = rf(ctx, repoID, imageName, _a3)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.Manifest)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, string, types.Digest) error); ok {
|
|
r1 = rf(ctx, repoID, imageName, _a3)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// FindManifestByTagName provides a mock function with given fields: ctx, repoID, imageName, tag
|
|
func (_m *ManifestRepository) FindManifestByTagName(ctx context.Context, repoID int64, imageName string, tag string) (*types.Manifest, error) {
|
|
ret := _m.Called(ctx, repoID, imageName, tag)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for FindManifestByTagName")
|
|
}
|
|
|
|
var r0 *types.Manifest
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string, string) (*types.Manifest, error)); ok {
|
|
return rf(ctx, repoID, imageName, tag)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string, string) *types.Manifest); ok {
|
|
r0 = rf(ctx, repoID, imageName, tag)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.Manifest)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, string, string) error); ok {
|
|
r1 = rf(ctx, repoID, imageName, tag)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// FindManifestPayloadByTagName provides a mock function with given fields: ctx, parentID, repoKey, imageName, version
|
|
func (_m *ManifestRepository) FindManifestPayloadByTagName(ctx context.Context, parentID int64, repoKey string, imageName string, version string) (*types.Payload, error) {
|
|
ret := _m.Called(ctx, parentID, repoKey, imageName, version)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for FindManifestPayloadByTagName")
|
|
}
|
|
|
|
var r0 *types.Payload
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string, string, string) (*types.Payload, error)); ok {
|
|
return rf(ctx, parentID, repoKey, imageName, version)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string, string, string) *types.Payload); ok {
|
|
r0 = rf(ctx, parentID, repoKey, imageName, version)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.Payload)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, string, string, string) error); ok {
|
|
r1 = rf(ctx, parentID, repoKey, imageName, version)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Get provides a mock function with given fields: ctx, manifestID
|
|
func (_m *ManifestRepository) Get(ctx context.Context, manifestID int64) (*types.Manifest, error) {
|
|
ret := _m.Called(ctx, manifestID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Get")
|
|
}
|
|
|
|
var r0 *types.Manifest
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) (*types.Manifest, error)); ok {
|
|
return rf(ctx, manifestID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) *types.Manifest); ok {
|
|
r0 = rf(ctx, manifestID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.Manifest)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
r1 = rf(ctx, manifestID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetManifestPayload provides a mock function with given fields: ctx, parentID, repoKey, imageName, _a4
|
|
func (_m *ManifestRepository) GetManifestPayload(ctx context.Context, parentID int64, repoKey string, imageName string, _a4 types.Digest) (*types.Payload, error) {
|
|
ret := _m.Called(ctx, parentID, repoKey, imageName, _a4)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetManifestPayload")
|
|
}
|
|
|
|
var r0 *types.Payload
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string, string, types.Digest) (*types.Payload, error)); ok {
|
|
return rf(ctx, parentID, repoKey, imageName, _a4)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string, string, types.Digest) *types.Payload); ok {
|
|
r0 = rf(ctx, parentID, repoKey, imageName, _a4)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.Payload)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, string, string, types.Digest) error); ok {
|
|
r1 = rf(ctx, parentID, repoKey, imageName, _a4)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// LayerBlobs provides a mock function with given fields: ctx, m
|
|
func (_m *ManifestRepository) LayerBlobs(ctx context.Context, m *types.Manifest) (types.Blobs, error) {
|
|
ret := _m.Called(ctx, m)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for LayerBlobs")
|
|
}
|
|
|
|
var r0 types.Blobs
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.Manifest) (types.Blobs, error)); ok {
|
|
return rf(ctx, m)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.Manifest) types.Blobs); ok {
|
|
r0 = rf(ctx, m)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(types.Blobs)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *types.Manifest) error); ok {
|
|
r1 = rf(ctx, m)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// ListManifestsBySubject provides a mock function with given fields: ctx, repoID, id
|
|
func (_m *ManifestRepository) ListManifestsBySubject(ctx context.Context, repoID int64, id int64) (types.Manifests, error) {
|
|
ret := _m.Called(ctx, repoID, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListManifestsBySubject")
|
|
}
|
|
|
|
var r0 types.Manifests
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, int64) (types.Manifests, error)); ok {
|
|
return rf(ctx, repoID, id)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, int64) types.Manifests); ok {
|
|
r0 = rf(ctx, repoID, id)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(types.Manifests)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, int64) error); ok {
|
|
r1 = rf(ctx, repoID, id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// ListManifestsBySubjectDigest provides a mock function with given fields: ctx, repoID, _a2
|
|
func (_m *ManifestRepository) ListManifestsBySubjectDigest(ctx context.Context, repoID int64, _a2 types.Digest) (types.Manifests, error) {
|
|
ret := _m.Called(ctx, repoID, _a2)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListManifestsBySubjectDigest")
|
|
}
|
|
|
|
var r0 types.Manifests
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, types.Digest) (types.Manifests, error)); ok {
|
|
return rf(ctx, repoID, _a2)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, types.Digest) types.Manifests); ok {
|
|
r0 = rf(ctx, repoID, _a2)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(types.Manifests)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, types.Digest) error); ok {
|
|
r1 = rf(ctx, repoID, _a2)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// References provides a mock function with given fields: ctx, m
|
|
func (_m *ManifestRepository) References(ctx context.Context, m *types.Manifest) (types.Manifests, error) {
|
|
ret := _m.Called(ctx, m)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for References")
|
|
}
|
|
|
|
var r0 types.Manifests
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.Manifest) (types.Manifests, error)); ok {
|
|
return rf(ctx, m)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.Manifest) types.Manifests); ok {
|
|
r0 = rf(ctx, m)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(types.Manifests)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *types.Manifest) error); ok {
|
|
r1 = rf(ctx, m)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// NewManifestRepository creates a new instance of ManifestRepository. 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 NewManifestRepository(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *ManifestRepository {
|
|
mock := &ManifestRepository{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|