chore: automate mock generation v2 (#18371)

* Add go:generate statements for mockery

Signed-off-by: Will Roden <will@roden.cc>

* revert whitespace change

Signed-off-by: Will Roden <will@roden.cc>

* go generate everything

Signed-off-by: Will Roden <will@roden.cc>

* make gogen

Signed-off-by: Will Roden <will@roden.cc>

* chore: upgrade to mockery v2.40.2

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

---------

Signed-off-by: Will Roden <will@roden.cc>
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Co-authored-by: Will Roden <will@roden.cc>
This commit is contained in:
Blake Pettersson 2024-05-22 22:15:15 -10:00 committed by GitHub
parent 9f27197da6
commit 049900e646
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 1592 additions and 149 deletions

View file

@ -188,7 +188,7 @@ all: cli image
.PHONY: gogen
gogen:
export GO111MODULE=off
go generate ./util/argo/...
go generate ./...
.PHONY: protogen
protogen: mod-vendor-local protogen-fast

View file

@ -1,4 +1,4 @@
// Code generated by mockery v2.25.1. DO NOT EDIT.
// Code generated by mockery v2.40.2. DO NOT EDIT.
package mocks
@ -17,6 +17,10 @@ type Repos struct {
func (_m *Repos) GetDirectories(ctx context.Context, repoURL string, revision string, noRevisionCache bool) ([]string, error) {
ret := _m.Called(ctx, repoURL, revision, noRevisionCache)
if len(ret) == 0 {
panic("no return value specified for GetDirectories")
}
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, bool) ([]string, error)); ok {
@ -43,6 +47,10 @@ func (_m *Repos) GetDirectories(ctx context.Context, repoURL string, revision st
func (_m *Repos) GetFiles(ctx context.Context, repoURL string, revision string, pattern string, noRevisionCache bool) (map[string][]byte, error) {
ret := _m.Called(ctx, repoURL, revision, pattern, noRevisionCache)
if len(ret) == 0 {
panic("no return value specified for GetFiles")
}
var r0 map[string][]byte
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, bool) (map[string][]byte, error)); ok {
@ -65,13 +73,12 @@ func (_m *Repos) GetFiles(ctx context.Context, repoURL string, revision string,
return r0, r1
}
type mockConstructorTestingTNewRepos interface {
// NewRepos creates a new instance of Repos. 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 NewRepos(t interface {
mock.TestingT
Cleanup(func())
}
// NewRepos creates a new instance of Repos. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewRepos(t mockConstructorTestingTNewRepos) *Repos {
}) *Repos {
mock := &Repos{}
mock.Mock.Test(t)

View file

@ -1,4 +1,4 @@
// Code generated by mockery v2.21.1. DO NOT EDIT.
// Code generated by mockery v2.40.2. DO NOT EDIT.
package mocks
@ -19,6 +19,10 @@ type RepositoryDB struct {
func (_m *RepositoryDB) GetRepository(ctx context.Context, url string) (*v1alpha1.Repository, error) {
ret := _m.Called(ctx, url)
if len(ret) == 0 {
panic("no return value specified for GetRepository")
}
var r0 *v1alpha1.Repository
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) (*v1alpha1.Repository, error)); ok {
@ -41,13 +45,12 @@ func (_m *RepositoryDB) GetRepository(ctx context.Context, url string) (*v1alpha
return r0, r1
}
type mockConstructorTestingTNewRepositoryDB interface {
// NewRepositoryDB creates a new instance of RepositoryDB. 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 NewRepositoryDB(t interface {
mock.TestingT
Cleanup(func())
}
// NewRepositoryDB creates a new instance of RepositoryDB. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewRepositoryDB(t mockConstructorTestingTNewRepositoryDB) *RepositoryDB {
}) *RepositoryDB {
mock := &RepositoryDB{}
mock.Mock.Test(t)

View file

@ -11,7 +11,7 @@ import (
"github.com/argoproj/argo-cd/v2/util/io"
)
//go:generate go run github.com/vektra/mockery/v2@v2.25.1 --name=RepositoryDB
//go:generate go run github.com/vektra/mockery/v2@v2.40.2 --name=RepositoryDB
// RepositoryDB Is a lean facade for ArgoDB,
// Using a lean interface makes it easier to test the functionality of the git generator
@ -27,7 +27,7 @@ type argoCDService struct {
newFileGlobbingEnabled bool
}
//go:generate go run github.com/vektra/mockery/v2@v2.25.1 --name=Repos
//go:generate go run github.com/vektra/mockery/v2@v2.40.2 --name=Repos
type Repos interface {

View file

@ -15,6 +15,8 @@ import (
azureGit "github.com/microsoft/azure-devops-go-api/azuredevops/git"
)
//go:generate go run github.com/vektra/mockery/v2@v2.40.2 --srcpkg=github.com/microsoft/azure-devops-go-api/azuredevops/git --name=Client --output=azure_devops/git/mocks --outpkg=mocks
func s(input string) *string {
return ptr.To(input)
}

View file

@ -41,6 +41,8 @@ import (
"github.com/argoproj/argo-cd/v2/util/settings"
)
//go:generate go run github.com/vektra/mockery/v2@v2.40.2 --name=LiveStateCache
const (
// EnvClusterCacheResyncDuration is the env variable that holds cluster cache re-sync duration
EnvClusterCacheResyncDuration = "ARGOCD_CLUSTER_CACHE_RESYNC_DURATION"

View file

@ -1,4 +1,4 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Code generated by mockery v2.40.2. DO NOT EDIT.
package mocks
@ -29,7 +29,15 @@ type LiveStateCache struct {
func (_m *LiveStateCache) GetClusterCache(server string) (cache.ClusterCache, error) {
ret := _m.Called(server)
if len(ret) == 0 {
panic("no return value specified for GetClusterCache")
}
var r0 cache.ClusterCache
var r1 error
if rf, ok := ret.Get(0).(func(string) (cache.ClusterCache, error)); ok {
return rf(server)
}
if rf, ok := ret.Get(0).(func(string) cache.ClusterCache); ok {
r0 = rf(server)
} else {
@ -38,7 +46,6 @@ func (_m *LiveStateCache) GetClusterCache(server string) (cache.ClusterCache, er
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(server)
} else {
@ -52,6 +59,10 @@ func (_m *LiveStateCache) GetClusterCache(server string) (cache.ClusterCache, er
func (_m *LiveStateCache) GetClustersInfo() []cache.ClusterInfo {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetClustersInfo")
}
var r0 []cache.ClusterInfo
if rf, ok := ret.Get(0).(func() []cache.ClusterInfo); ok {
r0 = rf()
@ -68,7 +79,15 @@ func (_m *LiveStateCache) GetClustersInfo() []cache.ClusterInfo {
func (_m *LiveStateCache) GetManagedLiveObjs(a *v1alpha1.Application, targetObjs []*unstructured.Unstructured) (map[kube.ResourceKey]*unstructured.Unstructured, error) {
ret := _m.Called(a, targetObjs)
if len(ret) == 0 {
panic("no return value specified for GetManagedLiveObjs")
}
var r0 map[kube.ResourceKey]*unstructured.Unstructured
var r1 error
if rf, ok := ret.Get(0).(func(*v1alpha1.Application, []*unstructured.Unstructured) (map[kube.ResourceKey]*unstructured.Unstructured, error)); ok {
return rf(a, targetObjs)
}
if rf, ok := ret.Get(0).(func(*v1alpha1.Application, []*unstructured.Unstructured) map[kube.ResourceKey]*unstructured.Unstructured); ok {
r0 = rf(a, targetObjs)
} else {
@ -77,7 +96,6 @@ func (_m *LiveStateCache) GetManagedLiveObjs(a *v1alpha1.Application, targetObjs
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*v1alpha1.Application, []*unstructured.Unstructured) error); ok {
r1 = rf(a, targetObjs)
} else {
@ -91,7 +109,15 @@ func (_m *LiveStateCache) GetManagedLiveObjs(a *v1alpha1.Application, targetObjs
func (_m *LiveStateCache) GetNamespaceTopLevelResources(server string, namespace string) (map[kube.ResourceKey]v1alpha1.ResourceNode, error) {
ret := _m.Called(server, namespace)
if len(ret) == 0 {
panic("no return value specified for GetNamespaceTopLevelResources")
}
var r0 map[kube.ResourceKey]v1alpha1.ResourceNode
var r1 error
if rf, ok := ret.Get(0).(func(string, string) (map[kube.ResourceKey]v1alpha1.ResourceNode, error)); ok {
return rf(server, namespace)
}
if rf, ok := ret.Get(0).(func(string, string) map[kube.ResourceKey]v1alpha1.ResourceNode); ok {
r0 = rf(server, namespace)
} else {
@ -100,7 +126,6 @@ func (_m *LiveStateCache) GetNamespaceTopLevelResources(server string, namespace
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(server, namespace)
} else {
@ -114,14 +139,22 @@ func (_m *LiveStateCache) GetNamespaceTopLevelResources(server string, namespace
func (_m *LiveStateCache) GetVersionsInfo(serverURL string) (string, []kube.APIResourceInfo, error) {
ret := _m.Called(serverURL)
if len(ret) == 0 {
panic("no return value specified for GetVersionsInfo")
}
var r0 string
var r1 []kube.APIResourceInfo
var r2 error
if rf, ok := ret.Get(0).(func(string) (string, []kube.APIResourceInfo, error)); ok {
return rf(serverURL)
}
if rf, ok := ret.Get(0).(func(string) string); ok {
r0 = rf(serverURL)
} else {
r0 = ret.Get(0).(string)
}
var r1 []kube.APIResourceInfo
if rf, ok := ret.Get(1).(func(string) []kube.APIResourceInfo); ok {
r1 = rf(serverURL)
} else {
@ -130,7 +163,6 @@ func (_m *LiveStateCache) GetVersionsInfo(serverURL string) (string, []kube.APIR
}
}
var r2 error
if rf, ok := ret.Get(2).(func(string) error); ok {
r2 = rf(serverURL)
} else {
@ -144,6 +176,10 @@ func (_m *LiveStateCache) GetVersionsInfo(serverURL string) (string, []kube.APIR
func (_m *LiveStateCache) Init() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Init")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
@ -158,14 +194,21 @@ func (_m *LiveStateCache) Init() error {
func (_m *LiveStateCache) IsNamespaced(server string, gk schema.GroupKind) (bool, error) {
ret := _m.Called(server, gk)
if len(ret) == 0 {
panic("no return value specified for IsNamespaced")
}
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(string, schema.GroupKind) (bool, error)); ok {
return rf(server, gk)
}
if rf, ok := ret.Get(0).(func(string, schema.GroupKind) bool); ok {
r0 = rf(server, gk)
} else {
r0 = ret.Get(0).(bool)
}
var r1 error
if rf, ok := ret.Get(1).(func(string, schema.GroupKind) error); ok {
r1 = rf(server, gk)
} else {
@ -179,6 +222,10 @@ func (_m *LiveStateCache) IsNamespaced(server string, gk schema.GroupKind) (bool
func (_m *LiveStateCache) IterateHierarchy(server string, key kube.ResourceKey, action func(v1alpha1.ResourceNode, string) bool) error {
ret := _m.Called(server, key, action)
if len(ret) == 0 {
panic("no return value specified for IterateHierarchy")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, kube.ResourceKey, func(v1alpha1.ResourceNode, string) bool) error); ok {
r0 = rf(server, key, action)
@ -193,6 +240,10 @@ func (_m *LiveStateCache) IterateHierarchy(server string, key kube.ResourceKey,
func (_m *LiveStateCache) IterateResources(server string, callback func(*cache.Resource, *controllercache.ResourceInfo)) error {
ret := _m.Called(server, callback)
if len(ret) == 0 {
panic("no return value specified for IterateResources")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, func(*cache.Resource, *controllercache.ResourceInfo)) error); ok {
r0 = rf(server, callback)
@ -207,6 +258,10 @@ func (_m *LiveStateCache) IterateResources(server string, callback func(*cache.R
func (_m *LiveStateCache) Run(ctx context.Context) error {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for Run")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context) error); ok {
r0 = rf(ctx)
@ -216,3 +271,17 @@ func (_m *LiveStateCache) Run(ctx context.Context) error {
return r0
}
// NewLiveStateCache creates a new instance of LiveStateCache. 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 NewLiveStateCache(t interface {
mock.TestingT
Cleanup(func())
}) *LiveStateCache {
mock := &LiveStateCache{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View file

@ -56,6 +56,12 @@ import (
tls_util "github.com/argoproj/argo-cd/v2/util/tls"
)
// These mocks are not currently used, but they are part of the public API of this package.
//go:generate -command mockery go run github.com/vektra/mockery/v2@v2.40.2
//go:generate mockery --dir=./session --name=SessionServiceServer --output=./session/mocks
//go:generate mockery --dir=./session --name=SessionServiceClient --output=./session/mocks
//go:generate mockery --dir=./cluster --name=ClusterServiceServer --output=./cluster/mocks
const (
MetaDataTokenKey = "token"
// EnvArgoCDServer is the environment variable to look for an Argo CD server address

View file

@ -1,4 +1,4 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Code generated by mockery v2.40.2. DO NOT EDIT.
package mocks
@ -21,7 +21,15 @@ type ClusterServiceServer struct {
func (_m *ClusterServiceServer) Create(_a0 context.Context, _a1 *cluster.ClusterCreateRequest) (*v1alpha1.Cluster, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Create")
}
var r0 *v1alpha1.Cluster
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterCreateRequest) (*v1alpha1.Cluster, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterCreateRequest) *v1alpha1.Cluster); ok {
r0 = rf(_a0, _a1)
} else {
@ -30,7 +38,6 @@ func (_m *ClusterServiceServer) Create(_a0 context.Context, _a1 *cluster.Cluster
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *cluster.ClusterCreateRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -44,7 +51,15 @@ func (_m *ClusterServiceServer) Create(_a0 context.Context, _a1 *cluster.Cluster
func (_m *ClusterServiceServer) Delete(_a0 context.Context, _a1 *cluster.ClusterQuery) (*cluster.ClusterResponse, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Delete")
}
var r0 *cluster.ClusterResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterQuery) (*cluster.ClusterResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterQuery) *cluster.ClusterResponse); ok {
r0 = rf(_a0, _a1)
} else {
@ -53,7 +68,6 @@ func (_m *ClusterServiceServer) Delete(_a0 context.Context, _a1 *cluster.Cluster
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *cluster.ClusterQuery) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -67,7 +81,15 @@ func (_m *ClusterServiceServer) Delete(_a0 context.Context, _a1 *cluster.Cluster
func (_m *ClusterServiceServer) Get(_a0 context.Context, _a1 *cluster.ClusterQuery) (*v1alpha1.Cluster, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Get")
}
var r0 *v1alpha1.Cluster
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterQuery) (*v1alpha1.Cluster, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterQuery) *v1alpha1.Cluster); ok {
r0 = rf(_a0, _a1)
} else {
@ -76,7 +98,36 @@ func (_m *ClusterServiceServer) Get(_a0 context.Context, _a1 *cluster.ClusterQue
}
}
if rf, ok := ret.Get(1).(func(context.Context, *cluster.ClusterQuery) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// InvalidateCache provides a mock function with given fields: _a0, _a1
func (_m *ClusterServiceServer) InvalidateCache(_a0 context.Context, _a1 *cluster.ClusterQuery) (*v1alpha1.Cluster, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for InvalidateCache")
}
var r0 *v1alpha1.Cluster
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterQuery) (*v1alpha1.Cluster, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterQuery) *v1alpha1.Cluster); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1alpha1.Cluster)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *cluster.ClusterQuery) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -90,7 +141,15 @@ func (_m *ClusterServiceServer) Get(_a0 context.Context, _a1 *cluster.ClusterQue
func (_m *ClusterServiceServer) List(_a0 context.Context, _a1 *cluster.ClusterQuery) (*v1alpha1.ClusterList, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for List")
}
var r0 *v1alpha1.ClusterList
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterQuery) (*v1alpha1.ClusterList, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterQuery) *v1alpha1.ClusterList); ok {
r0 = rf(_a0, _a1)
} else {
@ -99,7 +158,36 @@ func (_m *ClusterServiceServer) List(_a0 context.Context, _a1 *cluster.ClusterQu
}
}
if rf, ok := ret.Get(1).(func(context.Context, *cluster.ClusterQuery) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RotateAuth provides a mock function with given fields: _a0, _a1
func (_m *ClusterServiceServer) RotateAuth(_a0 context.Context, _a1 *cluster.ClusterQuery) (*cluster.ClusterResponse, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RotateAuth")
}
var r0 *cluster.ClusterResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterQuery) (*cluster.ClusterResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterQuery) *cluster.ClusterResponse); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*cluster.ClusterResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *cluster.ClusterQuery) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -113,7 +201,15 @@ func (_m *ClusterServiceServer) List(_a0 context.Context, _a1 *cluster.ClusterQu
func (_m *ClusterServiceServer) Update(_a0 context.Context, _a1 *cluster.ClusterUpdateRequest) (*v1alpha1.Cluster, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Update")
}
var r0 *v1alpha1.Cluster
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterUpdateRequest) (*v1alpha1.Cluster, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterUpdateRequest) *v1alpha1.Cluster); ok {
r0 = rf(_a0, _a1)
} else {
@ -122,7 +218,6 @@ func (_m *ClusterServiceServer) Update(_a0 context.Context, _a1 *cluster.Cluster
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *cluster.ClusterUpdateRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -131,3 +226,17 @@ func (_m *ClusterServiceServer) Update(_a0 context.Context, _a1 *cluster.Cluster
return r0, r1
}
// NewClusterServiceServer creates a new instance of ClusterServiceServer. 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 NewClusterServiceServer(t interface {
mock.TestingT
Cleanup(func())
}) *ClusterServiceServer {
mock := &ClusterServiceServer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View file

@ -1,4 +1,4 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Code generated by mockery v2.40.2. DO NOT EDIT.
package mocks
@ -28,7 +28,15 @@ func (_m *SessionServiceClient) Create(ctx context.Context, in *session.SessionC
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Create")
}
var r0 *session.SessionResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *session.SessionCreateRequest, ...grpc.CallOption) (*session.SessionResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *session.SessionCreateRequest, ...grpc.CallOption) *session.SessionResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
@ -37,7 +45,6 @@ func (_m *SessionServiceClient) Create(ctx context.Context, in *session.SessionC
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *session.SessionCreateRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
@ -58,7 +65,15 @@ func (_m *SessionServiceClient) Delete(ctx context.Context, in *session.SessionD
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Delete")
}
var r0 *session.SessionResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *session.SessionDeleteRequest, ...grpc.CallOption) (*session.SessionResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *session.SessionDeleteRequest, ...grpc.CallOption) *session.SessionResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
@ -67,7 +82,6 @@ func (_m *SessionServiceClient) Delete(ctx context.Context, in *session.SessionD
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *session.SessionDeleteRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
@ -76,3 +90,54 @@ func (_m *SessionServiceClient) Delete(ctx context.Context, in *session.SessionD
return r0, r1
}
// GetUserInfo provides a mock function with given fields: ctx, in, opts
func (_m *SessionServiceClient) GetUserInfo(ctx context.Context, in *session.GetUserInfoRequest, opts ...grpc.CallOption) (*session.GetUserInfoResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetUserInfo")
}
var r0 *session.GetUserInfoResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *session.GetUserInfoRequest, ...grpc.CallOption) (*session.GetUserInfoResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *session.GetUserInfoRequest, ...grpc.CallOption) *session.GetUserInfoResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*session.GetUserInfoResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *session.GetUserInfoRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewSessionServiceClient creates a new instance of SessionServiceClient. 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 NewSessionServiceClient(t interface {
mock.TestingT
Cleanup(func())
}) *SessionServiceClient {
mock := &SessionServiceClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View file

@ -1,13 +1,12 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Code generated by mockery v2.40.2. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
session "github.com/argoproj/argo-cd/v2/pkg/apiclient/session"
mock "github.com/stretchr/testify/mock"
)
// SessionServiceServer is an autogenerated mock type for the SessionServiceServer type
@ -19,7 +18,15 @@ type SessionServiceServer struct {
func (_m *SessionServiceServer) Create(_a0 context.Context, _a1 *session.SessionCreateRequest) (*session.SessionResponse, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Create")
}
var r0 *session.SessionResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *session.SessionCreateRequest) (*session.SessionResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *session.SessionCreateRequest) *session.SessionResponse); ok {
r0 = rf(_a0, _a1)
} else {
@ -28,7 +35,6 @@ func (_m *SessionServiceServer) Create(_a0 context.Context, _a1 *session.Session
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *session.SessionCreateRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -42,7 +48,15 @@ func (_m *SessionServiceServer) Create(_a0 context.Context, _a1 *session.Session
func (_m *SessionServiceServer) Delete(_a0 context.Context, _a1 *session.SessionDeleteRequest) (*session.SessionResponse, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Delete")
}
var r0 *session.SessionResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *session.SessionDeleteRequest) (*session.SessionResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *session.SessionDeleteRequest) *session.SessionResponse); ok {
r0 = rf(_a0, _a1)
} else {
@ -51,7 +65,6 @@ func (_m *SessionServiceServer) Delete(_a0 context.Context, _a1 *session.Session
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *session.SessionDeleteRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -60,3 +73,47 @@ func (_m *SessionServiceServer) Delete(_a0 context.Context, _a1 *session.Session
return r0, r1
}
// GetUserInfo provides a mock function with given fields: _a0, _a1
func (_m *SessionServiceServer) GetUserInfo(_a0 context.Context, _a1 *session.GetUserInfoRequest) (*session.GetUserInfoResponse, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for GetUserInfo")
}
var r0 *session.GetUserInfoResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *session.GetUserInfoRequest) (*session.GetUserInfoResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *session.GetUserInfoRequest) *session.GetUserInfoResponse); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*session.GetUserInfoResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *session.GetUserInfoRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewSessionServiceServer creates a new instance of SessionServiceServer. 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 NewSessionServiceServer(t interface {
mock.TestingT
Cleanup(func())
}) *SessionServiceServer {
mock := &SessionServiceServer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View file

@ -20,7 +20,7 @@ import (
"github.com/argoproj/argo-cd/v2/util/io"
)
//go:generate go run github.com/vektra/mockery/v2@v2.15.0 --name=RepoServerServiceClient
//go:generate go run github.com/vektra/mockery/v2@v2.40.2 --name=RepoServerServiceClient
var (
// MaxGRPCMessageSize contains max grpc message size

View file

@ -1,4 +1,4 @@
// Code generated by mockery v2.32.4. DO NOT EDIT.
// Code generated by mockery v2.40.2. DO NOT EDIT.
package mocks
@ -32,6 +32,10 @@ func (_m *RepoServerServiceClient) GenerateManifest(ctx context.Context, in *api
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GenerateManifest")
}
var r0 *apiclient.ManifestResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *apiclient.ManifestRequest, ...grpc.CallOption) (*apiclient.ManifestResponse, error)); ok {
@ -65,6 +69,10 @@ func (_m *RepoServerServiceClient) GenerateManifestWithFiles(ctx context.Context
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GenerateManifestWithFiles")
}
var r0 apiclient.RepoServerService_GenerateManifestWithFilesClient
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, ...grpc.CallOption) (apiclient.RepoServerService_GenerateManifestWithFilesClient, error)); ok {
@ -98,6 +106,10 @@ func (_m *RepoServerServiceClient) GetAppDetails(ctx context.Context, in *apicli
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetAppDetails")
}
var r0 *apiclient.RepoAppDetailsResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *apiclient.RepoServerAppDetailsQuery, ...grpc.CallOption) (*apiclient.RepoAppDetailsResponse, error)); ok {
@ -131,6 +143,10 @@ func (_m *RepoServerServiceClient) GetGitDirectories(ctx context.Context, in *ap
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetGitDirectories")
}
var r0 *apiclient.GitDirectoriesResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *apiclient.GitDirectoriesRequest, ...grpc.CallOption) (*apiclient.GitDirectoriesResponse, error)); ok {
@ -164,6 +180,10 @@ func (_m *RepoServerServiceClient) GetGitFiles(ctx context.Context, in *apiclien
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetGitFiles")
}
var r0 *apiclient.GitFilesResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *apiclient.GitFilesRequest, ...grpc.CallOption) (*apiclient.GitFilesResponse, error)); ok {
@ -197,6 +217,10 @@ func (_m *RepoServerServiceClient) GetHelmCharts(ctx context.Context, in *apicli
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetHelmCharts")
}
var r0 *apiclient.HelmChartsResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *apiclient.HelmChartsRequest, ...grpc.CallOption) (*apiclient.HelmChartsResponse, error)); ok {
@ -230,6 +254,10 @@ func (_m *RepoServerServiceClient) GetRevisionChartDetails(ctx context.Context,
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetRevisionChartDetails")
}
var r0 *v1alpha1.ChartDetails
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *apiclient.RepoServerRevisionChartDetailsRequest, ...grpc.CallOption) (*v1alpha1.ChartDetails, error)); ok {
@ -263,6 +291,10 @@ func (_m *RepoServerServiceClient) GetRevisionMetadata(ctx context.Context, in *
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetRevisionMetadata")
}
var r0 *v1alpha1.RevisionMetadata
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *apiclient.RepoServerRevisionMetadataRequest, ...grpc.CallOption) (*v1alpha1.RevisionMetadata, error)); ok {
@ -296,6 +328,10 @@ func (_m *RepoServerServiceClient) ListApps(ctx context.Context, in *apiclient.L
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ListApps")
}
var r0 *apiclient.AppList
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *apiclient.ListAppsRequest, ...grpc.CallOption) (*apiclient.AppList, error)); ok {
@ -329,6 +365,10 @@ func (_m *RepoServerServiceClient) ListPlugins(ctx context.Context, in *emptypb.
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ListPlugins")
}
var r0 *apiclient.PluginList
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *emptypb.Empty, ...grpc.CallOption) (*apiclient.PluginList, error)); ok {
@ -362,6 +402,10 @@ func (_m *RepoServerServiceClient) ListRefs(ctx context.Context, in *apiclient.L
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ListRefs")
}
var r0 *apiclient.Refs
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *apiclient.ListRefsRequest, ...grpc.CallOption) (*apiclient.Refs, error)); ok {
@ -395,6 +439,10 @@ func (_m *RepoServerServiceClient) ResolveRevision(ctx context.Context, in *apic
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ResolveRevision")
}
var r0 *apiclient.ResolveRevisionResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *apiclient.ResolveRevisionRequest, ...grpc.CallOption) (*apiclient.ResolveRevisionResponse, error)); ok {
@ -428,6 +476,10 @@ func (_m *RepoServerServiceClient) TestRepository(ctx context.Context, in *apicl
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for TestRepository")
}
var r0 *apiclient.TestRepositoryResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *apiclient.TestRepositoryRequest, ...grpc.CallOption) (*apiclient.TestRepositoryResponse, error)); ok {
@ -461,6 +513,10 @@ func (_m *RepoServerServiceClient) UpdateRevisionForPaths(ctx context.Context, i
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for UpdateRevisionForPaths")
}
var r0 *apiclient.UpdateRevisionForPathsResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *apiclient.UpdateRevisionForPathsRequest, ...grpc.CallOption) (*apiclient.UpdateRevisionForPathsResponse, error)); ok {

View file

@ -23,6 +23,8 @@ type SecretMaperValidation struct {
Transform func(string) string
}
//go:generate go run github.com/vektra/mockery/v2@v2.40.2 --name ArgoDB
type ArgoDB interface {
// ListClusters lists configured clusters
ListClusters(ctx context.Context) (*appv1.ClusterList, error)

View file

@ -1,4 +1,4 @@
// Code generated by mockery v2.32.4. DO NOT EDIT.
// Code generated by mockery v2.40.2. DO NOT EDIT.
package mocks
@ -20,6 +20,10 @@ type ArgoDB struct {
func (_m *ArgoDB) AddGPGPublicKey(ctx context.Context, keyData string) (map[string]*v1alpha1.GnuPGPublicKey, []string, error) {
ret := _m.Called(ctx, keyData)
if len(ret) == 0 {
panic("no return value specified for AddGPGPublicKey")
}
var r0 map[string]*v1alpha1.GnuPGPublicKey
var r1 []string
var r2 error
@ -55,6 +59,10 @@ func (_m *ArgoDB) AddGPGPublicKey(ctx context.Context, keyData string) (map[stri
func (_m *ArgoDB) CreateCluster(ctx context.Context, c *v1alpha1.Cluster) (*v1alpha1.Cluster, error) {
ret := _m.Called(ctx, c)
if len(ret) == 0 {
panic("no return value specified for CreateCluster")
}
var r0 *v1alpha1.Cluster
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1alpha1.Cluster) (*v1alpha1.Cluster, error)); ok {
@ -81,6 +89,10 @@ func (_m *ArgoDB) CreateCluster(ctx context.Context, c *v1alpha1.Cluster) (*v1al
func (_m *ArgoDB) CreateRepoCertificate(ctx context.Context, certificate *v1alpha1.RepositoryCertificateList, upsert bool) (*v1alpha1.RepositoryCertificateList, error) {
ret := _m.Called(ctx, certificate, upsert)
if len(ret) == 0 {
panic("no return value specified for CreateRepoCertificate")
}
var r0 *v1alpha1.RepositoryCertificateList
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1alpha1.RepositoryCertificateList, bool) (*v1alpha1.RepositoryCertificateList, error)); ok {
@ -107,6 +119,10 @@ func (_m *ArgoDB) CreateRepoCertificate(ctx context.Context, certificate *v1alph
func (_m *ArgoDB) CreateRepository(ctx context.Context, r *v1alpha1.Repository) (*v1alpha1.Repository, error) {
ret := _m.Called(ctx, r)
if len(ret) == 0 {
panic("no return value specified for CreateRepository")
}
var r0 *v1alpha1.Repository
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1alpha1.Repository) (*v1alpha1.Repository, error)); ok {
@ -133,6 +149,10 @@ func (_m *ArgoDB) CreateRepository(ctx context.Context, r *v1alpha1.Repository)
func (_m *ArgoDB) CreateRepositoryCredentials(ctx context.Context, r *v1alpha1.RepoCreds) (*v1alpha1.RepoCreds, error) {
ret := _m.Called(ctx, r)
if len(ret) == 0 {
panic("no return value specified for CreateRepositoryCredentials")
}
var r0 *v1alpha1.RepoCreds
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1alpha1.RepoCreds) (*v1alpha1.RepoCreds, error)); ok {
@ -159,6 +179,10 @@ func (_m *ArgoDB) CreateRepositoryCredentials(ctx context.Context, r *v1alpha1.R
func (_m *ArgoDB) DeleteCluster(ctx context.Context, server string) error {
ret := _m.Called(ctx, server)
if len(ret) == 0 {
panic("no return value specified for DeleteCluster")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(ctx, server)
@ -173,6 +197,10 @@ func (_m *ArgoDB) DeleteCluster(ctx context.Context, server string) error {
func (_m *ArgoDB) DeleteGPGPublicKey(ctx context.Context, keyID string) error {
ret := _m.Called(ctx, keyID)
if len(ret) == 0 {
panic("no return value specified for DeleteGPGPublicKey")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(ctx, keyID)
@ -187,6 +215,10 @@ func (_m *ArgoDB) DeleteGPGPublicKey(ctx context.Context, keyID string) error {
func (_m *ArgoDB) DeleteRepository(ctx context.Context, name string) error {
ret := _m.Called(ctx, name)
if len(ret) == 0 {
panic("no return value specified for DeleteRepository")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(ctx, name)
@ -201,6 +233,10 @@ func (_m *ArgoDB) DeleteRepository(ctx context.Context, name string) error {
func (_m *ArgoDB) DeleteRepositoryCredentials(ctx context.Context, name string) error {
ret := _m.Called(ctx, name)
if len(ret) == 0 {
panic("no return value specified for DeleteRepositoryCredentials")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(ctx, name)
@ -215,6 +251,10 @@ func (_m *ArgoDB) DeleteRepositoryCredentials(ctx context.Context, name string)
func (_m *ArgoDB) GetAllHelmRepositoryCredentials(ctx context.Context) ([]*v1alpha1.RepoCreds, error) {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for GetAllHelmRepositoryCredentials")
}
var r0 []*v1alpha1.RepoCreds
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) ([]*v1alpha1.RepoCreds, error)); ok {
@ -241,6 +281,10 @@ func (_m *ArgoDB) GetAllHelmRepositoryCredentials(ctx context.Context) ([]*v1alp
func (_m *ArgoDB) GetApplicationControllerReplicas() int {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetApplicationControllerReplicas")
}
var r0 int
if rf, ok := ret.Get(0).(func() int); ok {
r0 = rf()
@ -255,6 +299,10 @@ func (_m *ArgoDB) GetApplicationControllerReplicas() int {
func (_m *ArgoDB) GetCluster(ctx context.Context, server string) (*v1alpha1.Cluster, error) {
ret := _m.Called(ctx, server)
if len(ret) == 0 {
panic("no return value specified for GetCluster")
}
var r0 *v1alpha1.Cluster
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) (*v1alpha1.Cluster, error)); ok {
@ -281,6 +329,10 @@ func (_m *ArgoDB) GetCluster(ctx context.Context, server string) (*v1alpha1.Clus
func (_m *ArgoDB) GetClusterServersByName(ctx context.Context, name string) ([]string, error) {
ret := _m.Called(ctx, name)
if len(ret) == 0 {
panic("no return value specified for GetClusterServersByName")
}
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) ([]string, error)); ok {
@ -307,6 +359,10 @@ func (_m *ArgoDB) GetClusterServersByName(ctx context.Context, name string) ([]s
func (_m *ArgoDB) GetProjectClusters(ctx context.Context, project string) ([]*v1alpha1.Cluster, error) {
ret := _m.Called(ctx, project)
if len(ret) == 0 {
panic("no return value specified for GetProjectClusters")
}
var r0 []*v1alpha1.Cluster
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) ([]*v1alpha1.Cluster, error)); ok {
@ -333,6 +389,10 @@ func (_m *ArgoDB) GetProjectClusters(ctx context.Context, project string) ([]*v1
func (_m *ArgoDB) GetProjectRepositories(ctx context.Context, project string) ([]*v1alpha1.Repository, error) {
ret := _m.Called(ctx, project)
if len(ret) == 0 {
panic("no return value specified for GetProjectRepositories")
}
var r0 []*v1alpha1.Repository
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) ([]*v1alpha1.Repository, error)); ok {
@ -359,6 +419,10 @@ func (_m *ArgoDB) GetProjectRepositories(ctx context.Context, project string) ([
func (_m *ArgoDB) GetRepository(ctx context.Context, url string) (*v1alpha1.Repository, error) {
ret := _m.Called(ctx, url)
if len(ret) == 0 {
panic("no return value specified for GetRepository")
}
var r0 *v1alpha1.Repository
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) (*v1alpha1.Repository, error)); ok {
@ -385,6 +449,10 @@ func (_m *ArgoDB) GetRepository(ctx context.Context, url string) (*v1alpha1.Repo
func (_m *ArgoDB) GetRepositoryCredentials(ctx context.Context, name string) (*v1alpha1.RepoCreds, error) {
ret := _m.Called(ctx, name)
if len(ret) == 0 {
panic("no return value specified for GetRepositoryCredentials")
}
var r0 *v1alpha1.RepoCreds
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) (*v1alpha1.RepoCreds, error)); ok {
@ -411,6 +479,10 @@ func (_m *ArgoDB) GetRepositoryCredentials(ctx context.Context, name string) (*v
func (_m *ArgoDB) ListClusters(ctx context.Context) (*v1alpha1.ClusterList, error) {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for ListClusters")
}
var r0 *v1alpha1.ClusterList
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*v1alpha1.ClusterList, error)); ok {
@ -437,6 +509,10 @@ func (_m *ArgoDB) ListClusters(ctx context.Context) (*v1alpha1.ClusterList, erro
func (_m *ArgoDB) ListConfiguredGPGPublicKeys(ctx context.Context) (map[string]*v1alpha1.GnuPGPublicKey, error) {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for ListConfiguredGPGPublicKeys")
}
var r0 map[string]*v1alpha1.GnuPGPublicKey
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (map[string]*v1alpha1.GnuPGPublicKey, error)); ok {
@ -463,6 +539,10 @@ func (_m *ArgoDB) ListConfiguredGPGPublicKeys(ctx context.Context) (map[string]*
func (_m *ArgoDB) ListHelmRepositories(ctx context.Context) ([]*v1alpha1.Repository, error) {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for ListHelmRepositories")
}
var r0 []*v1alpha1.Repository
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) ([]*v1alpha1.Repository, error)); ok {
@ -489,6 +569,10 @@ func (_m *ArgoDB) ListHelmRepositories(ctx context.Context) ([]*v1alpha1.Reposit
func (_m *ArgoDB) ListRepoCertificates(ctx context.Context, selector *db.CertificateListSelector) (*v1alpha1.RepositoryCertificateList, error) {
ret := _m.Called(ctx, selector)
if len(ret) == 0 {
panic("no return value specified for ListRepoCertificates")
}
var r0 *v1alpha1.RepositoryCertificateList
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *db.CertificateListSelector) (*v1alpha1.RepositoryCertificateList, error)); ok {
@ -515,6 +599,10 @@ func (_m *ArgoDB) ListRepoCertificates(ctx context.Context, selector *db.Certifi
func (_m *ArgoDB) ListRepositories(ctx context.Context) ([]*v1alpha1.Repository, error) {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for ListRepositories")
}
var r0 []*v1alpha1.Repository
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) ([]*v1alpha1.Repository, error)); ok {
@ -541,6 +629,10 @@ func (_m *ArgoDB) ListRepositories(ctx context.Context) ([]*v1alpha1.Repository,
func (_m *ArgoDB) ListRepositoryCredentials(ctx context.Context) ([]string, error) {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for ListRepositoryCredentials")
}
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) ([]string, error)); ok {
@ -567,6 +659,10 @@ func (_m *ArgoDB) ListRepositoryCredentials(ctx context.Context) ([]string, erro
func (_m *ArgoDB) RemoveRepoCertificates(ctx context.Context, selector *db.CertificateListSelector) (*v1alpha1.RepositoryCertificateList, error) {
ret := _m.Called(ctx, selector)
if len(ret) == 0 {
panic("no return value specified for RemoveRepoCertificates")
}
var r0 *v1alpha1.RepositoryCertificateList
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *db.CertificateListSelector) (*v1alpha1.RepositoryCertificateList, error)); ok {
@ -593,6 +689,10 @@ func (_m *ArgoDB) RemoveRepoCertificates(ctx context.Context, selector *db.Certi
func (_m *ArgoDB) RepositoryExists(ctx context.Context, repoURL string) (bool, error) {
ret := _m.Called(ctx, repoURL)
if len(ret) == 0 {
panic("no return value specified for RepositoryExists")
}
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) (bool, error)); ok {
@ -617,6 +717,10 @@ func (_m *ArgoDB) RepositoryExists(ctx context.Context, repoURL string) (bool, e
func (_m *ArgoDB) UpdateCluster(ctx context.Context, c *v1alpha1.Cluster) (*v1alpha1.Cluster, error) {
ret := _m.Called(ctx, c)
if len(ret) == 0 {
panic("no return value specified for UpdateCluster")
}
var r0 *v1alpha1.Cluster
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1alpha1.Cluster) (*v1alpha1.Cluster, error)); ok {
@ -643,6 +747,10 @@ func (_m *ArgoDB) UpdateCluster(ctx context.Context, c *v1alpha1.Cluster) (*v1al
func (_m *ArgoDB) UpdateRepository(ctx context.Context, r *v1alpha1.Repository) (*v1alpha1.Repository, error) {
ret := _m.Called(ctx, r)
if len(ret) == 0 {
panic("no return value specified for UpdateRepository")
}
var r0 *v1alpha1.Repository
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1alpha1.Repository) (*v1alpha1.Repository, error)); ok {
@ -669,6 +777,10 @@ func (_m *ArgoDB) UpdateRepository(ctx context.Context, r *v1alpha1.Repository)
func (_m *ArgoDB) UpdateRepositoryCredentials(ctx context.Context, r *v1alpha1.RepoCreds) (*v1alpha1.RepoCreds, error) {
ret := _m.Called(ctx, r)
if len(ret) == 0 {
panic("no return value specified for UpdateRepositoryCredentials")
}
var r0 *v1alpha1.RepoCreds
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1alpha1.RepoCreds) (*v1alpha1.RepoCreds, error)); ok {
@ -695,6 +807,10 @@ func (_m *ArgoDB) UpdateRepositoryCredentials(ctx context.Context, r *v1alpha1.R
func (_m *ArgoDB) WatchClusters(ctx context.Context, handleAddEvent func(*v1alpha1.Cluster), handleModEvent func(*v1alpha1.Cluster, *v1alpha1.Cluster), handleDeleteEvent func(string)) error {
ret := _m.Called(ctx, handleAddEvent, handleModEvent, handleDeleteEvent)
if len(ret) == 0 {
panic("no return value specified for WatchClusters")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, func(*v1alpha1.Cluster), func(*v1alpha1.Cluster, *v1alpha1.Cluster), func(string)) error); ok {
r0 = rf(ctx, handleAddEvent, handleModEvent, handleDeleteEvent)

View file

@ -38,6 +38,8 @@ import (
"github.com/argoproj/argo-cd/v2/util/proxy"
)
//go:generate go run github.com/vektra/mockery/v2@v2.40.2 --name=Client
var ErrInvalidRepoURL = fmt.Errorf("repo URL is invalid")
type RevisionMetadata struct {

View file

@ -1,4 +1,4 @@
// Code generated by mockery v2.32.4. DO NOT EDIT.
// Code generated by mockery v2.40.2. DO NOT EDIT.
package mocks
@ -16,6 +16,10 @@ type Client struct {
func (_m *Client) ChangedFiles(revision string, targetRevision string) ([]string, error) {
ret := _m.Called(revision, targetRevision)
if len(ret) == 0 {
panic("no return value specified for ChangedFiles")
}
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(string, string) ([]string, error)); ok {
@ -42,6 +46,10 @@ func (_m *Client) ChangedFiles(revision string, targetRevision string) ([]string
func (_m *Client) Checkout(revision string, submoduleEnabled bool) error {
ret := _m.Called(revision, submoduleEnabled)
if len(ret) == 0 {
panic("no return value specified for Checkout")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, bool) error); ok {
r0 = rf(revision, submoduleEnabled)
@ -56,6 +64,10 @@ func (_m *Client) Checkout(revision string, submoduleEnabled bool) error {
func (_m *Client) CommitSHA() (string, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for CommitSHA")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func() (string, error)); ok {
@ -80,6 +92,10 @@ func (_m *Client) CommitSHA() (string, error) {
func (_m *Client) Fetch(revision string) error {
ret := _m.Called(revision)
if len(ret) == 0 {
panic("no return value specified for Fetch")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(revision)
@ -94,6 +110,10 @@ func (_m *Client) Fetch(revision string) error {
func (_m *Client) Init() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Init")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
@ -108,6 +128,10 @@ func (_m *Client) Init() error {
func (_m *Client) IsAnnotatedTag(_a0 string) bool {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for IsAnnotatedTag")
}
var r0 bool
if rf, ok := ret.Get(0).(func(string) bool); ok {
r0 = rf(_a0)
@ -122,6 +146,10 @@ func (_m *Client) IsAnnotatedTag(_a0 string) bool {
func (_m *Client) LsFiles(path string, enableNewGitFileGlobbing bool) ([]string, error) {
ret := _m.Called(path, enableNewGitFileGlobbing)
if len(ret) == 0 {
panic("no return value specified for LsFiles")
}
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(string, bool) ([]string, error)); ok {
@ -148,6 +176,10 @@ func (_m *Client) LsFiles(path string, enableNewGitFileGlobbing bool) ([]string,
func (_m *Client) LsLargeFiles() ([]string, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for LsLargeFiles")
}
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func() ([]string, error)); ok {
@ -174,6 +206,10 @@ func (_m *Client) LsLargeFiles() ([]string, error) {
func (_m *Client) LsRefs() (*git.Refs, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for LsRefs")
}
var r0 *git.Refs
var r1 error
if rf, ok := ret.Get(0).(func() (*git.Refs, error)); ok {
@ -200,6 +236,10 @@ func (_m *Client) LsRefs() (*git.Refs, error) {
func (_m *Client) LsRemote(revision string) (string, error) {
ret := _m.Called(revision)
if len(ret) == 0 {
panic("no return value specified for LsRemote")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(string) (string, error)); ok {
@ -224,6 +264,10 @@ func (_m *Client) LsRemote(revision string) (string, error) {
func (_m *Client) RevisionMetadata(revision string) (*git.RevisionMetadata, error) {
ret := _m.Called(revision)
if len(ret) == 0 {
panic("no return value specified for RevisionMetadata")
}
var r0 *git.RevisionMetadata
var r1 error
if rf, ok := ret.Get(0).(func(string) (*git.RevisionMetadata, error)); ok {
@ -250,6 +294,10 @@ func (_m *Client) RevisionMetadata(revision string) (*git.RevisionMetadata, erro
func (_m *Client) Root() string {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Root")
}
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
@ -264,6 +312,10 @@ func (_m *Client) Root() string {
func (_m *Client) Submodule() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Submodule")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
@ -278,6 +330,10 @@ func (_m *Client) Submodule() error {
func (_m *Client) VerifyCommitSignature(_a0 string) (string, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for VerifyCommitSignature")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(string) (string, error)); ok {

View file

@ -32,7 +32,7 @@ import (
"github.com/argoproj/argo-cd/v2/util/proxy"
)
//go:generate go run github.com/vektra/mockery/v2@v2.25.1 --name=Client
//go:generate go run github.com/vektra/mockery/v2@v2.40.2 --name=Client
var (
globalLock = sync.NewKeyLock()

View file

@ -1,4 +1,4 @@
// Code generated by mockery v2.25.1. DO NOT EDIT.
// Code generated by mockery v2.40.2. DO NOT EDIT.
package mocks
@ -18,6 +18,10 @@ type Client struct {
func (_m *Client) CleanChartCache(chart string, version string) error {
ret := _m.Called(chart, version)
if len(ret) == 0 {
panic("no return value specified for CleanChartCache")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, string) error); ok {
r0 = rf(chart, version)
@ -32,6 +36,10 @@ func (_m *Client) CleanChartCache(chart string, version string) error {
func (_m *Client) ExtractChart(chart string, version string, passCredentials bool, manifestMaxExtractedSize int64, disableManifestMaxExtractedSize bool) (string, io.Closer, error) {
ret := _m.Called(chart, version, passCredentials, manifestMaxExtractedSize, disableManifestMaxExtractedSize)
if len(ret) == 0 {
panic("no return value specified for ExtractChart")
}
var r0 string
var r1 io.Closer
var r2 error
@ -65,6 +73,10 @@ func (_m *Client) ExtractChart(chart string, version string, passCredentials boo
func (_m *Client) GetIndex(noCache bool, maxIndexSize int64) (*helm.Index, error) {
ret := _m.Called(noCache, maxIndexSize)
if len(ret) == 0 {
panic("no return value specified for GetIndex")
}
var r0 *helm.Index
var r1 error
if rf, ok := ret.Get(0).(func(bool, int64) (*helm.Index, error)); ok {
@ -91,6 +103,10 @@ func (_m *Client) GetIndex(noCache bool, maxIndexSize int64) (*helm.Index, error
func (_m *Client) GetTags(chart string, noCache bool) (*helm.TagsList, error) {
ret := _m.Called(chart, noCache)
if len(ret) == 0 {
panic("no return value specified for GetTags")
}
var r0 *helm.TagsList
var r1 error
if rf, ok := ret.Get(0).(func(string, bool) (*helm.TagsList, error)); ok {
@ -117,6 +133,10 @@ func (_m *Client) GetTags(chart string, noCache bool) (*helm.TagsList, error) {
func (_m *Client) TestHelmOCI() (bool, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for TestHelmOCI")
}
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func() (bool, error)); ok {
@ -137,13 +157,12 @@ func (_m *Client) TestHelmOCI() (bool, error) {
return r0, r1
}
type mockConstructorTestingTNewClient interface {
// NewClient creates a new instance of Client. 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 NewClient(t interface {
mock.TestingT
Cleanup(func())
}
// NewClient creates a new instance of Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewClient(t mockConstructorTestingTNewClient) *Client {
}) *Client {
mock := &Client{}
mock.Mock.Test(t)

View file

@ -0,0 +1,92 @@
// Code generated by mockery v2.40.2. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
shared "github.com/argoproj/argo-cd/v2/util/notification/expression/shared"
v1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
)
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
// GetAppDetails provides a mock function with given fields: ctx, appSource, appName
func (_m *Service) GetAppDetails(ctx context.Context, appSource *v1alpha1.ApplicationSource, appName string) (*shared.AppDetail, error) {
ret := _m.Called(ctx, appSource, appName)
if len(ret) == 0 {
panic("no return value specified for GetAppDetails")
}
var r0 *shared.AppDetail
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1alpha1.ApplicationSource, string) (*shared.AppDetail, error)); ok {
return rf(ctx, appSource, appName)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1alpha1.ApplicationSource, string) *shared.AppDetail); ok {
r0 = rf(ctx, appSource, appName)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*shared.AppDetail)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1alpha1.ApplicationSource, string) error); ok {
r1 = rf(ctx, appSource, appName)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetCommitMetadata provides a mock function with given fields: ctx, repoURL, commitSHA
func (_m *Service) GetCommitMetadata(ctx context.Context, repoURL string, commitSHA string) (*shared.CommitMetadata, error) {
ret := _m.Called(ctx, repoURL, commitSHA)
if len(ret) == 0 {
panic("no return value specified for GetCommitMetadata")
}
var r0 *shared.CommitMetadata
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (*shared.CommitMetadata, error)); ok {
return rf(ctx, repoURL, commitSHA)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) *shared.CommitMetadata); ok {
r0 = rf(ctx, repoURL, commitSHA)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*shared.CommitMetadata)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, repoURL, commitSHA)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewService creates a new instance of Service. 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 NewService(t interface {
mock.TestingT
Cleanup(func())
}) *Service {
mock := &Service{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View file

@ -14,8 +14,7 @@ import (
"github.com/argoproj/argo-cd/v2/util/settings"
)
//go:generate mockgen -destination=./mocks/service.go -package=mocks github.com/argoproj-labs/argocd-notifications/shared/argocd Service
//go:generate go run github.com/vektra/mockery/v2@v2.40.2 --name=Service
type Service interface {
GetCommitMetadata(ctx context.Context, repoURL string, commitSHA string) (*shared.CommitMetadata, error)
GetAppDetails(ctx context.Context, appSource *v1alpha1.ApplicationSource, appName string) (*shared.AppDetail, error)