diff --git a/.gitignore b/.gitignore index 4e8b3d79..54c931c8 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ node_modules/ .svelte-kit/ debug.html git_push.sh +webapp/src/lib/api/generated/docs +.env diff --git a/.mockery.yaml b/.mockery.yaml new file mode 100644 index 00000000..b7858821 --- /dev/null +++ b/.mockery.yaml @@ -0,0 +1,27 @@ +with-expecter: true +dir: "mocks" +mockname: "{{ .InterfaceName }}" +outpkg: "mocks" +filename: "{{ .InterfaceName }}.go" +# V3 compatibility settings +resolve-type-alias: false +disable-version-string: true +issue-845-fix: true +packages: + # Database store interfaces + github.com/cloudbase/garm/database/common: + interfaces: + Store: + config: + dir: "{{ .InterfaceDir }}/mocks" + # Runner interfaces + github.com/cloudbase/garm/runner: + interfaces: + PoolManagerController: + config: + dir: "{{ .InterfaceDir }}/mocks" + # Runner common interfaces (generate all interfaces in this package) + github.com/cloudbase/garm/runner/common: + config: + dir: "{{ .InterfaceDir }}/mocks" + all: true \ No newline at end of file diff --git a/Makefile b/Makefile index 9a09e999..56d2d7c9 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ export SHELLOPTS:=$(if $(SHELLOPTS),$(SHELLOPTS):)pipefail:errexit GEN_PASSWORD=$(shell (/usr/bin/apg -n1 -m32)) IMAGE_TAG = garm-build +HAS_TAILWINDCSS=$(shell (which tailwindcss || echo "no")) IMAGE_BUILDER=$(shell (which docker || which podman)) IS_PODMAN=$(shell (($(IMAGE_BUILDER) --version | grep -q podman) && echo "yes" || echo "no")) USER_ID=$(if $(filter yes,$(IS_PODMAN)),0,$(shell id -u)) @@ -55,6 +56,21 @@ build: ## Build garm @$(GO) build -ldflags "-s -w -X github.com/cloudbase/garm/util/appdefaults.Version=${VERSION}" -tags osusergo,netgo,sqlite_omit_load_extension -o bin/garm-cli ./cmd/garm-cli @echo Binaries are available in $(PWD)/bin +.PHONY: build-webui +build-webui: + @echo Building GARM web ui + ./build-webapp.sh + rm -rf webapp/assets/_app + cp -r webapp/build/* webapp/assets/ + +.PHONY: generate +generate: ## Run go generate after checking required tools are in PATH + @echo Checking required tools... + @which openapi-generator-cli > /dev/null || (echo "Error: openapi-generator-cli not found in PATH" && exit 1) + @which tailwindcss > /dev/null || (echo "Error: tailwindcss not found in PATH" && exit 1) + @echo Running go generate + @$(GO) generate ./... + test: verify go-test ## Run tests ##@ Release diff --git a/README.md b/README.md index 5d09135f..24fbbcc4 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ - [Installing on Kubernetes](#installing-on-kubernetes) - [Configuring GARM for GHES](#configuring-garm-for-ghes) - [Configuring GARM for Gitea](#configuring-garm-for-gitea) + - [Enabling the web UI](#enabling-the-web-ui) - [Using GARM](#using-garm) - [Supported providers](#supported-providers) - [Installing external providers](#installing-external-providers) @@ -78,6 +79,17 @@ GARM supports creating pools and scale sets in either GitHub itself or in your o GARM now has support for Gitea (>=1.24.0). For information on getting started with Gitea, see the [Gitea quickstart](/doc/gitea.md) document. +## Enabling the web UI + +GARM now ships with a single page application. To enable it, add the following to your GARM config: + +```toml +[apiserver.webui] + enable = true +``` + +Check the [README.md](/webapp/README.md) file for details on the web UI. + ## Using GARM GARM is designed with simplicity in mind. At least we try to keep it as simple as possible. We're aware that adding a new tool in your workflow can be painful, especially when you already have to deal with so many. The cognitive load for OPS has reached a level where it feels overwhelming at times to even wrap your head around a new tool. As such, we believe that tools should be simple, should take no more than a few hours to understand and set up and if you absolutely need to interact with the tool, it should be as intuitive as possible. Although we try our best to make this happen, we're aware that GARM has some rough edges, especially for new users. If you encounter issues or feel like the setup process was too complicated, please let us know. We're always looking to improve the user experience. diff --git a/apiserver/controllers/controllers.go b/apiserver/controllers/controllers.go index 2a57f9cf..0c610c38 100644 --- a/apiserver/controllers/controllers.go +++ b/apiserver/controllers/controllers.go @@ -20,6 +20,7 @@ import ( "io" "log/slog" "net/http" + "net/url" "strings" "github.com/gorilla/mux" @@ -31,17 +32,42 @@ import ( "github.com/cloudbase/garm/apiserver/events" "github.com/cloudbase/garm/apiserver/params" "github.com/cloudbase/garm/auth" + "github.com/cloudbase/garm/config" "github.com/cloudbase/garm/metrics" runnerParams "github.com/cloudbase/garm/params" "github.com/cloudbase/garm/runner" //nolint:typecheck + garmUtil "github.com/cloudbase/garm/util" wsWriter "github.com/cloudbase/garm/websocket" ) -func NewAPIController(r *runner.Runner, authenticator *auth.Authenticator, hub *wsWriter.Hub) (*APIController, error) { +func NewAPIController(r *runner.Runner, authenticator *auth.Authenticator, hub *wsWriter.Hub, apiCfg config.APIServer) (*APIController, error) { controllerInfo, err := r.GetControllerInfo(auth.GetAdminContext(context.Background())) if err != nil { return nil, errors.Wrap(err, "failed to get controller info") } + var checkOrigin func(r *http.Request) bool + if len(apiCfg.CORSOrigins) > 0 { + checkOrigin = func(r *http.Request) bool { + origin := r.Header["Origin"] + if len(origin) == 0 { + return true + } + u, err := url.Parse(origin[0]) + if err != nil { + return false + } + for _, val := range apiCfg.CORSOrigins { + corsVal, err := url.Parse(val) + if err != nil { + continue + } + if garmUtil.ASCIIEqualFold(u.Host, corsVal.Host) { + return true + } + } + return false + } + } return &APIController{ r: r, auth: authenticator, @@ -49,6 +75,7 @@ func NewAPIController(r *runner.Runner, authenticator *auth.Authenticator, hub * upgrader: websocket.Upgrader{ ReadBufferSize: 1024, WriteBufferSize: 16384, + CheckOrigin: checkOrigin, }, controllerID: controllerInfo.ControllerID.String(), }, nil diff --git a/apiserver/routers/routers.go b/apiserver/routers/routers.go index 2036b5f1..ff241165 100644 --- a/apiserver/routers/routers.go +++ b/apiserver/routers/routers.go @@ -57,6 +57,8 @@ import ( "github.com/cloudbase/garm/apiserver/controllers" "github.com/cloudbase/garm/auth" + "github.com/cloudbase/garm/config" + spaAssets "github.com/cloudbase/garm/webapp/assets" ) func WithMetricsRouter(parentRouter *mux.Router, disableAuth bool, metricsMiddlerware auth.Middleware) *mux.Router { @@ -82,6 +84,30 @@ func WithDebugServer(parentRouter *mux.Router) *mux.Router { return parentRouter } +func WithWebUI(parentRouter *mux.Router, apiConfig config.APIServer) *mux.Router { + if parentRouter == nil { + return nil + } + + if apiConfig.WebUI.EnableWebUI { + slog.Info("WebUI is enabled, adding webapp routes") + webappPath := apiConfig.WebUI.GetWebappPath() + slog.Info("Using webapp path", "path", webappPath) + // Accessing / should redirect to the UI + parentRouter.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + http.Redirect(w, r, webappPath, http.StatusMovedPermanently) // 301 + }) + // Serve the SPA with dynamic path + parentRouter.PathPrefix(webappPath).HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + spaAssets.ServeSPAWithPath(w, r, webappPath) + }).Methods("GET") + } else { + slog.Info("WebUI is disabled, skipping webapp routes") + } + + return parentRouter +} + func requestLogger(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // gathers metrics from the upstream handlers @@ -505,7 +531,7 @@ func NewAPIRouter(han *controllers.APIController, authMiddleware, initMiddleware apiRouter.Handle("/ws/events/", http.HandlerFunc(han.EventsHandler)).Methods("GET") apiRouter.Handle("/ws/events", http.HandlerFunc(han.EventsHandler)).Methods("GET") - // NotFound handler + // NotFound handler - this should be last apiRouter.PathPrefix("/").HandlerFunc(han.NotFoundHandler).Methods("GET", "POST", "PUT", "DELETE", "OPTIONS") return router } diff --git a/auth/init_required.go b/auth/init_required.go index 2d3e1715..3ef31d70 100644 --- a/auth/init_required.go +++ b/auth/init_required.go @@ -38,8 +38,8 @@ type initRequired struct { func (i *initRequired) Middleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() - ctrlInfo, err := i.store.ControllerInfo() - if err != nil || ctrlInfo.ControllerID.String() == "" { + + if !i.store.HasAdminUser(ctx) { w.Header().Add("Content-Type", "application/json") w.WriteHeader(http.StatusConflict) if err := json.NewEncoder(w).Encode(params.InitializationRequired); err != nil { diff --git a/build-webapp.sh b/build-webapp.sh new file mode 100755 index 00000000..01b13c04 --- /dev/null +++ b/build-webapp.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +echo "Building GARM SPA (SvelteKit)..." + +# Navigate to webapp directory +cd webapp + +# Install dependencies if node_modules doesn't exist +npm install + +# Build the SPA +echo "Building SPA..." +npm run build +echo "SPA built successfully!" diff --git a/cmd/garm/main.go b/cmd/garm/main.go index f0cca079..226a9e2a 100644 --- a/cmd/garm/main.go +++ b/cmd/garm/main.go @@ -283,7 +283,7 @@ func main() { } authenticator := auth.NewAuthenticator(cfg.JWTAuth, db) - controller, err := controllers.NewAPIController(runner, authenticator, hub) + controller, err := controllers.NewAPIController(runner, authenticator, hub, cfg.APIServer) if err != nil { log.Fatalf("failed to create controller: %+v", err) } @@ -315,6 +315,9 @@ func main() { router := routers.NewAPIRouter(controller, jwtMiddleware, initMiddleware, urlsRequiredMiddleware, instanceMiddleware, cfg.Default.EnableWebhookManagement) + // Add WebUI routes + router = routers.WithWebUI(router, cfg.APIServer) + // start the metrics collector if cfg.Metrics.Enable { slog.InfoContext(ctx, "setting up metric routes") diff --git a/config/config.go b/config/config.go index 57ec0e80..cdbec393 100644 --- a/config/config.go +++ b/config/config.go @@ -663,6 +663,21 @@ func (m *Metrics) Duration() time.Duration { return duration } +// WebUI holds configuration for the web UI +type WebUI struct { + EnableWebUI bool `toml:"enable" json:"enable"` +} + +// Validate validates the WebUI config +func (w *WebUI) Validate() error { + return nil +} + +// GetWebappPath returns the webapp path with proper formatting +func (w *WebUI) GetWebappPath() string { + return "/ui/" +} + // APIServer holds configuration for the API server // worker type APIServer struct { @@ -671,6 +686,7 @@ type APIServer struct { UseTLS bool `toml:"use_tls" json:"use-tls"` TLSConfig TLSConfig `toml:"tls" json:"tls"` CORSOrigins []string `toml:"cors_origins" json:"cors-origins"` + WebUI WebUI `toml:"webui" json:"webui"` } // BindAddress returns a host:port string. @@ -696,6 +712,11 @@ func (a *APIServer) Validate() error { // when we try to bind to it. return fmt.Errorf("invalid IP address") } + + if err := a.WebUI.Validate(); err != nil { + return fmt.Errorf("invalid webui config: %w", err) + } + return nil } diff --git a/database/common/mocks/Store.go b/database/common/mocks/Store.go index ec107854..26a80b0a 100644 --- a/database/common/mocks/Store.go +++ b/database/common/mocks/Store.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery. DO NOT EDIT. package mocks @@ -14,6 +14,14 @@ type Store struct { mock.Mock } +type Store_Expecter struct { + mock *mock.Mock +} + +func (_m *Store) EXPECT() *Store_Expecter { + return &Store_Expecter{mock: &_m.Mock} +} + // AddEntityEvent provides a mock function with given fields: ctx, entity, event, eventLevel, statusMessage, maxEvents func (_m *Store) AddEntityEvent(ctx context.Context, entity params.ForgeEntity, event params.EventType, eventLevel params.EventLevel, statusMessage string, maxEvents int) error { ret := _m.Called(ctx, entity, event, eventLevel, statusMessage, maxEvents) @@ -32,6 +40,39 @@ func (_m *Store) AddEntityEvent(ctx context.Context, entity params.ForgeEntity, return r0 } +// Store_AddEntityEvent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddEntityEvent' +type Store_AddEntityEvent_Call struct { + *mock.Call +} + +// AddEntityEvent is a helper method to define mock.On call +// - ctx context.Context +// - entity params.ForgeEntity +// - event params.EventType +// - eventLevel params.EventLevel +// - statusMessage string +// - maxEvents int +func (_e *Store_Expecter) AddEntityEvent(ctx interface{}, entity interface{}, event interface{}, eventLevel interface{}, statusMessage interface{}, maxEvents interface{}) *Store_AddEntityEvent_Call { + return &Store_AddEntityEvent_Call{Call: _e.mock.On("AddEntityEvent", ctx, entity, event, eventLevel, statusMessage, maxEvents)} +} + +func (_c *Store_AddEntityEvent_Call) Run(run func(ctx context.Context, entity params.ForgeEntity, event params.EventType, eventLevel params.EventLevel, statusMessage string, maxEvents int)) *Store_AddEntityEvent_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.ForgeEntity), args[2].(params.EventType), args[3].(params.EventLevel), args[4].(string), args[5].(int)) + }) + return _c +} + +func (_c *Store_AddEntityEvent_Call) Return(_a0 error) *Store_AddEntityEvent_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_AddEntityEvent_Call) RunAndReturn(run func(context.Context, params.ForgeEntity, params.EventType, params.EventLevel, string, int) error) *Store_AddEntityEvent_Call { + _c.Call.Return(run) + return _c +} + // AddInstanceEvent provides a mock function with given fields: ctx, instanceName, event, eventLevel, eventMessage func (_m *Store) AddInstanceEvent(ctx context.Context, instanceName string, event params.EventType, eventLevel params.EventLevel, eventMessage string) error { ret := _m.Called(ctx, instanceName, event, eventLevel, eventMessage) @@ -50,6 +91,38 @@ func (_m *Store) AddInstanceEvent(ctx context.Context, instanceName string, even return r0 } +// Store_AddInstanceEvent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddInstanceEvent' +type Store_AddInstanceEvent_Call struct { + *mock.Call +} + +// AddInstanceEvent is a helper method to define mock.On call +// - ctx context.Context +// - instanceName string +// - event params.EventType +// - eventLevel params.EventLevel +// - eventMessage string +func (_e *Store_Expecter) AddInstanceEvent(ctx interface{}, instanceName interface{}, event interface{}, eventLevel interface{}, eventMessage interface{}) *Store_AddInstanceEvent_Call { + return &Store_AddInstanceEvent_Call{Call: _e.mock.On("AddInstanceEvent", ctx, instanceName, event, eventLevel, eventMessage)} +} + +func (_c *Store_AddInstanceEvent_Call) Run(run func(ctx context.Context, instanceName string, event params.EventType, eventLevel params.EventLevel, eventMessage string)) *Store_AddInstanceEvent_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(params.EventType), args[3].(params.EventLevel), args[4].(string)) + }) + return _c +} + +func (_c *Store_AddInstanceEvent_Call) Return(_a0 error) *Store_AddInstanceEvent_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_AddInstanceEvent_Call) RunAndReturn(run func(context.Context, string, params.EventType, params.EventLevel, string) error) *Store_AddInstanceEvent_Call { + _c.Call.Return(run) + return _c +} + // BreakLockJobIsQueued provides a mock function with given fields: ctx, jobID func (_m *Store) BreakLockJobIsQueued(ctx context.Context, jobID int64) error { ret := _m.Called(ctx, jobID) @@ -68,6 +141,35 @@ func (_m *Store) BreakLockJobIsQueued(ctx context.Context, jobID int64) error { return r0 } +// Store_BreakLockJobIsQueued_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BreakLockJobIsQueued' +type Store_BreakLockJobIsQueued_Call struct { + *mock.Call +} + +// BreakLockJobIsQueued is a helper method to define mock.On call +// - ctx context.Context +// - jobID int64 +func (_e *Store_Expecter) BreakLockJobIsQueued(ctx interface{}, jobID interface{}) *Store_BreakLockJobIsQueued_Call { + return &Store_BreakLockJobIsQueued_Call{Call: _e.mock.On("BreakLockJobIsQueued", ctx, jobID)} +} + +func (_c *Store_BreakLockJobIsQueued_Call) Run(run func(ctx context.Context, jobID int64)) *Store_BreakLockJobIsQueued_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64)) + }) + return _c +} + +func (_c *Store_BreakLockJobIsQueued_Call) Return(_a0 error) *Store_BreakLockJobIsQueued_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_BreakLockJobIsQueued_Call) RunAndReturn(run func(context.Context, int64) error) *Store_BreakLockJobIsQueued_Call { + _c.Call.Return(run) + return _c +} + // ControllerInfo provides a mock function with no fields func (_m *Store) ControllerInfo() (params.ControllerInfo, error) { ret := _m.Called() @@ -96,6 +198,33 @@ func (_m *Store) ControllerInfo() (params.ControllerInfo, error) { return r0, r1 } +// Store_ControllerInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ControllerInfo' +type Store_ControllerInfo_Call struct { + *mock.Call +} + +// ControllerInfo is a helper method to define mock.On call +func (_e *Store_Expecter) ControllerInfo() *Store_ControllerInfo_Call { + return &Store_ControllerInfo_Call{Call: _e.mock.On("ControllerInfo")} +} + +func (_c *Store_ControllerInfo_Call) Run(run func()) *Store_ControllerInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Store_ControllerInfo_Call) Return(_a0 params.ControllerInfo, _a1 error) *Store_ControllerInfo_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ControllerInfo_Call) RunAndReturn(run func() (params.ControllerInfo, error)) *Store_ControllerInfo_Call { + _c.Call.Return(run) + return _c +} + // CreateEnterprise provides a mock function with given fields: ctx, name, credentialsName, webhookSecret, poolBalancerType func (_m *Store) CreateEnterprise(ctx context.Context, name string, credentialsName params.ForgeCredentials, webhookSecret string, poolBalancerType params.PoolBalancerType) (params.Enterprise, error) { ret := _m.Called(ctx, name, credentialsName, webhookSecret, poolBalancerType) @@ -124,6 +253,38 @@ func (_m *Store) CreateEnterprise(ctx context.Context, name string, credentialsN return r0, r1 } +// Store_CreateEnterprise_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEnterprise' +type Store_CreateEnterprise_Call struct { + *mock.Call +} + +// CreateEnterprise is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - credentialsName params.ForgeCredentials +// - webhookSecret string +// - poolBalancerType params.PoolBalancerType +func (_e *Store_Expecter) CreateEnterprise(ctx interface{}, name interface{}, credentialsName interface{}, webhookSecret interface{}, poolBalancerType interface{}) *Store_CreateEnterprise_Call { + return &Store_CreateEnterprise_Call{Call: _e.mock.On("CreateEnterprise", ctx, name, credentialsName, webhookSecret, poolBalancerType)} +} + +func (_c *Store_CreateEnterprise_Call) Run(run func(ctx context.Context, name string, credentialsName params.ForgeCredentials, webhookSecret string, poolBalancerType params.PoolBalancerType)) *Store_CreateEnterprise_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(params.ForgeCredentials), args[3].(string), args[4].(params.PoolBalancerType)) + }) + return _c +} + +func (_c *Store_CreateEnterprise_Call) Return(_a0 params.Enterprise, _a1 error) *Store_CreateEnterprise_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_CreateEnterprise_Call) RunAndReturn(run func(context.Context, string, params.ForgeCredentials, string, params.PoolBalancerType) (params.Enterprise, error)) *Store_CreateEnterprise_Call { + _c.Call.Return(run) + return _c +} + // CreateEntityPool provides a mock function with given fields: ctx, entity, param func (_m *Store) CreateEntityPool(ctx context.Context, entity params.ForgeEntity, param params.CreatePoolParams) (params.Pool, error) { ret := _m.Called(ctx, entity, param) @@ -152,6 +313,36 @@ func (_m *Store) CreateEntityPool(ctx context.Context, entity params.ForgeEntity return r0, r1 } +// Store_CreateEntityPool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEntityPool' +type Store_CreateEntityPool_Call struct { + *mock.Call +} + +// CreateEntityPool is a helper method to define mock.On call +// - ctx context.Context +// - entity params.ForgeEntity +// - param params.CreatePoolParams +func (_e *Store_Expecter) CreateEntityPool(ctx interface{}, entity interface{}, param interface{}) *Store_CreateEntityPool_Call { + return &Store_CreateEntityPool_Call{Call: _e.mock.On("CreateEntityPool", ctx, entity, param)} +} + +func (_c *Store_CreateEntityPool_Call) Run(run func(ctx context.Context, entity params.ForgeEntity, param params.CreatePoolParams)) *Store_CreateEntityPool_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.ForgeEntity), args[2].(params.CreatePoolParams)) + }) + return _c +} + +func (_c *Store_CreateEntityPool_Call) Return(_a0 params.Pool, _a1 error) *Store_CreateEntityPool_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_CreateEntityPool_Call) RunAndReturn(run func(context.Context, params.ForgeEntity, params.CreatePoolParams) (params.Pool, error)) *Store_CreateEntityPool_Call { + _c.Call.Return(run) + return _c +} + // CreateEntityScaleSet provides a mock function with given fields: _a0, entity, param func (_m *Store) CreateEntityScaleSet(_a0 context.Context, entity params.ForgeEntity, param params.CreateScaleSetParams) (params.ScaleSet, error) { ret := _m.Called(_a0, entity, param) @@ -180,6 +371,36 @@ func (_m *Store) CreateEntityScaleSet(_a0 context.Context, entity params.ForgeEn return r0, r1 } +// Store_CreateEntityScaleSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEntityScaleSet' +type Store_CreateEntityScaleSet_Call struct { + *mock.Call +} + +// CreateEntityScaleSet is a helper method to define mock.On call +// - _a0 context.Context +// - entity params.ForgeEntity +// - param params.CreateScaleSetParams +func (_e *Store_Expecter) CreateEntityScaleSet(_a0 interface{}, entity interface{}, param interface{}) *Store_CreateEntityScaleSet_Call { + return &Store_CreateEntityScaleSet_Call{Call: _e.mock.On("CreateEntityScaleSet", _a0, entity, param)} +} + +func (_c *Store_CreateEntityScaleSet_Call) Run(run func(_a0 context.Context, entity params.ForgeEntity, param params.CreateScaleSetParams)) *Store_CreateEntityScaleSet_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.ForgeEntity), args[2].(params.CreateScaleSetParams)) + }) + return _c +} + +func (_c *Store_CreateEntityScaleSet_Call) Return(scaleSet params.ScaleSet, err error) *Store_CreateEntityScaleSet_Call { + _c.Call.Return(scaleSet, err) + return _c +} + +func (_c *Store_CreateEntityScaleSet_Call) RunAndReturn(run func(context.Context, params.ForgeEntity, params.CreateScaleSetParams) (params.ScaleSet, error)) *Store_CreateEntityScaleSet_Call { + _c.Call.Return(run) + return _c +} + // CreateGiteaCredentials provides a mock function with given fields: ctx, param func (_m *Store) CreateGiteaCredentials(ctx context.Context, param params.CreateGiteaCredentialsParams) (params.ForgeCredentials, error) { ret := _m.Called(ctx, param) @@ -208,6 +429,35 @@ func (_m *Store) CreateGiteaCredentials(ctx context.Context, param params.Create return r0, r1 } +// Store_CreateGiteaCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateGiteaCredentials' +type Store_CreateGiteaCredentials_Call struct { + *mock.Call +} + +// CreateGiteaCredentials is a helper method to define mock.On call +// - ctx context.Context +// - param params.CreateGiteaCredentialsParams +func (_e *Store_Expecter) CreateGiteaCredentials(ctx interface{}, param interface{}) *Store_CreateGiteaCredentials_Call { + return &Store_CreateGiteaCredentials_Call{Call: _e.mock.On("CreateGiteaCredentials", ctx, param)} +} + +func (_c *Store_CreateGiteaCredentials_Call) Run(run func(ctx context.Context, param params.CreateGiteaCredentialsParams)) *Store_CreateGiteaCredentials_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.CreateGiteaCredentialsParams)) + }) + return _c +} + +func (_c *Store_CreateGiteaCredentials_Call) Return(gtCreds params.ForgeCredentials, err error) *Store_CreateGiteaCredentials_Call { + _c.Call.Return(gtCreds, err) + return _c +} + +func (_c *Store_CreateGiteaCredentials_Call) RunAndReturn(run func(context.Context, params.CreateGiteaCredentialsParams) (params.ForgeCredentials, error)) *Store_CreateGiteaCredentials_Call { + _c.Call.Return(run) + return _c +} + // CreateGiteaEndpoint provides a mock function with given fields: _a0, param func (_m *Store) CreateGiteaEndpoint(_a0 context.Context, param params.CreateGiteaEndpointParams) (params.ForgeEndpoint, error) { ret := _m.Called(_a0, param) @@ -236,6 +486,35 @@ func (_m *Store) CreateGiteaEndpoint(_a0 context.Context, param params.CreateGit return r0, r1 } +// Store_CreateGiteaEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateGiteaEndpoint' +type Store_CreateGiteaEndpoint_Call struct { + *mock.Call +} + +// CreateGiteaEndpoint is a helper method to define mock.On call +// - _a0 context.Context +// - param params.CreateGiteaEndpointParams +func (_e *Store_Expecter) CreateGiteaEndpoint(_a0 interface{}, param interface{}) *Store_CreateGiteaEndpoint_Call { + return &Store_CreateGiteaEndpoint_Call{Call: _e.mock.On("CreateGiteaEndpoint", _a0, param)} +} + +func (_c *Store_CreateGiteaEndpoint_Call) Run(run func(_a0 context.Context, param params.CreateGiteaEndpointParams)) *Store_CreateGiteaEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.CreateGiteaEndpointParams)) + }) + return _c +} + +func (_c *Store_CreateGiteaEndpoint_Call) Return(ghEndpoint params.ForgeEndpoint, err error) *Store_CreateGiteaEndpoint_Call { + _c.Call.Return(ghEndpoint, err) + return _c +} + +func (_c *Store_CreateGiteaEndpoint_Call) RunAndReturn(run func(context.Context, params.CreateGiteaEndpointParams) (params.ForgeEndpoint, error)) *Store_CreateGiteaEndpoint_Call { + _c.Call.Return(run) + return _c +} + // CreateGithubCredentials provides a mock function with given fields: ctx, param func (_m *Store) CreateGithubCredentials(ctx context.Context, param params.CreateGithubCredentialsParams) (params.ForgeCredentials, error) { ret := _m.Called(ctx, param) @@ -264,6 +543,35 @@ func (_m *Store) CreateGithubCredentials(ctx context.Context, param params.Creat return r0, r1 } +// Store_CreateGithubCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateGithubCredentials' +type Store_CreateGithubCredentials_Call struct { + *mock.Call +} + +// CreateGithubCredentials is a helper method to define mock.On call +// - ctx context.Context +// - param params.CreateGithubCredentialsParams +func (_e *Store_Expecter) CreateGithubCredentials(ctx interface{}, param interface{}) *Store_CreateGithubCredentials_Call { + return &Store_CreateGithubCredentials_Call{Call: _e.mock.On("CreateGithubCredentials", ctx, param)} +} + +func (_c *Store_CreateGithubCredentials_Call) Run(run func(ctx context.Context, param params.CreateGithubCredentialsParams)) *Store_CreateGithubCredentials_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.CreateGithubCredentialsParams)) + }) + return _c +} + +func (_c *Store_CreateGithubCredentials_Call) Return(_a0 params.ForgeCredentials, _a1 error) *Store_CreateGithubCredentials_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_CreateGithubCredentials_Call) RunAndReturn(run func(context.Context, params.CreateGithubCredentialsParams) (params.ForgeCredentials, error)) *Store_CreateGithubCredentials_Call { + _c.Call.Return(run) + return _c +} + // CreateGithubEndpoint provides a mock function with given fields: ctx, param func (_m *Store) CreateGithubEndpoint(ctx context.Context, param params.CreateGithubEndpointParams) (params.ForgeEndpoint, error) { ret := _m.Called(ctx, param) @@ -292,6 +600,35 @@ func (_m *Store) CreateGithubEndpoint(ctx context.Context, param params.CreateGi return r0, r1 } +// Store_CreateGithubEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateGithubEndpoint' +type Store_CreateGithubEndpoint_Call struct { + *mock.Call +} + +// CreateGithubEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - param params.CreateGithubEndpointParams +func (_e *Store_Expecter) CreateGithubEndpoint(ctx interface{}, param interface{}) *Store_CreateGithubEndpoint_Call { + return &Store_CreateGithubEndpoint_Call{Call: _e.mock.On("CreateGithubEndpoint", ctx, param)} +} + +func (_c *Store_CreateGithubEndpoint_Call) Run(run func(ctx context.Context, param params.CreateGithubEndpointParams)) *Store_CreateGithubEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.CreateGithubEndpointParams)) + }) + return _c +} + +func (_c *Store_CreateGithubEndpoint_Call) Return(_a0 params.ForgeEndpoint, _a1 error) *Store_CreateGithubEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_CreateGithubEndpoint_Call) RunAndReturn(run func(context.Context, params.CreateGithubEndpointParams) (params.ForgeEndpoint, error)) *Store_CreateGithubEndpoint_Call { + _c.Call.Return(run) + return _c +} + // CreateInstance provides a mock function with given fields: ctx, poolID, param func (_m *Store) CreateInstance(ctx context.Context, poolID string, param params.CreateInstanceParams) (params.Instance, error) { ret := _m.Called(ctx, poolID, param) @@ -320,6 +657,36 @@ func (_m *Store) CreateInstance(ctx context.Context, poolID string, param params return r0, r1 } +// Store_CreateInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateInstance' +type Store_CreateInstance_Call struct { + *mock.Call +} + +// CreateInstance is a helper method to define mock.On call +// - ctx context.Context +// - poolID string +// - param params.CreateInstanceParams +func (_e *Store_Expecter) CreateInstance(ctx interface{}, poolID interface{}, param interface{}) *Store_CreateInstance_Call { + return &Store_CreateInstance_Call{Call: _e.mock.On("CreateInstance", ctx, poolID, param)} +} + +func (_c *Store_CreateInstance_Call) Run(run func(ctx context.Context, poolID string, param params.CreateInstanceParams)) *Store_CreateInstance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(params.CreateInstanceParams)) + }) + return _c +} + +func (_c *Store_CreateInstance_Call) Return(_a0 params.Instance, _a1 error) *Store_CreateInstance_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_CreateInstance_Call) RunAndReturn(run func(context.Context, string, params.CreateInstanceParams) (params.Instance, error)) *Store_CreateInstance_Call { + _c.Call.Return(run) + return _c +} + // CreateOrUpdateJob provides a mock function with given fields: ctx, job func (_m *Store) CreateOrUpdateJob(ctx context.Context, job params.Job) (params.Job, error) { ret := _m.Called(ctx, job) @@ -348,6 +715,35 @@ func (_m *Store) CreateOrUpdateJob(ctx context.Context, job params.Job) (params. return r0, r1 } +// Store_CreateOrUpdateJob_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateOrUpdateJob' +type Store_CreateOrUpdateJob_Call struct { + *mock.Call +} + +// CreateOrUpdateJob is a helper method to define mock.On call +// - ctx context.Context +// - job params.Job +func (_e *Store_Expecter) CreateOrUpdateJob(ctx interface{}, job interface{}) *Store_CreateOrUpdateJob_Call { + return &Store_CreateOrUpdateJob_Call{Call: _e.mock.On("CreateOrUpdateJob", ctx, job)} +} + +func (_c *Store_CreateOrUpdateJob_Call) Run(run func(ctx context.Context, job params.Job)) *Store_CreateOrUpdateJob_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.Job)) + }) + return _c +} + +func (_c *Store_CreateOrUpdateJob_Call) Return(_a0 params.Job, _a1 error) *Store_CreateOrUpdateJob_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_CreateOrUpdateJob_Call) RunAndReturn(run func(context.Context, params.Job) (params.Job, error)) *Store_CreateOrUpdateJob_Call { + _c.Call.Return(run) + return _c +} + // CreateOrganization provides a mock function with given fields: ctx, name, credentials, webhookSecret, poolBalancerType func (_m *Store) CreateOrganization(ctx context.Context, name string, credentials params.ForgeCredentials, webhookSecret string, poolBalancerType params.PoolBalancerType) (params.Organization, error) { ret := _m.Called(ctx, name, credentials, webhookSecret, poolBalancerType) @@ -376,6 +772,38 @@ func (_m *Store) CreateOrganization(ctx context.Context, name string, credential return r0, r1 } +// Store_CreateOrganization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateOrganization' +type Store_CreateOrganization_Call struct { + *mock.Call +} + +// CreateOrganization is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - credentials params.ForgeCredentials +// - webhookSecret string +// - poolBalancerType params.PoolBalancerType +func (_e *Store_Expecter) CreateOrganization(ctx interface{}, name interface{}, credentials interface{}, webhookSecret interface{}, poolBalancerType interface{}) *Store_CreateOrganization_Call { + return &Store_CreateOrganization_Call{Call: _e.mock.On("CreateOrganization", ctx, name, credentials, webhookSecret, poolBalancerType)} +} + +func (_c *Store_CreateOrganization_Call) Run(run func(ctx context.Context, name string, credentials params.ForgeCredentials, webhookSecret string, poolBalancerType params.PoolBalancerType)) *Store_CreateOrganization_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(params.ForgeCredentials), args[3].(string), args[4].(params.PoolBalancerType)) + }) + return _c +} + +func (_c *Store_CreateOrganization_Call) Return(org params.Organization, err error) *Store_CreateOrganization_Call { + _c.Call.Return(org, err) + return _c +} + +func (_c *Store_CreateOrganization_Call) RunAndReturn(run func(context.Context, string, params.ForgeCredentials, string, params.PoolBalancerType) (params.Organization, error)) *Store_CreateOrganization_Call { + _c.Call.Return(run) + return _c +} + // CreateRepository provides a mock function with given fields: ctx, owner, name, credentials, webhookSecret, poolBalancerType func (_m *Store) CreateRepository(ctx context.Context, owner string, name string, credentials params.ForgeCredentials, webhookSecret string, poolBalancerType params.PoolBalancerType) (params.Repository, error) { ret := _m.Called(ctx, owner, name, credentials, webhookSecret, poolBalancerType) @@ -404,6 +832,39 @@ func (_m *Store) CreateRepository(ctx context.Context, owner string, name string return r0, r1 } +// Store_CreateRepository_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateRepository' +type Store_CreateRepository_Call struct { + *mock.Call +} + +// CreateRepository is a helper method to define mock.On call +// - ctx context.Context +// - owner string +// - name string +// - credentials params.ForgeCredentials +// - webhookSecret string +// - poolBalancerType params.PoolBalancerType +func (_e *Store_Expecter) CreateRepository(ctx interface{}, owner interface{}, name interface{}, credentials interface{}, webhookSecret interface{}, poolBalancerType interface{}) *Store_CreateRepository_Call { + return &Store_CreateRepository_Call{Call: _e.mock.On("CreateRepository", ctx, owner, name, credentials, webhookSecret, poolBalancerType)} +} + +func (_c *Store_CreateRepository_Call) Run(run func(ctx context.Context, owner string, name string, credentials params.ForgeCredentials, webhookSecret string, poolBalancerType params.PoolBalancerType)) *Store_CreateRepository_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(params.ForgeCredentials), args[4].(string), args[5].(params.PoolBalancerType)) + }) + return _c +} + +func (_c *Store_CreateRepository_Call) Return(param params.Repository, err error) *Store_CreateRepository_Call { + _c.Call.Return(param, err) + return _c +} + +func (_c *Store_CreateRepository_Call) RunAndReturn(run func(context.Context, string, string, params.ForgeCredentials, string, params.PoolBalancerType) (params.Repository, error)) *Store_CreateRepository_Call { + _c.Call.Return(run) + return _c +} + // CreateScaleSetInstance provides a mock function with given fields: _a0, scaleSetID, param func (_m *Store) CreateScaleSetInstance(_a0 context.Context, scaleSetID uint, param params.CreateInstanceParams) (params.Instance, error) { ret := _m.Called(_a0, scaleSetID, param) @@ -432,6 +893,36 @@ func (_m *Store) CreateScaleSetInstance(_a0 context.Context, scaleSetID uint, pa return r0, r1 } +// Store_CreateScaleSetInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateScaleSetInstance' +type Store_CreateScaleSetInstance_Call struct { + *mock.Call +} + +// CreateScaleSetInstance is a helper method to define mock.On call +// - _a0 context.Context +// - scaleSetID uint +// - param params.CreateInstanceParams +func (_e *Store_Expecter) CreateScaleSetInstance(_a0 interface{}, scaleSetID interface{}, param interface{}) *Store_CreateScaleSetInstance_Call { + return &Store_CreateScaleSetInstance_Call{Call: _e.mock.On("CreateScaleSetInstance", _a0, scaleSetID, param)} +} + +func (_c *Store_CreateScaleSetInstance_Call) Run(run func(_a0 context.Context, scaleSetID uint, param params.CreateInstanceParams)) *Store_CreateScaleSetInstance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint), args[2].(params.CreateInstanceParams)) + }) + return _c +} + +func (_c *Store_CreateScaleSetInstance_Call) Return(instance params.Instance, err error) *Store_CreateScaleSetInstance_Call { + _c.Call.Return(instance, err) + return _c +} + +func (_c *Store_CreateScaleSetInstance_Call) RunAndReturn(run func(context.Context, uint, params.CreateInstanceParams) (params.Instance, error)) *Store_CreateScaleSetInstance_Call { + _c.Call.Return(run) + return _c +} + // CreateUser provides a mock function with given fields: ctx, user func (_m *Store) CreateUser(ctx context.Context, user params.NewUserParams) (params.User, error) { ret := _m.Called(ctx, user) @@ -460,6 +951,35 @@ func (_m *Store) CreateUser(ctx context.Context, user params.NewUserParams) (par return r0, r1 } +// Store_CreateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUser' +type Store_CreateUser_Call struct { + *mock.Call +} + +// CreateUser is a helper method to define mock.On call +// - ctx context.Context +// - user params.NewUserParams +func (_e *Store_Expecter) CreateUser(ctx interface{}, user interface{}) *Store_CreateUser_Call { + return &Store_CreateUser_Call{Call: _e.mock.On("CreateUser", ctx, user)} +} + +func (_c *Store_CreateUser_Call) Run(run func(ctx context.Context, user params.NewUserParams)) *Store_CreateUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.NewUserParams)) + }) + return _c +} + +func (_c *Store_CreateUser_Call) Return(_a0 params.User, _a1 error) *Store_CreateUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_CreateUser_Call) RunAndReturn(run func(context.Context, params.NewUserParams) (params.User, error)) *Store_CreateUser_Call { + _c.Call.Return(run) + return _c +} + // DeleteCompletedJobs provides a mock function with given fields: ctx func (_m *Store) DeleteCompletedJobs(ctx context.Context) error { ret := _m.Called(ctx) @@ -478,6 +998,34 @@ func (_m *Store) DeleteCompletedJobs(ctx context.Context) error { return r0 } +// Store_DeleteCompletedJobs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteCompletedJobs' +type Store_DeleteCompletedJobs_Call struct { + *mock.Call +} + +// DeleteCompletedJobs is a helper method to define mock.On call +// - ctx context.Context +func (_e *Store_Expecter) DeleteCompletedJobs(ctx interface{}) *Store_DeleteCompletedJobs_Call { + return &Store_DeleteCompletedJobs_Call{Call: _e.mock.On("DeleteCompletedJobs", ctx)} +} + +func (_c *Store_DeleteCompletedJobs_Call) Run(run func(ctx context.Context)) *Store_DeleteCompletedJobs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Store_DeleteCompletedJobs_Call) Return(_a0 error) *Store_DeleteCompletedJobs_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_DeleteCompletedJobs_Call) RunAndReturn(run func(context.Context) error) *Store_DeleteCompletedJobs_Call { + _c.Call.Return(run) + return _c +} + // DeleteEnterprise provides a mock function with given fields: ctx, enterpriseID func (_m *Store) DeleteEnterprise(ctx context.Context, enterpriseID string) error { ret := _m.Called(ctx, enterpriseID) @@ -496,6 +1044,35 @@ func (_m *Store) DeleteEnterprise(ctx context.Context, enterpriseID string) erro return r0 } +// Store_DeleteEnterprise_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteEnterprise' +type Store_DeleteEnterprise_Call struct { + *mock.Call +} + +// DeleteEnterprise is a helper method to define mock.On call +// - ctx context.Context +// - enterpriseID string +func (_e *Store_Expecter) DeleteEnterprise(ctx interface{}, enterpriseID interface{}) *Store_DeleteEnterprise_Call { + return &Store_DeleteEnterprise_Call{Call: _e.mock.On("DeleteEnterprise", ctx, enterpriseID)} +} + +func (_c *Store_DeleteEnterprise_Call) Run(run func(ctx context.Context, enterpriseID string)) *Store_DeleteEnterprise_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_DeleteEnterprise_Call) Return(_a0 error) *Store_DeleteEnterprise_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_DeleteEnterprise_Call) RunAndReturn(run func(context.Context, string) error) *Store_DeleteEnterprise_Call { + _c.Call.Return(run) + return _c +} + // DeleteEntityPool provides a mock function with given fields: ctx, entity, poolID func (_m *Store) DeleteEntityPool(ctx context.Context, entity params.ForgeEntity, poolID string) error { ret := _m.Called(ctx, entity, poolID) @@ -514,6 +1091,36 @@ func (_m *Store) DeleteEntityPool(ctx context.Context, entity params.ForgeEntity return r0 } +// Store_DeleteEntityPool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteEntityPool' +type Store_DeleteEntityPool_Call struct { + *mock.Call +} + +// DeleteEntityPool is a helper method to define mock.On call +// - ctx context.Context +// - entity params.ForgeEntity +// - poolID string +func (_e *Store_Expecter) DeleteEntityPool(ctx interface{}, entity interface{}, poolID interface{}) *Store_DeleteEntityPool_Call { + return &Store_DeleteEntityPool_Call{Call: _e.mock.On("DeleteEntityPool", ctx, entity, poolID)} +} + +func (_c *Store_DeleteEntityPool_Call) Run(run func(ctx context.Context, entity params.ForgeEntity, poolID string)) *Store_DeleteEntityPool_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.ForgeEntity), args[2].(string)) + }) + return _c +} + +func (_c *Store_DeleteEntityPool_Call) Return(_a0 error) *Store_DeleteEntityPool_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_DeleteEntityPool_Call) RunAndReturn(run func(context.Context, params.ForgeEntity, string) error) *Store_DeleteEntityPool_Call { + _c.Call.Return(run) + return _c +} + // DeleteGiteaCredentials provides a mock function with given fields: ctx, id func (_m *Store) DeleteGiteaCredentials(ctx context.Context, id uint) error { ret := _m.Called(ctx, id) @@ -532,6 +1139,35 @@ func (_m *Store) DeleteGiteaCredentials(ctx context.Context, id uint) error { return r0 } +// Store_DeleteGiteaCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGiteaCredentials' +type Store_DeleteGiteaCredentials_Call struct { + *mock.Call +} + +// DeleteGiteaCredentials is a helper method to define mock.On call +// - ctx context.Context +// - id uint +func (_e *Store_Expecter) DeleteGiteaCredentials(ctx interface{}, id interface{}) *Store_DeleteGiteaCredentials_Call { + return &Store_DeleteGiteaCredentials_Call{Call: _e.mock.On("DeleteGiteaCredentials", ctx, id)} +} + +func (_c *Store_DeleteGiteaCredentials_Call) Run(run func(ctx context.Context, id uint)) *Store_DeleteGiteaCredentials_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint)) + }) + return _c +} + +func (_c *Store_DeleteGiteaCredentials_Call) Return(err error) *Store_DeleteGiteaCredentials_Call { + _c.Call.Return(err) + return _c +} + +func (_c *Store_DeleteGiteaCredentials_Call) RunAndReturn(run func(context.Context, uint) error) *Store_DeleteGiteaCredentials_Call { + _c.Call.Return(run) + return _c +} + // DeleteGiteaEndpoint provides a mock function with given fields: _a0, name func (_m *Store) DeleteGiteaEndpoint(_a0 context.Context, name string) error { ret := _m.Called(_a0, name) @@ -550,6 +1186,35 @@ func (_m *Store) DeleteGiteaEndpoint(_a0 context.Context, name string) error { return r0 } +// Store_DeleteGiteaEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGiteaEndpoint' +type Store_DeleteGiteaEndpoint_Call struct { + *mock.Call +} + +// DeleteGiteaEndpoint is a helper method to define mock.On call +// - _a0 context.Context +// - name string +func (_e *Store_Expecter) DeleteGiteaEndpoint(_a0 interface{}, name interface{}) *Store_DeleteGiteaEndpoint_Call { + return &Store_DeleteGiteaEndpoint_Call{Call: _e.mock.On("DeleteGiteaEndpoint", _a0, name)} +} + +func (_c *Store_DeleteGiteaEndpoint_Call) Run(run func(_a0 context.Context, name string)) *Store_DeleteGiteaEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_DeleteGiteaEndpoint_Call) Return(err error) *Store_DeleteGiteaEndpoint_Call { + _c.Call.Return(err) + return _c +} + +func (_c *Store_DeleteGiteaEndpoint_Call) RunAndReturn(run func(context.Context, string) error) *Store_DeleteGiteaEndpoint_Call { + _c.Call.Return(run) + return _c +} + // DeleteGithubCredentials provides a mock function with given fields: ctx, id func (_m *Store) DeleteGithubCredentials(ctx context.Context, id uint) error { ret := _m.Called(ctx, id) @@ -568,6 +1233,35 @@ func (_m *Store) DeleteGithubCredentials(ctx context.Context, id uint) error { return r0 } +// Store_DeleteGithubCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGithubCredentials' +type Store_DeleteGithubCredentials_Call struct { + *mock.Call +} + +// DeleteGithubCredentials is a helper method to define mock.On call +// - ctx context.Context +// - id uint +func (_e *Store_Expecter) DeleteGithubCredentials(ctx interface{}, id interface{}) *Store_DeleteGithubCredentials_Call { + return &Store_DeleteGithubCredentials_Call{Call: _e.mock.On("DeleteGithubCredentials", ctx, id)} +} + +func (_c *Store_DeleteGithubCredentials_Call) Run(run func(ctx context.Context, id uint)) *Store_DeleteGithubCredentials_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint)) + }) + return _c +} + +func (_c *Store_DeleteGithubCredentials_Call) Return(_a0 error) *Store_DeleteGithubCredentials_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_DeleteGithubCredentials_Call) RunAndReturn(run func(context.Context, uint) error) *Store_DeleteGithubCredentials_Call { + _c.Call.Return(run) + return _c +} + // DeleteGithubEndpoint provides a mock function with given fields: ctx, name func (_m *Store) DeleteGithubEndpoint(ctx context.Context, name string) error { ret := _m.Called(ctx, name) @@ -586,6 +1280,35 @@ func (_m *Store) DeleteGithubEndpoint(ctx context.Context, name string) error { return r0 } +// Store_DeleteGithubEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGithubEndpoint' +type Store_DeleteGithubEndpoint_Call struct { + *mock.Call +} + +// DeleteGithubEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - name string +func (_e *Store_Expecter) DeleteGithubEndpoint(ctx interface{}, name interface{}) *Store_DeleteGithubEndpoint_Call { + return &Store_DeleteGithubEndpoint_Call{Call: _e.mock.On("DeleteGithubEndpoint", ctx, name)} +} + +func (_c *Store_DeleteGithubEndpoint_Call) Run(run func(ctx context.Context, name string)) *Store_DeleteGithubEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_DeleteGithubEndpoint_Call) Return(_a0 error) *Store_DeleteGithubEndpoint_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_DeleteGithubEndpoint_Call) RunAndReturn(run func(context.Context, string) error) *Store_DeleteGithubEndpoint_Call { + _c.Call.Return(run) + return _c +} + // DeleteInstance provides a mock function with given fields: ctx, poolID, instanceName func (_m *Store) DeleteInstance(ctx context.Context, poolID string, instanceName string) error { ret := _m.Called(ctx, poolID, instanceName) @@ -604,6 +1327,36 @@ func (_m *Store) DeleteInstance(ctx context.Context, poolID string, instanceName return r0 } +// Store_DeleteInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteInstance' +type Store_DeleteInstance_Call struct { + *mock.Call +} + +// DeleteInstance is a helper method to define mock.On call +// - ctx context.Context +// - poolID string +// - instanceName string +func (_e *Store_Expecter) DeleteInstance(ctx interface{}, poolID interface{}, instanceName interface{}) *Store_DeleteInstance_Call { + return &Store_DeleteInstance_Call{Call: _e.mock.On("DeleteInstance", ctx, poolID, instanceName)} +} + +func (_c *Store_DeleteInstance_Call) Run(run func(ctx context.Context, poolID string, instanceName string)) *Store_DeleteInstance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *Store_DeleteInstance_Call) Return(_a0 error) *Store_DeleteInstance_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_DeleteInstance_Call) RunAndReturn(run func(context.Context, string, string) error) *Store_DeleteInstance_Call { + _c.Call.Return(run) + return _c +} + // DeleteInstanceByName provides a mock function with given fields: ctx, instanceName func (_m *Store) DeleteInstanceByName(ctx context.Context, instanceName string) error { ret := _m.Called(ctx, instanceName) @@ -622,6 +1375,35 @@ func (_m *Store) DeleteInstanceByName(ctx context.Context, instanceName string) return r0 } +// Store_DeleteInstanceByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteInstanceByName' +type Store_DeleteInstanceByName_Call struct { + *mock.Call +} + +// DeleteInstanceByName is a helper method to define mock.On call +// - ctx context.Context +// - instanceName string +func (_e *Store_Expecter) DeleteInstanceByName(ctx interface{}, instanceName interface{}) *Store_DeleteInstanceByName_Call { + return &Store_DeleteInstanceByName_Call{Call: _e.mock.On("DeleteInstanceByName", ctx, instanceName)} +} + +func (_c *Store_DeleteInstanceByName_Call) Run(run func(ctx context.Context, instanceName string)) *Store_DeleteInstanceByName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_DeleteInstanceByName_Call) Return(_a0 error) *Store_DeleteInstanceByName_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_DeleteInstanceByName_Call) RunAndReturn(run func(context.Context, string) error) *Store_DeleteInstanceByName_Call { + _c.Call.Return(run) + return _c +} + // DeleteJob provides a mock function with given fields: ctx, jobID func (_m *Store) DeleteJob(ctx context.Context, jobID int64) error { ret := _m.Called(ctx, jobID) @@ -640,6 +1422,35 @@ func (_m *Store) DeleteJob(ctx context.Context, jobID int64) error { return r0 } +// Store_DeleteJob_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteJob' +type Store_DeleteJob_Call struct { + *mock.Call +} + +// DeleteJob is a helper method to define mock.On call +// - ctx context.Context +// - jobID int64 +func (_e *Store_Expecter) DeleteJob(ctx interface{}, jobID interface{}) *Store_DeleteJob_Call { + return &Store_DeleteJob_Call{Call: _e.mock.On("DeleteJob", ctx, jobID)} +} + +func (_c *Store_DeleteJob_Call) Run(run func(ctx context.Context, jobID int64)) *Store_DeleteJob_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64)) + }) + return _c +} + +func (_c *Store_DeleteJob_Call) Return(_a0 error) *Store_DeleteJob_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_DeleteJob_Call) RunAndReturn(run func(context.Context, int64) error) *Store_DeleteJob_Call { + _c.Call.Return(run) + return _c +} + // DeleteOrganization provides a mock function with given fields: ctx, orgID func (_m *Store) DeleteOrganization(ctx context.Context, orgID string) error { ret := _m.Called(ctx, orgID) @@ -658,6 +1469,35 @@ func (_m *Store) DeleteOrganization(ctx context.Context, orgID string) error { return r0 } +// Store_DeleteOrganization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteOrganization' +type Store_DeleteOrganization_Call struct { + *mock.Call +} + +// DeleteOrganization is a helper method to define mock.On call +// - ctx context.Context +// - orgID string +func (_e *Store_Expecter) DeleteOrganization(ctx interface{}, orgID interface{}) *Store_DeleteOrganization_Call { + return &Store_DeleteOrganization_Call{Call: _e.mock.On("DeleteOrganization", ctx, orgID)} +} + +func (_c *Store_DeleteOrganization_Call) Run(run func(ctx context.Context, orgID string)) *Store_DeleteOrganization_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_DeleteOrganization_Call) Return(_a0 error) *Store_DeleteOrganization_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_DeleteOrganization_Call) RunAndReturn(run func(context.Context, string) error) *Store_DeleteOrganization_Call { + _c.Call.Return(run) + return _c +} + // DeletePoolByID provides a mock function with given fields: ctx, poolID func (_m *Store) DeletePoolByID(ctx context.Context, poolID string) error { ret := _m.Called(ctx, poolID) @@ -676,6 +1516,35 @@ func (_m *Store) DeletePoolByID(ctx context.Context, poolID string) error { return r0 } +// Store_DeletePoolByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeletePoolByID' +type Store_DeletePoolByID_Call struct { + *mock.Call +} + +// DeletePoolByID is a helper method to define mock.On call +// - ctx context.Context +// - poolID string +func (_e *Store_Expecter) DeletePoolByID(ctx interface{}, poolID interface{}) *Store_DeletePoolByID_Call { + return &Store_DeletePoolByID_Call{Call: _e.mock.On("DeletePoolByID", ctx, poolID)} +} + +func (_c *Store_DeletePoolByID_Call) Run(run func(ctx context.Context, poolID string)) *Store_DeletePoolByID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_DeletePoolByID_Call) Return(_a0 error) *Store_DeletePoolByID_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_DeletePoolByID_Call) RunAndReturn(run func(context.Context, string) error) *Store_DeletePoolByID_Call { + _c.Call.Return(run) + return _c +} + // DeleteRepository provides a mock function with given fields: ctx, repoID func (_m *Store) DeleteRepository(ctx context.Context, repoID string) error { ret := _m.Called(ctx, repoID) @@ -694,6 +1563,35 @@ func (_m *Store) DeleteRepository(ctx context.Context, repoID string) error { return r0 } +// Store_DeleteRepository_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteRepository' +type Store_DeleteRepository_Call struct { + *mock.Call +} + +// DeleteRepository is a helper method to define mock.On call +// - ctx context.Context +// - repoID string +func (_e *Store_Expecter) DeleteRepository(ctx interface{}, repoID interface{}) *Store_DeleteRepository_Call { + return &Store_DeleteRepository_Call{Call: _e.mock.On("DeleteRepository", ctx, repoID)} +} + +func (_c *Store_DeleteRepository_Call) Run(run func(ctx context.Context, repoID string)) *Store_DeleteRepository_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_DeleteRepository_Call) Return(_a0 error) *Store_DeleteRepository_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_DeleteRepository_Call) RunAndReturn(run func(context.Context, string) error) *Store_DeleteRepository_Call { + _c.Call.Return(run) + return _c +} + // DeleteScaleSetByID provides a mock function with given fields: ctx, scaleSetID func (_m *Store) DeleteScaleSetByID(ctx context.Context, scaleSetID uint) error { ret := _m.Called(ctx, scaleSetID) @@ -712,6 +1610,35 @@ func (_m *Store) DeleteScaleSetByID(ctx context.Context, scaleSetID uint) error return r0 } +// Store_DeleteScaleSetByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteScaleSetByID' +type Store_DeleteScaleSetByID_Call struct { + *mock.Call +} + +// DeleteScaleSetByID is a helper method to define mock.On call +// - ctx context.Context +// - scaleSetID uint +func (_e *Store_Expecter) DeleteScaleSetByID(ctx interface{}, scaleSetID interface{}) *Store_DeleteScaleSetByID_Call { + return &Store_DeleteScaleSetByID_Call{Call: _e.mock.On("DeleteScaleSetByID", ctx, scaleSetID)} +} + +func (_c *Store_DeleteScaleSetByID_Call) Run(run func(ctx context.Context, scaleSetID uint)) *Store_DeleteScaleSetByID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint)) + }) + return _c +} + +func (_c *Store_DeleteScaleSetByID_Call) Return(err error) *Store_DeleteScaleSetByID_Call { + _c.Call.Return(err) + return _c +} + +func (_c *Store_DeleteScaleSetByID_Call) RunAndReturn(run func(context.Context, uint) error) *Store_DeleteScaleSetByID_Call { + _c.Call.Return(run) + return _c +} + // FindPoolsMatchingAllTags provides a mock function with given fields: ctx, entityType, entityID, tags func (_m *Store) FindPoolsMatchingAllTags(ctx context.Context, entityType params.ForgeEntityType, entityID string, tags []string) ([]params.Pool, error) { ret := _m.Called(ctx, entityType, entityID, tags) @@ -742,6 +1669,37 @@ func (_m *Store) FindPoolsMatchingAllTags(ctx context.Context, entityType params return r0, r1 } +// Store_FindPoolsMatchingAllTags_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindPoolsMatchingAllTags' +type Store_FindPoolsMatchingAllTags_Call struct { + *mock.Call +} + +// FindPoolsMatchingAllTags is a helper method to define mock.On call +// - ctx context.Context +// - entityType params.ForgeEntityType +// - entityID string +// - tags []string +func (_e *Store_Expecter) FindPoolsMatchingAllTags(ctx interface{}, entityType interface{}, entityID interface{}, tags interface{}) *Store_FindPoolsMatchingAllTags_Call { + return &Store_FindPoolsMatchingAllTags_Call{Call: _e.mock.On("FindPoolsMatchingAllTags", ctx, entityType, entityID, tags)} +} + +func (_c *Store_FindPoolsMatchingAllTags_Call) Run(run func(ctx context.Context, entityType params.ForgeEntityType, entityID string, tags []string)) *Store_FindPoolsMatchingAllTags_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.ForgeEntityType), args[2].(string), args[3].([]string)) + }) + return _c +} + +func (_c *Store_FindPoolsMatchingAllTags_Call) Return(_a0 []params.Pool, _a1 error) *Store_FindPoolsMatchingAllTags_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_FindPoolsMatchingAllTags_Call) RunAndReturn(run func(context.Context, params.ForgeEntityType, string, []string) ([]params.Pool, error)) *Store_FindPoolsMatchingAllTags_Call { + _c.Call.Return(run) + return _c +} + // GetAdminUser provides a mock function with given fields: ctx func (_m *Store) GetAdminUser(ctx context.Context) (params.User, error) { ret := _m.Called(ctx) @@ -770,6 +1728,34 @@ func (_m *Store) GetAdminUser(ctx context.Context) (params.User, error) { return r0, r1 } +// Store_GetAdminUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAdminUser' +type Store_GetAdminUser_Call struct { + *mock.Call +} + +// GetAdminUser is a helper method to define mock.On call +// - ctx context.Context +func (_e *Store_Expecter) GetAdminUser(ctx interface{}) *Store_GetAdminUser_Call { + return &Store_GetAdminUser_Call{Call: _e.mock.On("GetAdminUser", ctx)} +} + +func (_c *Store_GetAdminUser_Call) Run(run func(ctx context.Context)) *Store_GetAdminUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Store_GetAdminUser_Call) Return(_a0 params.User, _a1 error) *Store_GetAdminUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetAdminUser_Call) RunAndReturn(run func(context.Context) (params.User, error)) *Store_GetAdminUser_Call { + _c.Call.Return(run) + return _c +} + // GetEnterprise provides a mock function with given fields: ctx, name, endpointName func (_m *Store) GetEnterprise(ctx context.Context, name string, endpointName string) (params.Enterprise, error) { ret := _m.Called(ctx, name, endpointName) @@ -798,6 +1784,36 @@ func (_m *Store) GetEnterprise(ctx context.Context, name string, endpointName st return r0, r1 } +// Store_GetEnterprise_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEnterprise' +type Store_GetEnterprise_Call struct { + *mock.Call +} + +// GetEnterprise is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - endpointName string +func (_e *Store_Expecter) GetEnterprise(ctx interface{}, name interface{}, endpointName interface{}) *Store_GetEnterprise_Call { + return &Store_GetEnterprise_Call{Call: _e.mock.On("GetEnterprise", ctx, name, endpointName)} +} + +func (_c *Store_GetEnterprise_Call) Run(run func(ctx context.Context, name string, endpointName string)) *Store_GetEnterprise_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *Store_GetEnterprise_Call) Return(_a0 params.Enterprise, _a1 error) *Store_GetEnterprise_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetEnterprise_Call) RunAndReturn(run func(context.Context, string, string) (params.Enterprise, error)) *Store_GetEnterprise_Call { + _c.Call.Return(run) + return _c +} + // GetEnterpriseByID provides a mock function with given fields: ctx, enterpriseID func (_m *Store) GetEnterpriseByID(ctx context.Context, enterpriseID string) (params.Enterprise, error) { ret := _m.Called(ctx, enterpriseID) @@ -826,6 +1842,35 @@ func (_m *Store) GetEnterpriseByID(ctx context.Context, enterpriseID string) (pa return r0, r1 } +// Store_GetEnterpriseByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEnterpriseByID' +type Store_GetEnterpriseByID_Call struct { + *mock.Call +} + +// GetEnterpriseByID is a helper method to define mock.On call +// - ctx context.Context +// - enterpriseID string +func (_e *Store_Expecter) GetEnterpriseByID(ctx interface{}, enterpriseID interface{}) *Store_GetEnterpriseByID_Call { + return &Store_GetEnterpriseByID_Call{Call: _e.mock.On("GetEnterpriseByID", ctx, enterpriseID)} +} + +func (_c *Store_GetEnterpriseByID_Call) Run(run func(ctx context.Context, enterpriseID string)) *Store_GetEnterpriseByID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_GetEnterpriseByID_Call) Return(_a0 params.Enterprise, _a1 error) *Store_GetEnterpriseByID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetEnterpriseByID_Call) RunAndReturn(run func(context.Context, string) (params.Enterprise, error)) *Store_GetEnterpriseByID_Call { + _c.Call.Return(run) + return _c +} + // GetEntityPool provides a mock function with given fields: ctx, entity, poolID func (_m *Store) GetEntityPool(ctx context.Context, entity params.ForgeEntity, poolID string) (params.Pool, error) { ret := _m.Called(ctx, entity, poolID) @@ -854,6 +1899,36 @@ func (_m *Store) GetEntityPool(ctx context.Context, entity params.ForgeEntity, p return r0, r1 } +// Store_GetEntityPool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEntityPool' +type Store_GetEntityPool_Call struct { + *mock.Call +} + +// GetEntityPool is a helper method to define mock.On call +// - ctx context.Context +// - entity params.ForgeEntity +// - poolID string +func (_e *Store_Expecter) GetEntityPool(ctx interface{}, entity interface{}, poolID interface{}) *Store_GetEntityPool_Call { + return &Store_GetEntityPool_Call{Call: _e.mock.On("GetEntityPool", ctx, entity, poolID)} +} + +func (_c *Store_GetEntityPool_Call) Run(run func(ctx context.Context, entity params.ForgeEntity, poolID string)) *Store_GetEntityPool_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.ForgeEntity), args[2].(string)) + }) + return _c +} + +func (_c *Store_GetEntityPool_Call) Return(_a0 params.Pool, _a1 error) *Store_GetEntityPool_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetEntityPool_Call) RunAndReturn(run func(context.Context, params.ForgeEntity, string) (params.Pool, error)) *Store_GetEntityPool_Call { + _c.Call.Return(run) + return _c +} + // GetForgeEntity provides a mock function with given fields: _a0, entityType, entityID func (_m *Store) GetForgeEntity(_a0 context.Context, entityType params.ForgeEntityType, entityID string) (params.ForgeEntity, error) { ret := _m.Called(_a0, entityType, entityID) @@ -882,6 +1957,36 @@ func (_m *Store) GetForgeEntity(_a0 context.Context, entityType params.ForgeEnti return r0, r1 } +// Store_GetForgeEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetForgeEntity' +type Store_GetForgeEntity_Call struct { + *mock.Call +} + +// GetForgeEntity is a helper method to define mock.On call +// - _a0 context.Context +// - entityType params.ForgeEntityType +// - entityID string +func (_e *Store_Expecter) GetForgeEntity(_a0 interface{}, entityType interface{}, entityID interface{}) *Store_GetForgeEntity_Call { + return &Store_GetForgeEntity_Call{Call: _e.mock.On("GetForgeEntity", _a0, entityType, entityID)} +} + +func (_c *Store_GetForgeEntity_Call) Run(run func(_a0 context.Context, entityType params.ForgeEntityType, entityID string)) *Store_GetForgeEntity_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.ForgeEntityType), args[2].(string)) + }) + return _c +} + +func (_c *Store_GetForgeEntity_Call) Return(_a0 params.ForgeEntity, _a1 error) *Store_GetForgeEntity_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetForgeEntity_Call) RunAndReturn(run func(context.Context, params.ForgeEntityType, string) (params.ForgeEntity, error)) *Store_GetForgeEntity_Call { + _c.Call.Return(run) + return _c +} + // GetGiteaCredentials provides a mock function with given fields: ctx, id, detailed func (_m *Store) GetGiteaCredentials(ctx context.Context, id uint, detailed bool) (params.ForgeCredentials, error) { ret := _m.Called(ctx, id, detailed) @@ -910,6 +2015,36 @@ func (_m *Store) GetGiteaCredentials(ctx context.Context, id uint, detailed bool return r0, r1 } +// Store_GetGiteaCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGiteaCredentials' +type Store_GetGiteaCredentials_Call struct { + *mock.Call +} + +// GetGiteaCredentials is a helper method to define mock.On call +// - ctx context.Context +// - id uint +// - detailed bool +func (_e *Store_Expecter) GetGiteaCredentials(ctx interface{}, id interface{}, detailed interface{}) *Store_GetGiteaCredentials_Call { + return &Store_GetGiteaCredentials_Call{Call: _e.mock.On("GetGiteaCredentials", ctx, id, detailed)} +} + +func (_c *Store_GetGiteaCredentials_Call) Run(run func(ctx context.Context, id uint, detailed bool)) *Store_GetGiteaCredentials_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint), args[2].(bool)) + }) + return _c +} + +func (_c *Store_GetGiteaCredentials_Call) Return(_a0 params.ForgeCredentials, _a1 error) *Store_GetGiteaCredentials_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetGiteaCredentials_Call) RunAndReturn(run func(context.Context, uint, bool) (params.ForgeCredentials, error)) *Store_GetGiteaCredentials_Call { + _c.Call.Return(run) + return _c +} + // GetGiteaCredentialsByName provides a mock function with given fields: ctx, name, detailed func (_m *Store) GetGiteaCredentialsByName(ctx context.Context, name string, detailed bool) (params.ForgeCredentials, error) { ret := _m.Called(ctx, name, detailed) @@ -938,6 +2073,36 @@ func (_m *Store) GetGiteaCredentialsByName(ctx context.Context, name string, det return r0, r1 } +// Store_GetGiteaCredentialsByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGiteaCredentialsByName' +type Store_GetGiteaCredentialsByName_Call struct { + *mock.Call +} + +// GetGiteaCredentialsByName is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - detailed bool +func (_e *Store_Expecter) GetGiteaCredentialsByName(ctx interface{}, name interface{}, detailed interface{}) *Store_GetGiteaCredentialsByName_Call { + return &Store_GetGiteaCredentialsByName_Call{Call: _e.mock.On("GetGiteaCredentialsByName", ctx, name, detailed)} +} + +func (_c *Store_GetGiteaCredentialsByName_Call) Run(run func(ctx context.Context, name string, detailed bool)) *Store_GetGiteaCredentialsByName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(bool)) + }) + return _c +} + +func (_c *Store_GetGiteaCredentialsByName_Call) Return(_a0 params.ForgeCredentials, _a1 error) *Store_GetGiteaCredentialsByName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetGiteaCredentialsByName_Call) RunAndReturn(run func(context.Context, string, bool) (params.ForgeCredentials, error)) *Store_GetGiteaCredentialsByName_Call { + _c.Call.Return(run) + return _c +} + // GetGiteaEndpoint provides a mock function with given fields: _a0, name func (_m *Store) GetGiteaEndpoint(_a0 context.Context, name string) (params.ForgeEndpoint, error) { ret := _m.Called(_a0, name) @@ -966,6 +2131,35 @@ func (_m *Store) GetGiteaEndpoint(_a0 context.Context, name string) (params.Forg return r0, r1 } +// Store_GetGiteaEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGiteaEndpoint' +type Store_GetGiteaEndpoint_Call struct { + *mock.Call +} + +// GetGiteaEndpoint is a helper method to define mock.On call +// - _a0 context.Context +// - name string +func (_e *Store_Expecter) GetGiteaEndpoint(_a0 interface{}, name interface{}) *Store_GetGiteaEndpoint_Call { + return &Store_GetGiteaEndpoint_Call{Call: _e.mock.On("GetGiteaEndpoint", _a0, name)} +} + +func (_c *Store_GetGiteaEndpoint_Call) Run(run func(_a0 context.Context, name string)) *Store_GetGiteaEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_GetGiteaEndpoint_Call) Return(_a0 params.ForgeEndpoint, _a1 error) *Store_GetGiteaEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetGiteaEndpoint_Call) RunAndReturn(run func(context.Context, string) (params.ForgeEndpoint, error)) *Store_GetGiteaEndpoint_Call { + _c.Call.Return(run) + return _c +} + // GetGithubCredentials provides a mock function with given fields: ctx, id, detailed func (_m *Store) GetGithubCredentials(ctx context.Context, id uint, detailed bool) (params.ForgeCredentials, error) { ret := _m.Called(ctx, id, detailed) @@ -994,6 +2188,36 @@ func (_m *Store) GetGithubCredentials(ctx context.Context, id uint, detailed boo return r0, r1 } +// Store_GetGithubCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGithubCredentials' +type Store_GetGithubCredentials_Call struct { + *mock.Call +} + +// GetGithubCredentials is a helper method to define mock.On call +// - ctx context.Context +// - id uint +// - detailed bool +func (_e *Store_Expecter) GetGithubCredentials(ctx interface{}, id interface{}, detailed interface{}) *Store_GetGithubCredentials_Call { + return &Store_GetGithubCredentials_Call{Call: _e.mock.On("GetGithubCredentials", ctx, id, detailed)} +} + +func (_c *Store_GetGithubCredentials_Call) Run(run func(ctx context.Context, id uint, detailed bool)) *Store_GetGithubCredentials_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint), args[2].(bool)) + }) + return _c +} + +func (_c *Store_GetGithubCredentials_Call) Return(_a0 params.ForgeCredentials, _a1 error) *Store_GetGithubCredentials_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetGithubCredentials_Call) RunAndReturn(run func(context.Context, uint, bool) (params.ForgeCredentials, error)) *Store_GetGithubCredentials_Call { + _c.Call.Return(run) + return _c +} + // GetGithubCredentialsByName provides a mock function with given fields: ctx, name, detailed func (_m *Store) GetGithubCredentialsByName(ctx context.Context, name string, detailed bool) (params.ForgeCredentials, error) { ret := _m.Called(ctx, name, detailed) @@ -1022,6 +2246,36 @@ func (_m *Store) GetGithubCredentialsByName(ctx context.Context, name string, de return r0, r1 } +// Store_GetGithubCredentialsByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGithubCredentialsByName' +type Store_GetGithubCredentialsByName_Call struct { + *mock.Call +} + +// GetGithubCredentialsByName is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - detailed bool +func (_e *Store_Expecter) GetGithubCredentialsByName(ctx interface{}, name interface{}, detailed interface{}) *Store_GetGithubCredentialsByName_Call { + return &Store_GetGithubCredentialsByName_Call{Call: _e.mock.On("GetGithubCredentialsByName", ctx, name, detailed)} +} + +func (_c *Store_GetGithubCredentialsByName_Call) Run(run func(ctx context.Context, name string, detailed bool)) *Store_GetGithubCredentialsByName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(bool)) + }) + return _c +} + +func (_c *Store_GetGithubCredentialsByName_Call) Return(_a0 params.ForgeCredentials, _a1 error) *Store_GetGithubCredentialsByName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetGithubCredentialsByName_Call) RunAndReturn(run func(context.Context, string, bool) (params.ForgeCredentials, error)) *Store_GetGithubCredentialsByName_Call { + _c.Call.Return(run) + return _c +} + // GetGithubEndpoint provides a mock function with given fields: ctx, name func (_m *Store) GetGithubEndpoint(ctx context.Context, name string) (params.ForgeEndpoint, error) { ret := _m.Called(ctx, name) @@ -1050,6 +2304,35 @@ func (_m *Store) GetGithubEndpoint(ctx context.Context, name string) (params.For return r0, r1 } +// Store_GetGithubEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGithubEndpoint' +type Store_GetGithubEndpoint_Call struct { + *mock.Call +} + +// GetGithubEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - name string +func (_e *Store_Expecter) GetGithubEndpoint(ctx interface{}, name interface{}) *Store_GetGithubEndpoint_Call { + return &Store_GetGithubEndpoint_Call{Call: _e.mock.On("GetGithubEndpoint", ctx, name)} +} + +func (_c *Store_GetGithubEndpoint_Call) Run(run func(ctx context.Context, name string)) *Store_GetGithubEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_GetGithubEndpoint_Call) Return(_a0 params.ForgeEndpoint, _a1 error) *Store_GetGithubEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetGithubEndpoint_Call) RunAndReturn(run func(context.Context, string) (params.ForgeEndpoint, error)) *Store_GetGithubEndpoint_Call { + _c.Call.Return(run) + return _c +} + // GetInstanceByName provides a mock function with given fields: ctx, instanceName func (_m *Store) GetInstanceByName(ctx context.Context, instanceName string) (params.Instance, error) { ret := _m.Called(ctx, instanceName) @@ -1078,6 +2361,35 @@ func (_m *Store) GetInstanceByName(ctx context.Context, instanceName string) (pa return r0, r1 } +// Store_GetInstanceByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetInstanceByName' +type Store_GetInstanceByName_Call struct { + *mock.Call +} + +// GetInstanceByName is a helper method to define mock.On call +// - ctx context.Context +// - instanceName string +func (_e *Store_Expecter) GetInstanceByName(ctx interface{}, instanceName interface{}) *Store_GetInstanceByName_Call { + return &Store_GetInstanceByName_Call{Call: _e.mock.On("GetInstanceByName", ctx, instanceName)} +} + +func (_c *Store_GetInstanceByName_Call) Run(run func(ctx context.Context, instanceName string)) *Store_GetInstanceByName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_GetInstanceByName_Call) Return(_a0 params.Instance, _a1 error) *Store_GetInstanceByName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetInstanceByName_Call) RunAndReturn(run func(context.Context, string) (params.Instance, error)) *Store_GetInstanceByName_Call { + _c.Call.Return(run) + return _c +} + // GetJobByID provides a mock function with given fields: ctx, jobID func (_m *Store) GetJobByID(ctx context.Context, jobID int64) (params.Job, error) { ret := _m.Called(ctx, jobID) @@ -1106,6 +2418,35 @@ func (_m *Store) GetJobByID(ctx context.Context, jobID int64) (params.Job, error return r0, r1 } +// Store_GetJobByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetJobByID' +type Store_GetJobByID_Call struct { + *mock.Call +} + +// GetJobByID is a helper method to define mock.On call +// - ctx context.Context +// - jobID int64 +func (_e *Store_Expecter) GetJobByID(ctx interface{}, jobID interface{}) *Store_GetJobByID_Call { + return &Store_GetJobByID_Call{Call: _e.mock.On("GetJobByID", ctx, jobID)} +} + +func (_c *Store_GetJobByID_Call) Run(run func(ctx context.Context, jobID int64)) *Store_GetJobByID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64)) + }) + return _c +} + +func (_c *Store_GetJobByID_Call) Return(_a0 params.Job, _a1 error) *Store_GetJobByID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetJobByID_Call) RunAndReturn(run func(context.Context, int64) (params.Job, error)) *Store_GetJobByID_Call { + _c.Call.Return(run) + return _c +} + // GetOrganization provides a mock function with given fields: ctx, name, endpointName func (_m *Store) GetOrganization(ctx context.Context, name string, endpointName string) (params.Organization, error) { ret := _m.Called(ctx, name, endpointName) @@ -1134,6 +2475,36 @@ func (_m *Store) GetOrganization(ctx context.Context, name string, endpointName return r0, r1 } +// Store_GetOrganization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOrganization' +type Store_GetOrganization_Call struct { + *mock.Call +} + +// GetOrganization is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - endpointName string +func (_e *Store_Expecter) GetOrganization(ctx interface{}, name interface{}, endpointName interface{}) *Store_GetOrganization_Call { + return &Store_GetOrganization_Call{Call: _e.mock.On("GetOrganization", ctx, name, endpointName)} +} + +func (_c *Store_GetOrganization_Call) Run(run func(ctx context.Context, name string, endpointName string)) *Store_GetOrganization_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *Store_GetOrganization_Call) Return(_a0 params.Organization, _a1 error) *Store_GetOrganization_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetOrganization_Call) RunAndReturn(run func(context.Context, string, string) (params.Organization, error)) *Store_GetOrganization_Call { + _c.Call.Return(run) + return _c +} + // GetOrganizationByID provides a mock function with given fields: ctx, orgID func (_m *Store) GetOrganizationByID(ctx context.Context, orgID string) (params.Organization, error) { ret := _m.Called(ctx, orgID) @@ -1162,6 +2533,35 @@ func (_m *Store) GetOrganizationByID(ctx context.Context, orgID string) (params. return r0, r1 } +// Store_GetOrganizationByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOrganizationByID' +type Store_GetOrganizationByID_Call struct { + *mock.Call +} + +// GetOrganizationByID is a helper method to define mock.On call +// - ctx context.Context +// - orgID string +func (_e *Store_Expecter) GetOrganizationByID(ctx interface{}, orgID interface{}) *Store_GetOrganizationByID_Call { + return &Store_GetOrganizationByID_Call{Call: _e.mock.On("GetOrganizationByID", ctx, orgID)} +} + +func (_c *Store_GetOrganizationByID_Call) Run(run func(ctx context.Context, orgID string)) *Store_GetOrganizationByID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_GetOrganizationByID_Call) Return(_a0 params.Organization, _a1 error) *Store_GetOrganizationByID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetOrganizationByID_Call) RunAndReturn(run func(context.Context, string) (params.Organization, error)) *Store_GetOrganizationByID_Call { + _c.Call.Return(run) + return _c +} + // GetPoolByID provides a mock function with given fields: ctx, poolID func (_m *Store) GetPoolByID(ctx context.Context, poolID string) (params.Pool, error) { ret := _m.Called(ctx, poolID) @@ -1190,6 +2590,35 @@ func (_m *Store) GetPoolByID(ctx context.Context, poolID string) (params.Pool, e return r0, r1 } +// Store_GetPoolByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPoolByID' +type Store_GetPoolByID_Call struct { + *mock.Call +} + +// GetPoolByID is a helper method to define mock.On call +// - ctx context.Context +// - poolID string +func (_e *Store_Expecter) GetPoolByID(ctx interface{}, poolID interface{}) *Store_GetPoolByID_Call { + return &Store_GetPoolByID_Call{Call: _e.mock.On("GetPoolByID", ctx, poolID)} +} + +func (_c *Store_GetPoolByID_Call) Run(run func(ctx context.Context, poolID string)) *Store_GetPoolByID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_GetPoolByID_Call) Return(_a0 params.Pool, _a1 error) *Store_GetPoolByID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetPoolByID_Call) RunAndReturn(run func(context.Context, string) (params.Pool, error)) *Store_GetPoolByID_Call { + _c.Call.Return(run) + return _c +} + // GetPoolInstanceByName provides a mock function with given fields: ctx, poolID, instanceName func (_m *Store) GetPoolInstanceByName(ctx context.Context, poolID string, instanceName string) (params.Instance, error) { ret := _m.Called(ctx, poolID, instanceName) @@ -1218,6 +2647,36 @@ func (_m *Store) GetPoolInstanceByName(ctx context.Context, poolID string, insta return r0, r1 } +// Store_GetPoolInstanceByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPoolInstanceByName' +type Store_GetPoolInstanceByName_Call struct { + *mock.Call +} + +// GetPoolInstanceByName is a helper method to define mock.On call +// - ctx context.Context +// - poolID string +// - instanceName string +func (_e *Store_Expecter) GetPoolInstanceByName(ctx interface{}, poolID interface{}, instanceName interface{}) *Store_GetPoolInstanceByName_Call { + return &Store_GetPoolInstanceByName_Call{Call: _e.mock.On("GetPoolInstanceByName", ctx, poolID, instanceName)} +} + +func (_c *Store_GetPoolInstanceByName_Call) Run(run func(ctx context.Context, poolID string, instanceName string)) *Store_GetPoolInstanceByName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *Store_GetPoolInstanceByName_Call) Return(_a0 params.Instance, _a1 error) *Store_GetPoolInstanceByName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetPoolInstanceByName_Call) RunAndReturn(run func(context.Context, string, string) (params.Instance, error)) *Store_GetPoolInstanceByName_Call { + _c.Call.Return(run) + return _c +} + // GetRepository provides a mock function with given fields: ctx, owner, name, endpointName func (_m *Store) GetRepository(ctx context.Context, owner string, name string, endpointName string) (params.Repository, error) { ret := _m.Called(ctx, owner, name, endpointName) @@ -1246,6 +2705,37 @@ func (_m *Store) GetRepository(ctx context.Context, owner string, name string, e return r0, r1 } +// Store_GetRepository_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRepository' +type Store_GetRepository_Call struct { + *mock.Call +} + +// GetRepository is a helper method to define mock.On call +// - ctx context.Context +// - owner string +// - name string +// - endpointName string +func (_e *Store_Expecter) GetRepository(ctx interface{}, owner interface{}, name interface{}, endpointName interface{}) *Store_GetRepository_Call { + return &Store_GetRepository_Call{Call: _e.mock.On("GetRepository", ctx, owner, name, endpointName)} +} + +func (_c *Store_GetRepository_Call) Run(run func(ctx context.Context, owner string, name string, endpointName string)) *Store_GetRepository_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(string)) + }) + return _c +} + +func (_c *Store_GetRepository_Call) Return(_a0 params.Repository, _a1 error) *Store_GetRepository_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetRepository_Call) RunAndReturn(run func(context.Context, string, string, string) (params.Repository, error)) *Store_GetRepository_Call { + _c.Call.Return(run) + return _c +} + // GetRepositoryByID provides a mock function with given fields: ctx, repoID func (_m *Store) GetRepositoryByID(ctx context.Context, repoID string) (params.Repository, error) { ret := _m.Called(ctx, repoID) @@ -1274,6 +2764,35 @@ func (_m *Store) GetRepositoryByID(ctx context.Context, repoID string) (params.R return r0, r1 } +// Store_GetRepositoryByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRepositoryByID' +type Store_GetRepositoryByID_Call struct { + *mock.Call +} + +// GetRepositoryByID is a helper method to define mock.On call +// - ctx context.Context +// - repoID string +func (_e *Store_Expecter) GetRepositoryByID(ctx interface{}, repoID interface{}) *Store_GetRepositoryByID_Call { + return &Store_GetRepositoryByID_Call{Call: _e.mock.On("GetRepositoryByID", ctx, repoID)} +} + +func (_c *Store_GetRepositoryByID_Call) Run(run func(ctx context.Context, repoID string)) *Store_GetRepositoryByID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_GetRepositoryByID_Call) Return(_a0 params.Repository, _a1 error) *Store_GetRepositoryByID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetRepositoryByID_Call) RunAndReturn(run func(context.Context, string) (params.Repository, error)) *Store_GetRepositoryByID_Call { + _c.Call.Return(run) + return _c +} + // GetScaleSetByID provides a mock function with given fields: ctx, scaleSet func (_m *Store) GetScaleSetByID(ctx context.Context, scaleSet uint) (params.ScaleSet, error) { ret := _m.Called(ctx, scaleSet) @@ -1302,6 +2821,35 @@ func (_m *Store) GetScaleSetByID(ctx context.Context, scaleSet uint) (params.Sca return r0, r1 } +// Store_GetScaleSetByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetScaleSetByID' +type Store_GetScaleSetByID_Call struct { + *mock.Call +} + +// GetScaleSetByID is a helper method to define mock.On call +// - ctx context.Context +// - scaleSet uint +func (_e *Store_Expecter) GetScaleSetByID(ctx interface{}, scaleSet interface{}) *Store_GetScaleSetByID_Call { + return &Store_GetScaleSetByID_Call{Call: _e.mock.On("GetScaleSetByID", ctx, scaleSet)} +} + +func (_c *Store_GetScaleSetByID_Call) Run(run func(ctx context.Context, scaleSet uint)) *Store_GetScaleSetByID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint)) + }) + return _c +} + +func (_c *Store_GetScaleSetByID_Call) Return(_a0 params.ScaleSet, _a1 error) *Store_GetScaleSetByID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetScaleSetByID_Call) RunAndReturn(run func(context.Context, uint) (params.ScaleSet, error)) *Store_GetScaleSetByID_Call { + _c.Call.Return(run) + return _c +} + // GetUser provides a mock function with given fields: ctx, user func (_m *Store) GetUser(ctx context.Context, user string) (params.User, error) { ret := _m.Called(ctx, user) @@ -1330,6 +2878,35 @@ func (_m *Store) GetUser(ctx context.Context, user string) (params.User, error) return r0, r1 } +// Store_GetUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUser' +type Store_GetUser_Call struct { + *mock.Call +} + +// GetUser is a helper method to define mock.On call +// - ctx context.Context +// - user string +func (_e *Store_Expecter) GetUser(ctx interface{}, user interface{}) *Store_GetUser_Call { + return &Store_GetUser_Call{Call: _e.mock.On("GetUser", ctx, user)} +} + +func (_c *Store_GetUser_Call) Run(run func(ctx context.Context, user string)) *Store_GetUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_GetUser_Call) Return(_a0 params.User, _a1 error) *Store_GetUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetUser_Call) RunAndReturn(run func(context.Context, string) (params.User, error)) *Store_GetUser_Call { + _c.Call.Return(run) + return _c +} + // GetUserByID provides a mock function with given fields: ctx, userID func (_m *Store) GetUserByID(ctx context.Context, userID string) (params.User, error) { ret := _m.Called(ctx, userID) @@ -1358,6 +2935,35 @@ func (_m *Store) GetUserByID(ctx context.Context, userID string) (params.User, e return r0, r1 } +// Store_GetUserByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUserByID' +type Store_GetUserByID_Call struct { + *mock.Call +} + +// GetUserByID is a helper method to define mock.On call +// - ctx context.Context +// - userID string +func (_e *Store_Expecter) GetUserByID(ctx interface{}, userID interface{}) *Store_GetUserByID_Call { + return &Store_GetUserByID_Call{Call: _e.mock.On("GetUserByID", ctx, userID)} +} + +func (_c *Store_GetUserByID_Call) Run(run func(ctx context.Context, userID string)) *Store_GetUserByID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_GetUserByID_Call) Return(_a0 params.User, _a1 error) *Store_GetUserByID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_GetUserByID_Call) RunAndReturn(run func(context.Context, string) (params.User, error)) *Store_GetUserByID_Call { + _c.Call.Return(run) + return _c +} + // HasAdminUser provides a mock function with given fields: ctx func (_m *Store) HasAdminUser(ctx context.Context) bool { ret := _m.Called(ctx) @@ -1376,6 +2982,34 @@ func (_m *Store) HasAdminUser(ctx context.Context) bool { return r0 } +// Store_HasAdminUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasAdminUser' +type Store_HasAdminUser_Call struct { + *mock.Call +} + +// HasAdminUser is a helper method to define mock.On call +// - ctx context.Context +func (_e *Store_Expecter) HasAdminUser(ctx interface{}) *Store_HasAdminUser_Call { + return &Store_HasAdminUser_Call{Call: _e.mock.On("HasAdminUser", ctx)} +} + +func (_c *Store_HasAdminUser_Call) Run(run func(ctx context.Context)) *Store_HasAdminUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Store_HasAdminUser_Call) Return(_a0 bool) *Store_HasAdminUser_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_HasAdminUser_Call) RunAndReturn(run func(context.Context) bool) *Store_HasAdminUser_Call { + _c.Call.Return(run) + return _c +} + // InitController provides a mock function with no fields func (_m *Store) InitController() (params.ControllerInfo, error) { ret := _m.Called() @@ -1404,6 +3038,33 @@ func (_m *Store) InitController() (params.ControllerInfo, error) { return r0, r1 } +// Store_InitController_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InitController' +type Store_InitController_Call struct { + *mock.Call +} + +// InitController is a helper method to define mock.On call +func (_e *Store_Expecter) InitController() *Store_InitController_Call { + return &Store_InitController_Call{Call: _e.mock.On("InitController")} +} + +func (_c *Store_InitController_Call) Run(run func()) *Store_InitController_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Store_InitController_Call) Return(_a0 params.ControllerInfo, _a1 error) *Store_InitController_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_InitController_Call) RunAndReturn(run func() (params.ControllerInfo, error)) *Store_InitController_Call { + _c.Call.Return(run) + return _c +} + // ListAllInstances provides a mock function with given fields: ctx func (_m *Store) ListAllInstances(ctx context.Context) ([]params.Instance, error) { ret := _m.Called(ctx) @@ -1434,6 +3095,34 @@ func (_m *Store) ListAllInstances(ctx context.Context) ([]params.Instance, error return r0, r1 } +// Store_ListAllInstances_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAllInstances' +type Store_ListAllInstances_Call struct { + *mock.Call +} + +// ListAllInstances is a helper method to define mock.On call +// - ctx context.Context +func (_e *Store_Expecter) ListAllInstances(ctx interface{}) *Store_ListAllInstances_Call { + return &Store_ListAllInstances_Call{Call: _e.mock.On("ListAllInstances", ctx)} +} + +func (_c *Store_ListAllInstances_Call) Run(run func(ctx context.Context)) *Store_ListAllInstances_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Store_ListAllInstances_Call) Return(_a0 []params.Instance, _a1 error) *Store_ListAllInstances_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListAllInstances_Call) RunAndReturn(run func(context.Context) ([]params.Instance, error)) *Store_ListAllInstances_Call { + _c.Call.Return(run) + return _c +} + // ListAllJobs provides a mock function with given fields: ctx func (_m *Store) ListAllJobs(ctx context.Context) ([]params.Job, error) { ret := _m.Called(ctx) @@ -1464,6 +3153,34 @@ func (_m *Store) ListAllJobs(ctx context.Context) ([]params.Job, error) { return r0, r1 } +// Store_ListAllJobs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAllJobs' +type Store_ListAllJobs_Call struct { + *mock.Call +} + +// ListAllJobs is a helper method to define mock.On call +// - ctx context.Context +func (_e *Store_Expecter) ListAllJobs(ctx interface{}) *Store_ListAllJobs_Call { + return &Store_ListAllJobs_Call{Call: _e.mock.On("ListAllJobs", ctx)} +} + +func (_c *Store_ListAllJobs_Call) Run(run func(ctx context.Context)) *Store_ListAllJobs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Store_ListAllJobs_Call) Return(_a0 []params.Job, _a1 error) *Store_ListAllJobs_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListAllJobs_Call) RunAndReturn(run func(context.Context) ([]params.Job, error)) *Store_ListAllJobs_Call { + _c.Call.Return(run) + return _c +} + // ListAllPools provides a mock function with given fields: ctx func (_m *Store) ListAllPools(ctx context.Context) ([]params.Pool, error) { ret := _m.Called(ctx) @@ -1494,6 +3211,34 @@ func (_m *Store) ListAllPools(ctx context.Context) ([]params.Pool, error) { return r0, r1 } +// Store_ListAllPools_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAllPools' +type Store_ListAllPools_Call struct { + *mock.Call +} + +// ListAllPools is a helper method to define mock.On call +// - ctx context.Context +func (_e *Store_Expecter) ListAllPools(ctx interface{}) *Store_ListAllPools_Call { + return &Store_ListAllPools_Call{Call: _e.mock.On("ListAllPools", ctx)} +} + +func (_c *Store_ListAllPools_Call) Run(run func(ctx context.Context)) *Store_ListAllPools_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Store_ListAllPools_Call) Return(_a0 []params.Pool, _a1 error) *Store_ListAllPools_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListAllPools_Call) RunAndReturn(run func(context.Context) ([]params.Pool, error)) *Store_ListAllPools_Call { + _c.Call.Return(run) + return _c +} + // ListAllScaleSets provides a mock function with given fields: ctx func (_m *Store) ListAllScaleSets(ctx context.Context) ([]params.ScaleSet, error) { ret := _m.Called(ctx) @@ -1524,6 +3269,34 @@ func (_m *Store) ListAllScaleSets(ctx context.Context) ([]params.ScaleSet, error return r0, r1 } +// Store_ListAllScaleSets_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAllScaleSets' +type Store_ListAllScaleSets_Call struct { + *mock.Call +} + +// ListAllScaleSets is a helper method to define mock.On call +// - ctx context.Context +func (_e *Store_Expecter) ListAllScaleSets(ctx interface{}) *Store_ListAllScaleSets_Call { + return &Store_ListAllScaleSets_Call{Call: _e.mock.On("ListAllScaleSets", ctx)} +} + +func (_c *Store_ListAllScaleSets_Call) Run(run func(ctx context.Context)) *Store_ListAllScaleSets_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Store_ListAllScaleSets_Call) Return(_a0 []params.ScaleSet, _a1 error) *Store_ListAllScaleSets_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListAllScaleSets_Call) RunAndReturn(run func(context.Context) ([]params.ScaleSet, error)) *Store_ListAllScaleSets_Call { + _c.Call.Return(run) + return _c +} + // ListEnterprises provides a mock function with given fields: ctx, filter func (_m *Store) ListEnterprises(ctx context.Context, filter params.EnterpriseFilter) ([]params.Enterprise, error) { ret := _m.Called(ctx, filter) @@ -1554,6 +3327,35 @@ func (_m *Store) ListEnterprises(ctx context.Context, filter params.EnterpriseFi return r0, r1 } +// Store_ListEnterprises_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEnterprises' +type Store_ListEnterprises_Call struct { + *mock.Call +} + +// ListEnterprises is a helper method to define mock.On call +// - ctx context.Context +// - filter params.EnterpriseFilter +func (_e *Store_Expecter) ListEnterprises(ctx interface{}, filter interface{}) *Store_ListEnterprises_Call { + return &Store_ListEnterprises_Call{Call: _e.mock.On("ListEnterprises", ctx, filter)} +} + +func (_c *Store_ListEnterprises_Call) Run(run func(ctx context.Context, filter params.EnterpriseFilter)) *Store_ListEnterprises_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.EnterpriseFilter)) + }) + return _c +} + +func (_c *Store_ListEnterprises_Call) Return(_a0 []params.Enterprise, _a1 error) *Store_ListEnterprises_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListEnterprises_Call) RunAndReturn(run func(context.Context, params.EnterpriseFilter) ([]params.Enterprise, error)) *Store_ListEnterprises_Call { + _c.Call.Return(run) + return _c +} + // ListEntityInstances provides a mock function with given fields: ctx, entity func (_m *Store) ListEntityInstances(ctx context.Context, entity params.ForgeEntity) ([]params.Instance, error) { ret := _m.Called(ctx, entity) @@ -1584,6 +3386,35 @@ func (_m *Store) ListEntityInstances(ctx context.Context, entity params.ForgeEnt return r0, r1 } +// Store_ListEntityInstances_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityInstances' +type Store_ListEntityInstances_Call struct { + *mock.Call +} + +// ListEntityInstances is a helper method to define mock.On call +// - ctx context.Context +// - entity params.ForgeEntity +func (_e *Store_Expecter) ListEntityInstances(ctx interface{}, entity interface{}) *Store_ListEntityInstances_Call { + return &Store_ListEntityInstances_Call{Call: _e.mock.On("ListEntityInstances", ctx, entity)} +} + +func (_c *Store_ListEntityInstances_Call) Run(run func(ctx context.Context, entity params.ForgeEntity)) *Store_ListEntityInstances_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.ForgeEntity)) + }) + return _c +} + +func (_c *Store_ListEntityInstances_Call) Return(_a0 []params.Instance, _a1 error) *Store_ListEntityInstances_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListEntityInstances_Call) RunAndReturn(run func(context.Context, params.ForgeEntity) ([]params.Instance, error)) *Store_ListEntityInstances_Call { + _c.Call.Return(run) + return _c +} + // ListEntityJobsByStatus provides a mock function with given fields: ctx, entityType, entityID, status func (_m *Store) ListEntityJobsByStatus(ctx context.Context, entityType params.ForgeEntityType, entityID string, status params.JobStatus) ([]params.Job, error) { ret := _m.Called(ctx, entityType, entityID, status) @@ -1614,6 +3445,37 @@ func (_m *Store) ListEntityJobsByStatus(ctx context.Context, entityType params.F return r0, r1 } +// Store_ListEntityJobsByStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityJobsByStatus' +type Store_ListEntityJobsByStatus_Call struct { + *mock.Call +} + +// ListEntityJobsByStatus is a helper method to define mock.On call +// - ctx context.Context +// - entityType params.ForgeEntityType +// - entityID string +// - status params.JobStatus +func (_e *Store_Expecter) ListEntityJobsByStatus(ctx interface{}, entityType interface{}, entityID interface{}, status interface{}) *Store_ListEntityJobsByStatus_Call { + return &Store_ListEntityJobsByStatus_Call{Call: _e.mock.On("ListEntityJobsByStatus", ctx, entityType, entityID, status)} +} + +func (_c *Store_ListEntityJobsByStatus_Call) Run(run func(ctx context.Context, entityType params.ForgeEntityType, entityID string, status params.JobStatus)) *Store_ListEntityJobsByStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.ForgeEntityType), args[2].(string), args[3].(params.JobStatus)) + }) + return _c +} + +func (_c *Store_ListEntityJobsByStatus_Call) Return(_a0 []params.Job, _a1 error) *Store_ListEntityJobsByStatus_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListEntityJobsByStatus_Call) RunAndReturn(run func(context.Context, params.ForgeEntityType, string, params.JobStatus) ([]params.Job, error)) *Store_ListEntityJobsByStatus_Call { + _c.Call.Return(run) + return _c +} + // ListEntityPools provides a mock function with given fields: ctx, entity func (_m *Store) ListEntityPools(ctx context.Context, entity params.ForgeEntity) ([]params.Pool, error) { ret := _m.Called(ctx, entity) @@ -1644,6 +3506,35 @@ func (_m *Store) ListEntityPools(ctx context.Context, entity params.ForgeEntity) return r0, r1 } +// Store_ListEntityPools_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityPools' +type Store_ListEntityPools_Call struct { + *mock.Call +} + +// ListEntityPools is a helper method to define mock.On call +// - ctx context.Context +// - entity params.ForgeEntity +func (_e *Store_Expecter) ListEntityPools(ctx interface{}, entity interface{}) *Store_ListEntityPools_Call { + return &Store_ListEntityPools_Call{Call: _e.mock.On("ListEntityPools", ctx, entity)} +} + +func (_c *Store_ListEntityPools_Call) Run(run func(ctx context.Context, entity params.ForgeEntity)) *Store_ListEntityPools_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.ForgeEntity)) + }) + return _c +} + +func (_c *Store_ListEntityPools_Call) Return(_a0 []params.Pool, _a1 error) *Store_ListEntityPools_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListEntityPools_Call) RunAndReturn(run func(context.Context, params.ForgeEntity) ([]params.Pool, error)) *Store_ListEntityPools_Call { + _c.Call.Return(run) + return _c +} + // ListEntityScaleSets provides a mock function with given fields: _a0, entity func (_m *Store) ListEntityScaleSets(_a0 context.Context, entity params.ForgeEntity) ([]params.ScaleSet, error) { ret := _m.Called(_a0, entity) @@ -1674,6 +3565,35 @@ func (_m *Store) ListEntityScaleSets(_a0 context.Context, entity params.ForgeEnt return r0, r1 } +// Store_ListEntityScaleSets_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityScaleSets' +type Store_ListEntityScaleSets_Call struct { + *mock.Call +} + +// ListEntityScaleSets is a helper method to define mock.On call +// - _a0 context.Context +// - entity params.ForgeEntity +func (_e *Store_Expecter) ListEntityScaleSets(_a0 interface{}, entity interface{}) *Store_ListEntityScaleSets_Call { + return &Store_ListEntityScaleSets_Call{Call: _e.mock.On("ListEntityScaleSets", _a0, entity)} +} + +func (_c *Store_ListEntityScaleSets_Call) Run(run func(_a0 context.Context, entity params.ForgeEntity)) *Store_ListEntityScaleSets_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.ForgeEntity)) + }) + return _c +} + +func (_c *Store_ListEntityScaleSets_Call) Return(_a0 []params.ScaleSet, _a1 error) *Store_ListEntityScaleSets_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListEntityScaleSets_Call) RunAndReturn(run func(context.Context, params.ForgeEntity) ([]params.ScaleSet, error)) *Store_ListEntityScaleSets_Call { + _c.Call.Return(run) + return _c +} + // ListGiteaCredentials provides a mock function with given fields: ctx func (_m *Store) ListGiteaCredentials(ctx context.Context) ([]params.ForgeCredentials, error) { ret := _m.Called(ctx) @@ -1704,6 +3624,34 @@ func (_m *Store) ListGiteaCredentials(ctx context.Context) ([]params.ForgeCreden return r0, r1 } +// Store_ListGiteaCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListGiteaCredentials' +type Store_ListGiteaCredentials_Call struct { + *mock.Call +} + +// ListGiteaCredentials is a helper method to define mock.On call +// - ctx context.Context +func (_e *Store_Expecter) ListGiteaCredentials(ctx interface{}) *Store_ListGiteaCredentials_Call { + return &Store_ListGiteaCredentials_Call{Call: _e.mock.On("ListGiteaCredentials", ctx)} +} + +func (_c *Store_ListGiteaCredentials_Call) Run(run func(ctx context.Context)) *Store_ListGiteaCredentials_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Store_ListGiteaCredentials_Call) Return(_a0 []params.ForgeCredentials, _a1 error) *Store_ListGiteaCredentials_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListGiteaCredentials_Call) RunAndReturn(run func(context.Context) ([]params.ForgeCredentials, error)) *Store_ListGiteaCredentials_Call { + _c.Call.Return(run) + return _c +} + // ListGiteaEndpoints provides a mock function with given fields: _a0 func (_m *Store) ListGiteaEndpoints(_a0 context.Context) ([]params.ForgeEndpoint, error) { ret := _m.Called(_a0) @@ -1734,6 +3682,34 @@ func (_m *Store) ListGiteaEndpoints(_a0 context.Context) ([]params.ForgeEndpoint return r0, r1 } +// Store_ListGiteaEndpoints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListGiteaEndpoints' +type Store_ListGiteaEndpoints_Call struct { + *mock.Call +} + +// ListGiteaEndpoints is a helper method to define mock.On call +// - _a0 context.Context +func (_e *Store_Expecter) ListGiteaEndpoints(_a0 interface{}) *Store_ListGiteaEndpoints_Call { + return &Store_ListGiteaEndpoints_Call{Call: _e.mock.On("ListGiteaEndpoints", _a0)} +} + +func (_c *Store_ListGiteaEndpoints_Call) Run(run func(_a0 context.Context)) *Store_ListGiteaEndpoints_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Store_ListGiteaEndpoints_Call) Return(_a0 []params.ForgeEndpoint, _a1 error) *Store_ListGiteaEndpoints_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListGiteaEndpoints_Call) RunAndReturn(run func(context.Context) ([]params.ForgeEndpoint, error)) *Store_ListGiteaEndpoints_Call { + _c.Call.Return(run) + return _c +} + // ListGithubCredentials provides a mock function with given fields: ctx func (_m *Store) ListGithubCredentials(ctx context.Context) ([]params.ForgeCredentials, error) { ret := _m.Called(ctx) @@ -1764,6 +3740,34 @@ func (_m *Store) ListGithubCredentials(ctx context.Context) ([]params.ForgeCrede return r0, r1 } +// Store_ListGithubCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListGithubCredentials' +type Store_ListGithubCredentials_Call struct { + *mock.Call +} + +// ListGithubCredentials is a helper method to define mock.On call +// - ctx context.Context +func (_e *Store_Expecter) ListGithubCredentials(ctx interface{}) *Store_ListGithubCredentials_Call { + return &Store_ListGithubCredentials_Call{Call: _e.mock.On("ListGithubCredentials", ctx)} +} + +func (_c *Store_ListGithubCredentials_Call) Run(run func(ctx context.Context)) *Store_ListGithubCredentials_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Store_ListGithubCredentials_Call) Return(_a0 []params.ForgeCredentials, _a1 error) *Store_ListGithubCredentials_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListGithubCredentials_Call) RunAndReturn(run func(context.Context) ([]params.ForgeCredentials, error)) *Store_ListGithubCredentials_Call { + _c.Call.Return(run) + return _c +} + // ListGithubEndpoints provides a mock function with given fields: ctx func (_m *Store) ListGithubEndpoints(ctx context.Context) ([]params.ForgeEndpoint, error) { ret := _m.Called(ctx) @@ -1794,6 +3798,34 @@ func (_m *Store) ListGithubEndpoints(ctx context.Context) ([]params.ForgeEndpoin return r0, r1 } +// Store_ListGithubEndpoints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListGithubEndpoints' +type Store_ListGithubEndpoints_Call struct { + *mock.Call +} + +// ListGithubEndpoints is a helper method to define mock.On call +// - ctx context.Context +func (_e *Store_Expecter) ListGithubEndpoints(ctx interface{}) *Store_ListGithubEndpoints_Call { + return &Store_ListGithubEndpoints_Call{Call: _e.mock.On("ListGithubEndpoints", ctx)} +} + +func (_c *Store_ListGithubEndpoints_Call) Run(run func(ctx context.Context)) *Store_ListGithubEndpoints_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Store_ListGithubEndpoints_Call) Return(_a0 []params.ForgeEndpoint, _a1 error) *Store_ListGithubEndpoints_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListGithubEndpoints_Call) RunAndReturn(run func(context.Context) ([]params.ForgeEndpoint, error)) *Store_ListGithubEndpoints_Call { + _c.Call.Return(run) + return _c +} + // ListJobsByStatus provides a mock function with given fields: ctx, status func (_m *Store) ListJobsByStatus(ctx context.Context, status params.JobStatus) ([]params.Job, error) { ret := _m.Called(ctx, status) @@ -1824,6 +3856,35 @@ func (_m *Store) ListJobsByStatus(ctx context.Context, status params.JobStatus) return r0, r1 } +// Store_ListJobsByStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListJobsByStatus' +type Store_ListJobsByStatus_Call struct { + *mock.Call +} + +// ListJobsByStatus is a helper method to define mock.On call +// - ctx context.Context +// - status params.JobStatus +func (_e *Store_Expecter) ListJobsByStatus(ctx interface{}, status interface{}) *Store_ListJobsByStatus_Call { + return &Store_ListJobsByStatus_Call{Call: _e.mock.On("ListJobsByStatus", ctx, status)} +} + +func (_c *Store_ListJobsByStatus_Call) Run(run func(ctx context.Context, status params.JobStatus)) *Store_ListJobsByStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.JobStatus)) + }) + return _c +} + +func (_c *Store_ListJobsByStatus_Call) Return(_a0 []params.Job, _a1 error) *Store_ListJobsByStatus_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListJobsByStatus_Call) RunAndReturn(run func(context.Context, params.JobStatus) ([]params.Job, error)) *Store_ListJobsByStatus_Call { + _c.Call.Return(run) + return _c +} + // ListOrganizations provides a mock function with given fields: ctx, filter func (_m *Store) ListOrganizations(ctx context.Context, filter params.OrganizationFilter) ([]params.Organization, error) { ret := _m.Called(ctx, filter) @@ -1854,6 +3915,35 @@ func (_m *Store) ListOrganizations(ctx context.Context, filter params.Organizati return r0, r1 } +// Store_ListOrganizations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListOrganizations' +type Store_ListOrganizations_Call struct { + *mock.Call +} + +// ListOrganizations is a helper method to define mock.On call +// - ctx context.Context +// - filter params.OrganizationFilter +func (_e *Store_Expecter) ListOrganizations(ctx interface{}, filter interface{}) *Store_ListOrganizations_Call { + return &Store_ListOrganizations_Call{Call: _e.mock.On("ListOrganizations", ctx, filter)} +} + +func (_c *Store_ListOrganizations_Call) Run(run func(ctx context.Context, filter params.OrganizationFilter)) *Store_ListOrganizations_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.OrganizationFilter)) + }) + return _c +} + +func (_c *Store_ListOrganizations_Call) Return(_a0 []params.Organization, _a1 error) *Store_ListOrganizations_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListOrganizations_Call) RunAndReturn(run func(context.Context, params.OrganizationFilter) ([]params.Organization, error)) *Store_ListOrganizations_Call { + _c.Call.Return(run) + return _c +} + // ListPoolInstances provides a mock function with given fields: ctx, poolID func (_m *Store) ListPoolInstances(ctx context.Context, poolID string) ([]params.Instance, error) { ret := _m.Called(ctx, poolID) @@ -1884,6 +3974,35 @@ func (_m *Store) ListPoolInstances(ctx context.Context, poolID string) ([]params return r0, r1 } +// Store_ListPoolInstances_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListPoolInstances' +type Store_ListPoolInstances_Call struct { + *mock.Call +} + +// ListPoolInstances is a helper method to define mock.On call +// - ctx context.Context +// - poolID string +func (_e *Store_Expecter) ListPoolInstances(ctx interface{}, poolID interface{}) *Store_ListPoolInstances_Call { + return &Store_ListPoolInstances_Call{Call: _e.mock.On("ListPoolInstances", ctx, poolID)} +} + +func (_c *Store_ListPoolInstances_Call) Run(run func(ctx context.Context, poolID string)) *Store_ListPoolInstances_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_ListPoolInstances_Call) Return(_a0 []params.Instance, _a1 error) *Store_ListPoolInstances_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListPoolInstances_Call) RunAndReturn(run func(context.Context, string) ([]params.Instance, error)) *Store_ListPoolInstances_Call { + _c.Call.Return(run) + return _c +} + // ListRepositories provides a mock function with given fields: ctx, filter func (_m *Store) ListRepositories(ctx context.Context, filter params.RepositoryFilter) ([]params.Repository, error) { ret := _m.Called(ctx, filter) @@ -1914,6 +4033,35 @@ func (_m *Store) ListRepositories(ctx context.Context, filter params.RepositoryF return r0, r1 } +// Store_ListRepositories_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRepositories' +type Store_ListRepositories_Call struct { + *mock.Call +} + +// ListRepositories is a helper method to define mock.On call +// - ctx context.Context +// - filter params.RepositoryFilter +func (_e *Store_Expecter) ListRepositories(ctx interface{}, filter interface{}) *Store_ListRepositories_Call { + return &Store_ListRepositories_Call{Call: _e.mock.On("ListRepositories", ctx, filter)} +} + +func (_c *Store_ListRepositories_Call) Run(run func(ctx context.Context, filter params.RepositoryFilter)) *Store_ListRepositories_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.RepositoryFilter)) + }) + return _c +} + +func (_c *Store_ListRepositories_Call) Return(_a0 []params.Repository, _a1 error) *Store_ListRepositories_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListRepositories_Call) RunAndReturn(run func(context.Context, params.RepositoryFilter) ([]params.Repository, error)) *Store_ListRepositories_Call { + _c.Call.Return(run) + return _c +} + // ListScaleSetInstances provides a mock function with given fields: _a0, scalesetID func (_m *Store) ListScaleSetInstances(_a0 context.Context, scalesetID uint) ([]params.Instance, error) { ret := _m.Called(_a0, scalesetID) @@ -1944,6 +4092,35 @@ func (_m *Store) ListScaleSetInstances(_a0 context.Context, scalesetID uint) ([] return r0, r1 } +// Store_ListScaleSetInstances_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListScaleSetInstances' +type Store_ListScaleSetInstances_Call struct { + *mock.Call +} + +// ListScaleSetInstances is a helper method to define mock.On call +// - _a0 context.Context +// - scalesetID uint +func (_e *Store_Expecter) ListScaleSetInstances(_a0 interface{}, scalesetID interface{}) *Store_ListScaleSetInstances_Call { + return &Store_ListScaleSetInstances_Call{Call: _e.mock.On("ListScaleSetInstances", _a0, scalesetID)} +} + +func (_c *Store_ListScaleSetInstances_Call) Run(run func(_a0 context.Context, scalesetID uint)) *Store_ListScaleSetInstances_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint)) + }) + return _c +} + +func (_c *Store_ListScaleSetInstances_Call) Return(_a0 []params.Instance, _a1 error) *Store_ListScaleSetInstances_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_ListScaleSetInstances_Call) RunAndReturn(run func(context.Context, uint) ([]params.Instance, error)) *Store_ListScaleSetInstances_Call { + _c.Call.Return(run) + return _c +} + // LockJob provides a mock function with given fields: ctx, jobID, entityID func (_m *Store) LockJob(ctx context.Context, jobID int64, entityID string) error { ret := _m.Called(ctx, jobID, entityID) @@ -1962,6 +4139,36 @@ func (_m *Store) LockJob(ctx context.Context, jobID int64, entityID string) erro return r0 } +// Store_LockJob_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LockJob' +type Store_LockJob_Call struct { + *mock.Call +} + +// LockJob is a helper method to define mock.On call +// - ctx context.Context +// - jobID int64 +// - entityID string +func (_e *Store_Expecter) LockJob(ctx interface{}, jobID interface{}, entityID interface{}) *Store_LockJob_Call { + return &Store_LockJob_Call{Call: _e.mock.On("LockJob", ctx, jobID, entityID)} +} + +func (_c *Store_LockJob_Call) Run(run func(ctx context.Context, jobID int64, entityID string)) *Store_LockJob_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64), args[2].(string)) + }) + return _c +} + +func (_c *Store_LockJob_Call) Return(_a0 error) *Store_LockJob_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_LockJob_Call) RunAndReturn(run func(context.Context, int64, string) error) *Store_LockJob_Call { + _c.Call.Return(run) + return _c +} + // PoolInstanceCount provides a mock function with given fields: ctx, poolID func (_m *Store) PoolInstanceCount(ctx context.Context, poolID string) (int64, error) { ret := _m.Called(ctx, poolID) @@ -1990,6 +4197,35 @@ func (_m *Store) PoolInstanceCount(ctx context.Context, poolID string) (int64, e return r0, r1 } +// Store_PoolInstanceCount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PoolInstanceCount' +type Store_PoolInstanceCount_Call struct { + *mock.Call +} + +// PoolInstanceCount is a helper method to define mock.On call +// - ctx context.Context +// - poolID string +func (_e *Store_Expecter) PoolInstanceCount(ctx interface{}, poolID interface{}) *Store_PoolInstanceCount_Call { + return &Store_PoolInstanceCount_Call{Call: _e.mock.On("PoolInstanceCount", ctx, poolID)} +} + +func (_c *Store_PoolInstanceCount_Call) Run(run func(ctx context.Context, poolID string)) *Store_PoolInstanceCount_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *Store_PoolInstanceCount_Call) Return(_a0 int64, _a1 error) *Store_PoolInstanceCount_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_PoolInstanceCount_Call) RunAndReturn(run func(context.Context, string) (int64, error)) *Store_PoolInstanceCount_Call { + _c.Call.Return(run) + return _c +} + // SetScaleSetDesiredRunnerCount provides a mock function with given fields: ctx, scaleSetID, desiredRunnerCount func (_m *Store) SetScaleSetDesiredRunnerCount(ctx context.Context, scaleSetID uint, desiredRunnerCount int) error { ret := _m.Called(ctx, scaleSetID, desiredRunnerCount) @@ -2008,6 +4244,36 @@ func (_m *Store) SetScaleSetDesiredRunnerCount(ctx context.Context, scaleSetID u return r0 } +// Store_SetScaleSetDesiredRunnerCount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetScaleSetDesiredRunnerCount' +type Store_SetScaleSetDesiredRunnerCount_Call struct { + *mock.Call +} + +// SetScaleSetDesiredRunnerCount is a helper method to define mock.On call +// - ctx context.Context +// - scaleSetID uint +// - desiredRunnerCount int +func (_e *Store_Expecter) SetScaleSetDesiredRunnerCount(ctx interface{}, scaleSetID interface{}, desiredRunnerCount interface{}) *Store_SetScaleSetDesiredRunnerCount_Call { + return &Store_SetScaleSetDesiredRunnerCount_Call{Call: _e.mock.On("SetScaleSetDesiredRunnerCount", ctx, scaleSetID, desiredRunnerCount)} +} + +func (_c *Store_SetScaleSetDesiredRunnerCount_Call) Run(run func(ctx context.Context, scaleSetID uint, desiredRunnerCount int)) *Store_SetScaleSetDesiredRunnerCount_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint), args[2].(int)) + }) + return _c +} + +func (_c *Store_SetScaleSetDesiredRunnerCount_Call) Return(_a0 error) *Store_SetScaleSetDesiredRunnerCount_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_SetScaleSetDesiredRunnerCount_Call) RunAndReturn(run func(context.Context, uint, int) error) *Store_SetScaleSetDesiredRunnerCount_Call { + _c.Call.Return(run) + return _c +} + // SetScaleSetLastMessageID provides a mock function with given fields: ctx, scaleSetID, lastMessageID func (_m *Store) SetScaleSetLastMessageID(ctx context.Context, scaleSetID uint, lastMessageID int64) error { ret := _m.Called(ctx, scaleSetID, lastMessageID) @@ -2026,6 +4292,36 @@ func (_m *Store) SetScaleSetLastMessageID(ctx context.Context, scaleSetID uint, return r0 } +// Store_SetScaleSetLastMessageID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetScaleSetLastMessageID' +type Store_SetScaleSetLastMessageID_Call struct { + *mock.Call +} + +// SetScaleSetLastMessageID is a helper method to define mock.On call +// - ctx context.Context +// - scaleSetID uint +// - lastMessageID int64 +func (_e *Store_Expecter) SetScaleSetLastMessageID(ctx interface{}, scaleSetID interface{}, lastMessageID interface{}) *Store_SetScaleSetLastMessageID_Call { + return &Store_SetScaleSetLastMessageID_Call{Call: _e.mock.On("SetScaleSetLastMessageID", ctx, scaleSetID, lastMessageID)} +} + +func (_c *Store_SetScaleSetLastMessageID_Call) Run(run func(ctx context.Context, scaleSetID uint, lastMessageID int64)) *Store_SetScaleSetLastMessageID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint), args[2].(int64)) + }) + return _c +} + +func (_c *Store_SetScaleSetLastMessageID_Call) Return(_a0 error) *Store_SetScaleSetLastMessageID_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_SetScaleSetLastMessageID_Call) RunAndReturn(run func(context.Context, uint, int64) error) *Store_SetScaleSetLastMessageID_Call { + _c.Call.Return(run) + return _c +} + // UnlockJob provides a mock function with given fields: ctx, jobID, entityID func (_m *Store) UnlockJob(ctx context.Context, jobID int64, entityID string) error { ret := _m.Called(ctx, jobID, entityID) @@ -2044,6 +4340,36 @@ func (_m *Store) UnlockJob(ctx context.Context, jobID int64, entityID string) er return r0 } +// Store_UnlockJob_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnlockJob' +type Store_UnlockJob_Call struct { + *mock.Call +} + +// UnlockJob is a helper method to define mock.On call +// - ctx context.Context +// - jobID int64 +// - entityID string +func (_e *Store_Expecter) UnlockJob(ctx interface{}, jobID interface{}, entityID interface{}) *Store_UnlockJob_Call { + return &Store_UnlockJob_Call{Call: _e.mock.On("UnlockJob", ctx, jobID, entityID)} +} + +func (_c *Store_UnlockJob_Call) Run(run func(ctx context.Context, jobID int64, entityID string)) *Store_UnlockJob_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64), args[2].(string)) + }) + return _c +} + +func (_c *Store_UnlockJob_Call) Return(_a0 error) *Store_UnlockJob_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Store_UnlockJob_Call) RunAndReturn(run func(context.Context, int64, string) error) *Store_UnlockJob_Call { + _c.Call.Return(run) + return _c +} + // UpdateController provides a mock function with given fields: info func (_m *Store) UpdateController(info params.UpdateControllerParams) (params.ControllerInfo, error) { ret := _m.Called(info) @@ -2072,6 +4398,34 @@ func (_m *Store) UpdateController(info params.UpdateControllerParams) (params.Co return r0, r1 } +// Store_UpdateController_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateController' +type Store_UpdateController_Call struct { + *mock.Call +} + +// UpdateController is a helper method to define mock.On call +// - info params.UpdateControllerParams +func (_e *Store_Expecter) UpdateController(info interface{}) *Store_UpdateController_Call { + return &Store_UpdateController_Call{Call: _e.mock.On("UpdateController", info)} +} + +func (_c *Store_UpdateController_Call) Run(run func(info params.UpdateControllerParams)) *Store_UpdateController_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(params.UpdateControllerParams)) + }) + return _c +} + +func (_c *Store_UpdateController_Call) Return(_a0 params.ControllerInfo, _a1 error) *Store_UpdateController_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_UpdateController_Call) RunAndReturn(run func(params.UpdateControllerParams) (params.ControllerInfo, error)) *Store_UpdateController_Call { + _c.Call.Return(run) + return _c +} + // UpdateEnterprise provides a mock function with given fields: ctx, enterpriseID, param func (_m *Store) UpdateEnterprise(ctx context.Context, enterpriseID string, param params.UpdateEntityParams) (params.Enterprise, error) { ret := _m.Called(ctx, enterpriseID, param) @@ -2100,6 +4454,36 @@ func (_m *Store) UpdateEnterprise(ctx context.Context, enterpriseID string, para return r0, r1 } +// Store_UpdateEnterprise_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateEnterprise' +type Store_UpdateEnterprise_Call struct { + *mock.Call +} + +// UpdateEnterprise is a helper method to define mock.On call +// - ctx context.Context +// - enterpriseID string +// - param params.UpdateEntityParams +func (_e *Store_Expecter) UpdateEnterprise(ctx interface{}, enterpriseID interface{}, param interface{}) *Store_UpdateEnterprise_Call { + return &Store_UpdateEnterprise_Call{Call: _e.mock.On("UpdateEnterprise", ctx, enterpriseID, param)} +} + +func (_c *Store_UpdateEnterprise_Call) Run(run func(ctx context.Context, enterpriseID string, param params.UpdateEntityParams)) *Store_UpdateEnterprise_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(params.UpdateEntityParams)) + }) + return _c +} + +func (_c *Store_UpdateEnterprise_Call) Return(_a0 params.Enterprise, _a1 error) *Store_UpdateEnterprise_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_UpdateEnterprise_Call) RunAndReturn(run func(context.Context, string, params.UpdateEntityParams) (params.Enterprise, error)) *Store_UpdateEnterprise_Call { + _c.Call.Return(run) + return _c +} + // UpdateEntityPool provides a mock function with given fields: ctx, entity, poolID, param func (_m *Store) UpdateEntityPool(ctx context.Context, entity params.ForgeEntity, poolID string, param params.UpdatePoolParams) (params.Pool, error) { ret := _m.Called(ctx, entity, poolID, param) @@ -2128,6 +4512,37 @@ func (_m *Store) UpdateEntityPool(ctx context.Context, entity params.ForgeEntity return r0, r1 } +// Store_UpdateEntityPool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateEntityPool' +type Store_UpdateEntityPool_Call struct { + *mock.Call +} + +// UpdateEntityPool is a helper method to define mock.On call +// - ctx context.Context +// - entity params.ForgeEntity +// - poolID string +// - param params.UpdatePoolParams +func (_e *Store_Expecter) UpdateEntityPool(ctx interface{}, entity interface{}, poolID interface{}, param interface{}) *Store_UpdateEntityPool_Call { + return &Store_UpdateEntityPool_Call{Call: _e.mock.On("UpdateEntityPool", ctx, entity, poolID, param)} +} + +func (_c *Store_UpdateEntityPool_Call) Run(run func(ctx context.Context, entity params.ForgeEntity, poolID string, param params.UpdatePoolParams)) *Store_UpdateEntityPool_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.ForgeEntity), args[2].(string), args[3].(params.UpdatePoolParams)) + }) + return _c +} + +func (_c *Store_UpdateEntityPool_Call) Return(_a0 params.Pool, _a1 error) *Store_UpdateEntityPool_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_UpdateEntityPool_Call) RunAndReturn(run func(context.Context, params.ForgeEntity, string, params.UpdatePoolParams) (params.Pool, error)) *Store_UpdateEntityPool_Call { + _c.Call.Return(run) + return _c +} + // UpdateEntityScaleSet provides a mock function with given fields: _a0, entity, scaleSetID, param, callback func (_m *Store) UpdateEntityScaleSet(_a0 context.Context, entity params.ForgeEntity, scaleSetID uint, param params.UpdateScaleSetParams, callback func(params.ScaleSet, params.ScaleSet) error) (params.ScaleSet, error) { ret := _m.Called(_a0, entity, scaleSetID, param, callback) @@ -2156,6 +4571,38 @@ func (_m *Store) UpdateEntityScaleSet(_a0 context.Context, entity params.ForgeEn return r0, r1 } +// Store_UpdateEntityScaleSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateEntityScaleSet' +type Store_UpdateEntityScaleSet_Call struct { + *mock.Call +} + +// UpdateEntityScaleSet is a helper method to define mock.On call +// - _a0 context.Context +// - entity params.ForgeEntity +// - scaleSetID uint +// - param params.UpdateScaleSetParams +// - callback func(params.ScaleSet , params.ScaleSet) error +func (_e *Store_Expecter) UpdateEntityScaleSet(_a0 interface{}, entity interface{}, scaleSetID interface{}, param interface{}, callback interface{}) *Store_UpdateEntityScaleSet_Call { + return &Store_UpdateEntityScaleSet_Call{Call: _e.mock.On("UpdateEntityScaleSet", _a0, entity, scaleSetID, param, callback)} +} + +func (_c *Store_UpdateEntityScaleSet_Call) Run(run func(_a0 context.Context, entity params.ForgeEntity, scaleSetID uint, param params.UpdateScaleSetParams, callback func(params.ScaleSet, params.ScaleSet) error)) *Store_UpdateEntityScaleSet_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.ForgeEntity), args[2].(uint), args[3].(params.UpdateScaleSetParams), args[4].(func(params.ScaleSet, params.ScaleSet) error)) + }) + return _c +} + +func (_c *Store_UpdateEntityScaleSet_Call) Return(updatedScaleSet params.ScaleSet, err error) *Store_UpdateEntityScaleSet_Call { + _c.Call.Return(updatedScaleSet, err) + return _c +} + +func (_c *Store_UpdateEntityScaleSet_Call) RunAndReturn(run func(context.Context, params.ForgeEntity, uint, params.UpdateScaleSetParams, func(params.ScaleSet, params.ScaleSet) error) (params.ScaleSet, error)) *Store_UpdateEntityScaleSet_Call { + _c.Call.Return(run) + return _c +} + // UpdateGiteaCredentials provides a mock function with given fields: ctx, id, param func (_m *Store) UpdateGiteaCredentials(ctx context.Context, id uint, param params.UpdateGiteaCredentialsParams) (params.ForgeCredentials, error) { ret := _m.Called(ctx, id, param) @@ -2184,6 +4631,36 @@ func (_m *Store) UpdateGiteaCredentials(ctx context.Context, id uint, param para return r0, r1 } +// Store_UpdateGiteaCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGiteaCredentials' +type Store_UpdateGiteaCredentials_Call struct { + *mock.Call +} + +// UpdateGiteaCredentials is a helper method to define mock.On call +// - ctx context.Context +// - id uint +// - param params.UpdateGiteaCredentialsParams +func (_e *Store_Expecter) UpdateGiteaCredentials(ctx interface{}, id interface{}, param interface{}) *Store_UpdateGiteaCredentials_Call { + return &Store_UpdateGiteaCredentials_Call{Call: _e.mock.On("UpdateGiteaCredentials", ctx, id, param)} +} + +func (_c *Store_UpdateGiteaCredentials_Call) Run(run func(ctx context.Context, id uint, param params.UpdateGiteaCredentialsParams)) *Store_UpdateGiteaCredentials_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint), args[2].(params.UpdateGiteaCredentialsParams)) + }) + return _c +} + +func (_c *Store_UpdateGiteaCredentials_Call) Return(gtCreds params.ForgeCredentials, err error) *Store_UpdateGiteaCredentials_Call { + _c.Call.Return(gtCreds, err) + return _c +} + +func (_c *Store_UpdateGiteaCredentials_Call) RunAndReturn(run func(context.Context, uint, params.UpdateGiteaCredentialsParams) (params.ForgeCredentials, error)) *Store_UpdateGiteaCredentials_Call { + _c.Call.Return(run) + return _c +} + // UpdateGiteaEndpoint provides a mock function with given fields: _a0, name, param func (_m *Store) UpdateGiteaEndpoint(_a0 context.Context, name string, param params.UpdateGiteaEndpointParams) (params.ForgeEndpoint, error) { ret := _m.Called(_a0, name, param) @@ -2212,6 +4689,36 @@ func (_m *Store) UpdateGiteaEndpoint(_a0 context.Context, name string, param par return r0, r1 } +// Store_UpdateGiteaEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGiteaEndpoint' +type Store_UpdateGiteaEndpoint_Call struct { + *mock.Call +} + +// UpdateGiteaEndpoint is a helper method to define mock.On call +// - _a0 context.Context +// - name string +// - param params.UpdateGiteaEndpointParams +func (_e *Store_Expecter) UpdateGiteaEndpoint(_a0 interface{}, name interface{}, param interface{}) *Store_UpdateGiteaEndpoint_Call { + return &Store_UpdateGiteaEndpoint_Call{Call: _e.mock.On("UpdateGiteaEndpoint", _a0, name, param)} +} + +func (_c *Store_UpdateGiteaEndpoint_Call) Run(run func(_a0 context.Context, name string, param params.UpdateGiteaEndpointParams)) *Store_UpdateGiteaEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(params.UpdateGiteaEndpointParams)) + }) + return _c +} + +func (_c *Store_UpdateGiteaEndpoint_Call) Return(ghEndpoint params.ForgeEndpoint, err error) *Store_UpdateGiteaEndpoint_Call { + _c.Call.Return(ghEndpoint, err) + return _c +} + +func (_c *Store_UpdateGiteaEndpoint_Call) RunAndReturn(run func(context.Context, string, params.UpdateGiteaEndpointParams) (params.ForgeEndpoint, error)) *Store_UpdateGiteaEndpoint_Call { + _c.Call.Return(run) + return _c +} + // UpdateGithubCredentials provides a mock function with given fields: ctx, id, param func (_m *Store) UpdateGithubCredentials(ctx context.Context, id uint, param params.UpdateGithubCredentialsParams) (params.ForgeCredentials, error) { ret := _m.Called(ctx, id, param) @@ -2240,6 +4747,36 @@ func (_m *Store) UpdateGithubCredentials(ctx context.Context, id uint, param par return r0, r1 } +// Store_UpdateGithubCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGithubCredentials' +type Store_UpdateGithubCredentials_Call struct { + *mock.Call +} + +// UpdateGithubCredentials is a helper method to define mock.On call +// - ctx context.Context +// - id uint +// - param params.UpdateGithubCredentialsParams +func (_e *Store_Expecter) UpdateGithubCredentials(ctx interface{}, id interface{}, param interface{}) *Store_UpdateGithubCredentials_Call { + return &Store_UpdateGithubCredentials_Call{Call: _e.mock.On("UpdateGithubCredentials", ctx, id, param)} +} + +func (_c *Store_UpdateGithubCredentials_Call) Run(run func(ctx context.Context, id uint, param params.UpdateGithubCredentialsParams)) *Store_UpdateGithubCredentials_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint), args[2].(params.UpdateGithubCredentialsParams)) + }) + return _c +} + +func (_c *Store_UpdateGithubCredentials_Call) Return(_a0 params.ForgeCredentials, _a1 error) *Store_UpdateGithubCredentials_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_UpdateGithubCredentials_Call) RunAndReturn(run func(context.Context, uint, params.UpdateGithubCredentialsParams) (params.ForgeCredentials, error)) *Store_UpdateGithubCredentials_Call { + _c.Call.Return(run) + return _c +} + // UpdateGithubEndpoint provides a mock function with given fields: ctx, name, param func (_m *Store) UpdateGithubEndpoint(ctx context.Context, name string, param params.UpdateGithubEndpointParams) (params.ForgeEndpoint, error) { ret := _m.Called(ctx, name, param) @@ -2268,6 +4805,36 @@ func (_m *Store) UpdateGithubEndpoint(ctx context.Context, name string, param pa return r0, r1 } +// Store_UpdateGithubEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGithubEndpoint' +type Store_UpdateGithubEndpoint_Call struct { + *mock.Call +} + +// UpdateGithubEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - param params.UpdateGithubEndpointParams +func (_e *Store_Expecter) UpdateGithubEndpoint(ctx interface{}, name interface{}, param interface{}) *Store_UpdateGithubEndpoint_Call { + return &Store_UpdateGithubEndpoint_Call{Call: _e.mock.On("UpdateGithubEndpoint", ctx, name, param)} +} + +func (_c *Store_UpdateGithubEndpoint_Call) Run(run func(ctx context.Context, name string, param params.UpdateGithubEndpointParams)) *Store_UpdateGithubEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(params.UpdateGithubEndpointParams)) + }) + return _c +} + +func (_c *Store_UpdateGithubEndpoint_Call) Return(_a0 params.ForgeEndpoint, _a1 error) *Store_UpdateGithubEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_UpdateGithubEndpoint_Call) RunAndReturn(run func(context.Context, string, params.UpdateGithubEndpointParams) (params.ForgeEndpoint, error)) *Store_UpdateGithubEndpoint_Call { + _c.Call.Return(run) + return _c +} + // UpdateInstance provides a mock function with given fields: ctx, instanceName, param func (_m *Store) UpdateInstance(ctx context.Context, instanceName string, param params.UpdateInstanceParams) (params.Instance, error) { ret := _m.Called(ctx, instanceName, param) @@ -2296,6 +4863,36 @@ func (_m *Store) UpdateInstance(ctx context.Context, instanceName string, param return r0, r1 } +// Store_UpdateInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateInstance' +type Store_UpdateInstance_Call struct { + *mock.Call +} + +// UpdateInstance is a helper method to define mock.On call +// - ctx context.Context +// - instanceName string +// - param params.UpdateInstanceParams +func (_e *Store_Expecter) UpdateInstance(ctx interface{}, instanceName interface{}, param interface{}) *Store_UpdateInstance_Call { + return &Store_UpdateInstance_Call{Call: _e.mock.On("UpdateInstance", ctx, instanceName, param)} +} + +func (_c *Store_UpdateInstance_Call) Run(run func(ctx context.Context, instanceName string, param params.UpdateInstanceParams)) *Store_UpdateInstance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(params.UpdateInstanceParams)) + }) + return _c +} + +func (_c *Store_UpdateInstance_Call) Return(_a0 params.Instance, _a1 error) *Store_UpdateInstance_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_UpdateInstance_Call) RunAndReturn(run func(context.Context, string, params.UpdateInstanceParams) (params.Instance, error)) *Store_UpdateInstance_Call { + _c.Call.Return(run) + return _c +} + // UpdateOrganization provides a mock function with given fields: ctx, orgID, param func (_m *Store) UpdateOrganization(ctx context.Context, orgID string, param params.UpdateEntityParams) (params.Organization, error) { ret := _m.Called(ctx, orgID, param) @@ -2324,6 +4921,36 @@ func (_m *Store) UpdateOrganization(ctx context.Context, orgID string, param par return r0, r1 } +// Store_UpdateOrganization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateOrganization' +type Store_UpdateOrganization_Call struct { + *mock.Call +} + +// UpdateOrganization is a helper method to define mock.On call +// - ctx context.Context +// - orgID string +// - param params.UpdateEntityParams +func (_e *Store_Expecter) UpdateOrganization(ctx interface{}, orgID interface{}, param interface{}) *Store_UpdateOrganization_Call { + return &Store_UpdateOrganization_Call{Call: _e.mock.On("UpdateOrganization", ctx, orgID, param)} +} + +func (_c *Store_UpdateOrganization_Call) Run(run func(ctx context.Context, orgID string, param params.UpdateEntityParams)) *Store_UpdateOrganization_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(params.UpdateEntityParams)) + }) + return _c +} + +func (_c *Store_UpdateOrganization_Call) Return(_a0 params.Organization, _a1 error) *Store_UpdateOrganization_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_UpdateOrganization_Call) RunAndReturn(run func(context.Context, string, params.UpdateEntityParams) (params.Organization, error)) *Store_UpdateOrganization_Call { + _c.Call.Return(run) + return _c +} + // UpdateRepository provides a mock function with given fields: ctx, repoID, param func (_m *Store) UpdateRepository(ctx context.Context, repoID string, param params.UpdateEntityParams) (params.Repository, error) { ret := _m.Called(ctx, repoID, param) @@ -2352,6 +4979,36 @@ func (_m *Store) UpdateRepository(ctx context.Context, repoID string, param para return r0, r1 } +// Store_UpdateRepository_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRepository' +type Store_UpdateRepository_Call struct { + *mock.Call +} + +// UpdateRepository is a helper method to define mock.On call +// - ctx context.Context +// - repoID string +// - param params.UpdateEntityParams +func (_e *Store_Expecter) UpdateRepository(ctx interface{}, repoID interface{}, param interface{}) *Store_UpdateRepository_Call { + return &Store_UpdateRepository_Call{Call: _e.mock.On("UpdateRepository", ctx, repoID, param)} +} + +func (_c *Store_UpdateRepository_Call) Run(run func(ctx context.Context, repoID string, param params.UpdateEntityParams)) *Store_UpdateRepository_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(params.UpdateEntityParams)) + }) + return _c +} + +func (_c *Store_UpdateRepository_Call) Return(_a0 params.Repository, _a1 error) *Store_UpdateRepository_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_UpdateRepository_Call) RunAndReturn(run func(context.Context, string, params.UpdateEntityParams) (params.Repository, error)) *Store_UpdateRepository_Call { + _c.Call.Return(run) + return _c +} + // UpdateUser provides a mock function with given fields: ctx, user, param func (_m *Store) UpdateUser(ctx context.Context, user string, param params.UpdateUserParams) (params.User, error) { ret := _m.Called(ctx, user, param) @@ -2380,6 +5037,36 @@ func (_m *Store) UpdateUser(ctx context.Context, user string, param params.Updat return r0, r1 } +// Store_UpdateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUser' +type Store_UpdateUser_Call struct { + *mock.Call +} + +// UpdateUser is a helper method to define mock.On call +// - ctx context.Context +// - user string +// - param params.UpdateUserParams +func (_e *Store_Expecter) UpdateUser(ctx interface{}, user interface{}, param interface{}) *Store_UpdateUser_Call { + return &Store_UpdateUser_Call{Call: _e.mock.On("UpdateUser", ctx, user, param)} +} + +func (_c *Store_UpdateUser_Call) Run(run func(ctx context.Context, user string, param params.UpdateUserParams)) *Store_UpdateUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(params.UpdateUserParams)) + }) + return _c +} + +func (_c *Store_UpdateUser_Call) Return(_a0 params.User, _a1 error) *Store_UpdateUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Store_UpdateUser_Call) RunAndReturn(run func(context.Context, string, params.UpdateUserParams) (params.User, error)) *Store_UpdateUser_Call { + _c.Call.Return(run) + return _c +} + // NewStore creates a new instance of Store. 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 NewStore(t interface { diff --git a/database/common/store.go b/database/common/store.go index 8b3c4f7c..d768f159 100644 --- a/database/common/store.go +++ b/database/common/store.go @@ -169,7 +169,7 @@ type GiteaCredentialsStore interface { DeleteGiteaCredentials(ctx context.Context, id uint) (err error) } -//go:generate mockery --name=Store +//go:generate go run github.com/vektra/mockery/v2@latest type Store interface { RepoStore OrgStore diff --git a/database/sql/pools.go b/database/sql/pools.go index 350e1dc2..889cbc58 100644 --- a/database/sql/pools.go +++ b/database/sql/pools.go @@ -37,7 +37,7 @@ const ( func (s *sqlDatabase) ListAllPools(_ context.Context) ([]params.Pool, error) { var pools []Pool - q := s.conn.Model(&Pool{}). + q := s.conn. Preload("Tags"). Preload("Organization"). Preload("Organization.Endpoint"). @@ -46,7 +46,6 @@ func (s *sqlDatabase) ListAllPools(_ context.Context) ([]params.Pool, error) { Preload("Enterprise"). Preload("Enterprise.Endpoint"). Omit("extra_specs"). - Omit("status_messages"). Find(&pools) if q.Error != nil { return nil, errors.Wrap(q.Error, "fetching all pools") @@ -393,7 +392,7 @@ func (s *sqlDatabase) DeleteEntityPool(_ context.Context, entity params.ForgeEnt return nil } -func (s *sqlDatabase) UpdateEntityPool(_ context.Context, entity params.ForgeEntity, poolID string, param params.UpdatePoolParams) (updatedPool params.Pool, err error) { +func (s *sqlDatabase) UpdateEntityPool(ctx context.Context, entity params.ForgeEntity, poolID string, param params.UpdatePoolParams) (updatedPool params.Pool, err error) { defer func() { if err == nil { s.sendNotify(common.PoolEntityType, common.UpdateOperation, updatedPool) @@ -414,6 +413,11 @@ func (s *sqlDatabase) UpdateEntityPool(_ context.Context, entity params.ForgeEnt if err != nil { return params.Pool{}, err } + + updatedPool, err = s.GetPoolByID(ctx, poolID) + if err != nil { + return params.Pool{}, err + } return updatedPool, nil } diff --git a/database/sql/scalesets.go b/database/sql/scalesets.go index 752c7948..4748ed66 100644 --- a/database/sql/scalesets.go +++ b/database/sql/scalesets.go @@ -193,7 +193,7 @@ func (s *sqlDatabase) ListEntityScaleSets(_ context.Context, entity params.Forge return ret, nil } -func (s *sqlDatabase) UpdateEntityScaleSet(_ context.Context, entity params.ForgeEntity, scaleSetID uint, param params.UpdateScaleSetParams, callback func(old, newSet params.ScaleSet) error) (updatedScaleSet params.ScaleSet, err error) { +func (s *sqlDatabase) UpdateEntityScaleSet(ctx context.Context, entity params.ForgeEntity, scaleSetID uint, param params.UpdateScaleSetParams, callback func(old, newSet params.ScaleSet) error) (updatedScaleSet params.ScaleSet, err error) { defer func() { if err == nil { s.sendNotify(common.ScaleSetEntityType, common.UpdateOperation, updatedScaleSet) @@ -225,6 +225,11 @@ func (s *sqlDatabase) UpdateEntityScaleSet(_ context.Context, entity params.Forg if err != nil { return params.ScaleSet{}, err } + + updatedScaleSet, err = s.GetScaleSetByID(ctx, scaleSetID) + if err != nil { + return params.ScaleSet{}, err + } return updatedScaleSet, nil } @@ -345,7 +350,17 @@ func (s *sqlDatabase) updateScaleSet(tx *gorm.DB, scaleSet ScaleSet, param param } func (s *sqlDatabase) GetScaleSetByID(_ context.Context, scaleSet uint) (params.ScaleSet, error) { - set, err := s.getScaleSetByID(s.conn, scaleSet, "Instances", "Enterprise", "Organization", "Repository") + set, err := s.getScaleSetByID( + s.conn, + scaleSet, + "Instances", + "Enterprise", + "Enterprise.Endpoint", + "Organization", + "Organization.Endpoint", + "Repository", + "Repository.Endpoint", + ) if err != nil { return params.ScaleSet{}, errors.Wrap(err, "fetching scale set by ID") } diff --git a/database/watcher/watcher_store_test.go b/database/watcher/watcher_store_test.go index e682270a..a71ed1cf 100644 --- a/database/watcher/watcher_store_test.go +++ b/database/watcher/watcher_store_test.go @@ -600,6 +600,11 @@ func (s *WatcherStoreTestSuite) TestScaleSetWatcher() { // We updated last message ID and desired runner count above. updatedScaleSet.DesiredRunnerCount = 5 updatedScaleSet.LastMessageID = 99 + payloadFromEvent, ok := event.Payload.(params.ScaleSet) + s.Require().True(ok) + updatedScaleSet.UpdatedAt = payloadFromEvent.UpdatedAt + updatedScaleSet.CreatedAt = payloadFromEvent.CreatedAt + updatedScaleSet.Endpoint = params.ForgeEndpoint{} s.Require().Equal(common.ChangePayload{ EntityType: common.ScaleSetEntityType, Operation: common.DeleteOperation, diff --git a/doc/building_from_source.md b/doc/building_from_source.md index 9058820e..e5d2d0fd 100644 --- a/doc/building_from_source.md +++ b/doc/building_from_source.md @@ -6,12 +6,13 @@ First, clone the repository: ```bash git clone https://github.com/cloudbase/garm +cd garm ``` Then build garm: ```bash -make +make build ``` You should now have both `garm` and `garm-cli` available in the `./bin` folder. @@ -22,4 +23,65 @@ If you have docker/podman installed, you can also build a static binary against make build-static ``` -This command will also build for both AMD64 and ARM64. Resulting binaries will be in the `./bin` folder. \ No newline at end of file +This command will also build for both AMD64 and ARM64. Resulting binaries will be in the `./bin` folder. + +## Hacking + +If you're hacking on GARM and want to override the default version GARM injects, you can run the following command: + +```bash +VERSION=v1.0.0 make build +``` + +> [!IMPORTANT] +> This only works for `make build`. The `make build-static` command does not support version overrides. + +## The Web UI SPA + +GARM now ships with a single page application. The application is written in svelte and tailwind CSS. To rebuild it or hack on it, you will need a number of dependencies installed and placed in your `$PATH`. + +### Prerequisites + +- **Node.js 24+** and **npm** +- **Go 1.21+** (for building the GARM backend) +- **openapi-generator-cli** in your PATH (for API client generation) + +### Installing openapi-generator-cli + +**Option 1: NPM Global Install** +```bash +npm install -g @openapitools/openapi-generator-cli +``` + +**Option 2: Manual Install** +Download from [OpenAPI Generator releases](https://github.com/OpenAPITools/openapi-generator/releases) and add to your PATH. + +**Verify Installation:** + +```bash +openapi-generator-cli version +``` + + + +### Hacking on the Web UI + +If you need to change something in the `webapp/src` folder, make sure to rebuild the webapp before rebuilding GARM: + +```bash +make build-webui +make build +``` + +> [!IMPORTANT] +> The Web UI that GARM ships with has `go generate` stanzas that require `@openapitools/openapi-generator-cli` and `tailwindcss` to be installed. You will also have to make sure that if you change API models, the Web UI still works, as adding new fields or changing the json tags of old fields will change accessors in the client code. + +### Changing API models + +If you need to change the models in the `params/` package, you will also need to regenerate the client both for garm-cli and for the web application we ship with GARM. To do this, you can run: + +```bash +make generate +``` + +You will also need to make sure that the web app still works. diff --git a/doc/config.md b/doc/config.md index 8b4d3a05..3c67e1b4 100644 --- a/doc/config.md +++ b/doc/config.md @@ -473,6 +473,8 @@ The config options are fairly straight forward. certificate = "" # The path on disk to the corresponding private key for the certificate. key = "" + [apiserver.webui] + enable = true ``` The GARM API server has the option to enable TLS, but I suggest you use a reverse proxy and enable TLS termination in that reverse proxy. There is an `nginx` sample in this repository with TLS termination enabled. diff --git a/doc/quickstart.md b/doc/quickstart.md index 66afead3..889f799b 100644 --- a/doc/quickstart.md +++ b/doc/quickstart.md @@ -61,6 +61,9 @@ time_to_live = "8760h" bind = "0.0.0.0" port = 80 use_tls = false + [apiserver.webui] + # Set this to false if you want to disable the Web UI. + enable = true [database] backend = "sqlite3" diff --git a/go.mod b/go.mod index 36e42be2..da91a90d 100644 --- a/go.mod +++ b/go.mod @@ -50,7 +50,7 @@ require ( github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/analysis v0.23.0 // indirect - github.com/go-openapi/jsonpointer v0.21.1 // indirect + github.com/go-openapi/jsonpointer v0.21.2 // indirect github.com/go-openapi/jsonreference v0.21.0 // indirect github.com/go-openapi/loads v0.22.0 // indirect github.com/go-openapi/spec v0.21.0 // indirect @@ -68,7 +68,7 @@ require ( github.com/mailru/easyjson v0.9.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect - github.com/mattn/go-sqlite3 v1.14.28 // indirect + github.com/mattn/go-sqlite3 v1.14.31 // indirect github.com/minio/sio v0.4.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect @@ -79,7 +79,7 @@ require ( github.com/prometheus/common v0.65.0 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/rivo/uniseg v0.4.7 // indirect - github.com/spf13/pflag v1.0.6 // indirect + github.com/spf13/pflag v1.0.7 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569 // indirect go.mongodb.org/mongo-driver v1.17.4 // indirect diff --git a/go.sum b/go.sum index 1eaeff3e..2008dff3 100644 --- a/go.sum +++ b/go.sum @@ -36,8 +36,8 @@ github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC0 github.com/go-openapi/analysis v0.23.0/go.mod h1:9mz9ZWaSlV8TvjQHLl2mUW2PbZtemkE8yA5v22ohupo= github.com/go-openapi/errors v0.22.2 h1:rdxhzcBUazEcGccKqbY1Y7NS8FDcMyIRr0934jrYnZg= github.com/go-openapi/errors v0.22.2/go.mod h1:+n/5UdIqdVnLIJ6Q9Se8HNGUXYaY6CN8ImWzfi/Gzp0= -github.com/go-openapi/jsonpointer v0.21.1 h1:whnzv/pNXtK2FbX/W9yJfRmE2gsmkfahjMKB0fZvcic= -github.com/go-openapi/jsonpointer v0.21.1/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk= +github.com/go-openapi/jsonpointer v0.21.2 h1:AqQaNADVwq/VnkCmQg6ogE+M3FOsKTytwges0JdwVuA= +github.com/go-openapi/jsonpointer v0.21.2/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk= github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= github.com/go-openapi/loads v0.22.0 h1:ECPGd4jX1U6NApCGG1We+uEozOAvXvJSF4nnwHZ8Aco= @@ -127,8 +127,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A= -github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-sqlite3 v1.14.31 h1:ldt6ghyPJsokUIlksH63gWZkG6qVGeEAu4zLeS4aVZM= +github.com/mattn/go-sqlite3 v1.14.31/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/microsoft/go-mssqldb v1.7.2 h1:CHkFJiObW7ItKTJfHo1QX7QBBD1iV+mn1eOyRP3b/PA= github.com/microsoft/go-mssqldb v1.7.2/go.mod h1:kOvZKUdrhhFQmxLZqbwUV0rHkNkZpthMITIb2Ko1IoA= github.com/minio/sio v0.4.1 h1:EMe3YBC1nf+sRQia65Rutxi+Z554XPV0dt8BIBA+a/0= @@ -164,8 +164,9 @@ github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWN github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= -github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M= +github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= diff --git a/runner/common/mocks/GithubClient.go b/runner/common/mocks/GithubClient.go index f44d54cb..92d4aa06 100644 --- a/runner/common/mocks/GithubClient.go +++ b/runner/common/mocks/GithubClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery. DO NOT EDIT. package mocks @@ -18,6 +18,14 @@ type GithubClient struct { mock.Mock } +type GithubClient_Expecter struct { + mock *mock.Mock +} + +func (_m *GithubClient) EXPECT() *GithubClient_Expecter { + return &GithubClient_Expecter{mock: &_m.Mock} +} + // CreateEntityHook provides a mock function with given fields: ctx, hook func (_m *GithubClient) CreateEntityHook(ctx context.Context, hook *github.Hook) (*github.Hook, error) { ret := _m.Called(ctx, hook) @@ -48,6 +56,35 @@ func (_m *GithubClient) CreateEntityHook(ctx context.Context, hook *github.Hook) return r0, r1 } +// GithubClient_CreateEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEntityHook' +type GithubClient_CreateEntityHook_Call struct { + *mock.Call +} + +// CreateEntityHook is a helper method to define mock.On call +// - ctx context.Context +// - hook *github.Hook +func (_e *GithubClient_Expecter) CreateEntityHook(ctx interface{}, hook interface{}) *GithubClient_CreateEntityHook_Call { + return &GithubClient_CreateEntityHook_Call{Call: _e.mock.On("CreateEntityHook", ctx, hook)} +} + +func (_c *GithubClient_CreateEntityHook_Call) Run(run func(ctx context.Context, hook *github.Hook)) *GithubClient_CreateEntityHook_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*github.Hook)) + }) + return _c +} + +func (_c *GithubClient_CreateEntityHook_Call) Return(ret *github.Hook, err error) *GithubClient_CreateEntityHook_Call { + _c.Call.Return(ret, err) + return _c +} + +func (_c *GithubClient_CreateEntityHook_Call) RunAndReturn(run func(context.Context, *github.Hook) (*github.Hook, error)) *GithubClient_CreateEntityHook_Call { + _c.Call.Return(run) + return _c +} + // CreateEntityRegistrationToken provides a mock function with given fields: ctx func (_m *GithubClient) CreateEntityRegistrationToken(ctx context.Context) (*github.RegistrationToken, *github.Response, error) { ret := _m.Called(ctx) @@ -87,6 +124,34 @@ func (_m *GithubClient) CreateEntityRegistrationToken(ctx context.Context) (*git return r0, r1, r2 } +// GithubClient_CreateEntityRegistrationToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEntityRegistrationToken' +type GithubClient_CreateEntityRegistrationToken_Call struct { + *mock.Call +} + +// CreateEntityRegistrationToken is a helper method to define mock.On call +// - ctx context.Context +func (_e *GithubClient_Expecter) CreateEntityRegistrationToken(ctx interface{}) *GithubClient_CreateEntityRegistrationToken_Call { + return &GithubClient_CreateEntityRegistrationToken_Call{Call: _e.mock.On("CreateEntityRegistrationToken", ctx)} +} + +func (_c *GithubClient_CreateEntityRegistrationToken_Call) Run(run func(ctx context.Context)) *GithubClient_CreateEntityRegistrationToken_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *GithubClient_CreateEntityRegistrationToken_Call) Return(_a0 *github.RegistrationToken, _a1 *github.Response, _a2 error) *GithubClient_CreateEntityRegistrationToken_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *GithubClient_CreateEntityRegistrationToken_Call) RunAndReturn(run func(context.Context) (*github.RegistrationToken, *github.Response, error)) *GithubClient_CreateEntityRegistrationToken_Call { + _c.Call.Return(run) + return _c +} + // DeleteEntityHook provides a mock function with given fields: ctx, id func (_m *GithubClient) DeleteEntityHook(ctx context.Context, id int64) (*github.Response, error) { ret := _m.Called(ctx, id) @@ -117,6 +182,35 @@ func (_m *GithubClient) DeleteEntityHook(ctx context.Context, id int64) (*github return r0, r1 } +// GithubClient_DeleteEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteEntityHook' +type GithubClient_DeleteEntityHook_Call struct { + *mock.Call +} + +// DeleteEntityHook is a helper method to define mock.On call +// - ctx context.Context +// - id int64 +func (_e *GithubClient_Expecter) DeleteEntityHook(ctx interface{}, id interface{}) *GithubClient_DeleteEntityHook_Call { + return &GithubClient_DeleteEntityHook_Call{Call: _e.mock.On("DeleteEntityHook", ctx, id)} +} + +func (_c *GithubClient_DeleteEntityHook_Call) Run(run func(ctx context.Context, id int64)) *GithubClient_DeleteEntityHook_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64)) + }) + return _c +} + +func (_c *GithubClient_DeleteEntityHook_Call) Return(ret *github.Response, err error) *GithubClient_DeleteEntityHook_Call { + _c.Call.Return(ret, err) + return _c +} + +func (_c *GithubClient_DeleteEntityHook_Call) RunAndReturn(run func(context.Context, int64) (*github.Response, error)) *GithubClient_DeleteEntityHook_Call { + _c.Call.Return(run) + return _c +} + // GetEntity provides a mock function with no fields func (_m *GithubClient) GetEntity() params.ForgeEntity { ret := _m.Called() @@ -135,6 +229,33 @@ func (_m *GithubClient) GetEntity() params.ForgeEntity { return r0 } +// GithubClient_GetEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEntity' +type GithubClient_GetEntity_Call struct { + *mock.Call +} + +// GetEntity is a helper method to define mock.On call +func (_e *GithubClient_Expecter) GetEntity() *GithubClient_GetEntity_Call { + return &GithubClient_GetEntity_Call{Call: _e.mock.On("GetEntity")} +} + +func (_c *GithubClient_GetEntity_Call) Run(run func()) *GithubClient_GetEntity_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *GithubClient_GetEntity_Call) Return(_a0 params.ForgeEntity) *GithubClient_GetEntity_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *GithubClient_GetEntity_Call) RunAndReturn(run func() params.ForgeEntity) *GithubClient_GetEntity_Call { + _c.Call.Return(run) + return _c +} + // GetEntityHook provides a mock function with given fields: ctx, id func (_m *GithubClient) GetEntityHook(ctx context.Context, id int64) (*github.Hook, error) { ret := _m.Called(ctx, id) @@ -165,6 +286,35 @@ func (_m *GithubClient) GetEntityHook(ctx context.Context, id int64) (*github.Ho return r0, r1 } +// GithubClient_GetEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEntityHook' +type GithubClient_GetEntityHook_Call struct { + *mock.Call +} + +// GetEntityHook is a helper method to define mock.On call +// - ctx context.Context +// - id int64 +func (_e *GithubClient_Expecter) GetEntityHook(ctx interface{}, id interface{}) *GithubClient_GetEntityHook_Call { + return &GithubClient_GetEntityHook_Call{Call: _e.mock.On("GetEntityHook", ctx, id)} +} + +func (_c *GithubClient_GetEntityHook_Call) Run(run func(ctx context.Context, id int64)) *GithubClient_GetEntityHook_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64)) + }) + return _c +} + +func (_c *GithubClient_GetEntityHook_Call) Return(ret *github.Hook, err error) *GithubClient_GetEntityHook_Call { + _c.Call.Return(ret, err) + return _c +} + +func (_c *GithubClient_GetEntityHook_Call) RunAndReturn(run func(context.Context, int64) (*github.Hook, error)) *GithubClient_GetEntityHook_Call { + _c.Call.Return(run) + return _c +} + // GetEntityJITConfig provides a mock function with given fields: ctx, instance, pool, labels func (_m *GithubClient) GetEntityJITConfig(ctx context.Context, instance string, pool params.Pool, labels []string) (map[string]string, *github.Runner, error) { ret := _m.Called(ctx, instance, pool, labels) @@ -204,6 +354,37 @@ func (_m *GithubClient) GetEntityJITConfig(ctx context.Context, instance string, return r0, r1, r2 } +// GithubClient_GetEntityJITConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEntityJITConfig' +type GithubClient_GetEntityJITConfig_Call struct { + *mock.Call +} + +// GetEntityJITConfig is a helper method to define mock.On call +// - ctx context.Context +// - instance string +// - pool params.Pool +// - labels []string +func (_e *GithubClient_Expecter) GetEntityJITConfig(ctx interface{}, instance interface{}, pool interface{}, labels interface{}) *GithubClient_GetEntityJITConfig_Call { + return &GithubClient_GetEntityJITConfig_Call{Call: _e.mock.On("GetEntityJITConfig", ctx, instance, pool, labels)} +} + +func (_c *GithubClient_GetEntityJITConfig_Call) Run(run func(ctx context.Context, instance string, pool params.Pool, labels []string)) *GithubClient_GetEntityJITConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(params.Pool), args[3].([]string)) + }) + return _c +} + +func (_c *GithubClient_GetEntityJITConfig_Call) Return(jitConfigMap map[string]string, runner *github.Runner, err error) *GithubClient_GetEntityJITConfig_Call { + _c.Call.Return(jitConfigMap, runner, err) + return _c +} + +func (_c *GithubClient_GetEntityJITConfig_Call) RunAndReturn(run func(context.Context, string, params.Pool, []string) (map[string]string, *github.Runner, error)) *GithubClient_GetEntityJITConfig_Call { + _c.Call.Return(run) + return _c +} + // GetWorkflowJobByID provides a mock function with given fields: ctx, owner, repo, jobID func (_m *GithubClient) GetWorkflowJobByID(ctx context.Context, owner string, repo string, jobID int64) (*github.WorkflowJob, *github.Response, error) { ret := _m.Called(ctx, owner, repo, jobID) @@ -243,6 +424,37 @@ func (_m *GithubClient) GetWorkflowJobByID(ctx context.Context, owner string, re return r0, r1, r2 } +// GithubClient_GetWorkflowJobByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkflowJobByID' +type GithubClient_GetWorkflowJobByID_Call struct { + *mock.Call +} + +// GetWorkflowJobByID is a helper method to define mock.On call +// - ctx context.Context +// - owner string +// - repo string +// - jobID int64 +func (_e *GithubClient_Expecter) GetWorkflowJobByID(ctx interface{}, owner interface{}, repo interface{}, jobID interface{}) *GithubClient_GetWorkflowJobByID_Call { + return &GithubClient_GetWorkflowJobByID_Call{Call: _e.mock.On("GetWorkflowJobByID", ctx, owner, repo, jobID)} +} + +func (_c *GithubClient_GetWorkflowJobByID_Call) Run(run func(ctx context.Context, owner string, repo string, jobID int64)) *GithubClient_GetWorkflowJobByID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(int64)) + }) + return _c +} + +func (_c *GithubClient_GetWorkflowJobByID_Call) Return(_a0 *github.WorkflowJob, _a1 *github.Response, _a2 error) *GithubClient_GetWorkflowJobByID_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *GithubClient_GetWorkflowJobByID_Call) RunAndReturn(run func(context.Context, string, string, int64) (*github.WorkflowJob, *github.Response, error)) *GithubClient_GetWorkflowJobByID_Call { + _c.Call.Return(run) + return _c +} + // GithubBaseURL provides a mock function with no fields func (_m *GithubClient) GithubBaseURL() *url.URL { ret := _m.Called() @@ -263,6 +475,33 @@ func (_m *GithubClient) GithubBaseURL() *url.URL { return r0 } +// GithubClient_GithubBaseURL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GithubBaseURL' +type GithubClient_GithubBaseURL_Call struct { + *mock.Call +} + +// GithubBaseURL is a helper method to define mock.On call +func (_e *GithubClient_Expecter) GithubBaseURL() *GithubClient_GithubBaseURL_Call { + return &GithubClient_GithubBaseURL_Call{Call: _e.mock.On("GithubBaseURL")} +} + +func (_c *GithubClient_GithubBaseURL_Call) Run(run func()) *GithubClient_GithubBaseURL_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *GithubClient_GithubBaseURL_Call) Return(_a0 *url.URL) *GithubClient_GithubBaseURL_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *GithubClient_GithubBaseURL_Call) RunAndReturn(run func() *url.URL) *GithubClient_GithubBaseURL_Call { + _c.Call.Return(run) + return _c +} + // ListEntityHooks provides a mock function with given fields: ctx, opts func (_m *GithubClient) ListEntityHooks(ctx context.Context, opts *github.ListOptions) ([]*github.Hook, *github.Response, error) { ret := _m.Called(ctx, opts) @@ -302,6 +541,35 @@ func (_m *GithubClient) ListEntityHooks(ctx context.Context, opts *github.ListOp return r0, r1, r2 } +// GithubClient_ListEntityHooks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityHooks' +type GithubClient_ListEntityHooks_Call struct { + *mock.Call +} + +// ListEntityHooks is a helper method to define mock.On call +// - ctx context.Context +// - opts *github.ListOptions +func (_e *GithubClient_Expecter) ListEntityHooks(ctx interface{}, opts interface{}) *GithubClient_ListEntityHooks_Call { + return &GithubClient_ListEntityHooks_Call{Call: _e.mock.On("ListEntityHooks", ctx, opts)} +} + +func (_c *GithubClient_ListEntityHooks_Call) Run(run func(ctx context.Context, opts *github.ListOptions)) *GithubClient_ListEntityHooks_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*github.ListOptions)) + }) + return _c +} + +func (_c *GithubClient_ListEntityHooks_Call) Return(ret []*github.Hook, response *github.Response, err error) *GithubClient_ListEntityHooks_Call { + _c.Call.Return(ret, response, err) + return _c +} + +func (_c *GithubClient_ListEntityHooks_Call) RunAndReturn(run func(context.Context, *github.ListOptions) ([]*github.Hook, *github.Response, error)) *GithubClient_ListEntityHooks_Call { + _c.Call.Return(run) + return _c +} + // ListEntityRunnerApplicationDownloads provides a mock function with given fields: ctx func (_m *GithubClient) ListEntityRunnerApplicationDownloads(ctx context.Context) ([]*github.RunnerApplicationDownload, *github.Response, error) { ret := _m.Called(ctx) @@ -341,6 +609,34 @@ func (_m *GithubClient) ListEntityRunnerApplicationDownloads(ctx context.Context return r0, r1, r2 } +// GithubClient_ListEntityRunnerApplicationDownloads_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityRunnerApplicationDownloads' +type GithubClient_ListEntityRunnerApplicationDownloads_Call struct { + *mock.Call +} + +// ListEntityRunnerApplicationDownloads is a helper method to define mock.On call +// - ctx context.Context +func (_e *GithubClient_Expecter) ListEntityRunnerApplicationDownloads(ctx interface{}) *GithubClient_ListEntityRunnerApplicationDownloads_Call { + return &GithubClient_ListEntityRunnerApplicationDownloads_Call{Call: _e.mock.On("ListEntityRunnerApplicationDownloads", ctx)} +} + +func (_c *GithubClient_ListEntityRunnerApplicationDownloads_Call) Run(run func(ctx context.Context)) *GithubClient_ListEntityRunnerApplicationDownloads_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *GithubClient_ListEntityRunnerApplicationDownloads_Call) Return(_a0 []*github.RunnerApplicationDownload, _a1 *github.Response, _a2 error) *GithubClient_ListEntityRunnerApplicationDownloads_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *GithubClient_ListEntityRunnerApplicationDownloads_Call) RunAndReturn(run func(context.Context) ([]*github.RunnerApplicationDownload, *github.Response, error)) *GithubClient_ListEntityRunnerApplicationDownloads_Call { + _c.Call.Return(run) + return _c +} + // ListEntityRunners provides a mock function with given fields: ctx, opts func (_m *GithubClient) ListEntityRunners(ctx context.Context, opts *github.ListRunnersOptions) (*github.Runners, *github.Response, error) { ret := _m.Called(ctx, opts) @@ -380,6 +676,35 @@ func (_m *GithubClient) ListEntityRunners(ctx context.Context, opts *github.List return r0, r1, r2 } +// GithubClient_ListEntityRunners_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityRunners' +type GithubClient_ListEntityRunners_Call struct { + *mock.Call +} + +// ListEntityRunners is a helper method to define mock.On call +// - ctx context.Context +// - opts *github.ListRunnersOptions +func (_e *GithubClient_Expecter) ListEntityRunners(ctx interface{}, opts interface{}) *GithubClient_ListEntityRunners_Call { + return &GithubClient_ListEntityRunners_Call{Call: _e.mock.On("ListEntityRunners", ctx, opts)} +} + +func (_c *GithubClient_ListEntityRunners_Call) Run(run func(ctx context.Context, opts *github.ListRunnersOptions)) *GithubClient_ListEntityRunners_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*github.ListRunnersOptions)) + }) + return _c +} + +func (_c *GithubClient_ListEntityRunners_Call) Return(_a0 *github.Runners, _a1 *github.Response, _a2 error) *GithubClient_ListEntityRunners_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *GithubClient_ListEntityRunners_Call) RunAndReturn(run func(context.Context, *github.ListRunnersOptions) (*github.Runners, *github.Response, error)) *GithubClient_ListEntityRunners_Call { + _c.Call.Return(run) + return _c +} + // PingEntityHook provides a mock function with given fields: ctx, id func (_m *GithubClient) PingEntityHook(ctx context.Context, id int64) (*github.Response, error) { ret := _m.Called(ctx, id) @@ -410,6 +735,35 @@ func (_m *GithubClient) PingEntityHook(ctx context.Context, id int64) (*github.R return r0, r1 } +// GithubClient_PingEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PingEntityHook' +type GithubClient_PingEntityHook_Call struct { + *mock.Call +} + +// PingEntityHook is a helper method to define mock.On call +// - ctx context.Context +// - id int64 +func (_e *GithubClient_Expecter) PingEntityHook(ctx interface{}, id interface{}) *GithubClient_PingEntityHook_Call { + return &GithubClient_PingEntityHook_Call{Call: _e.mock.On("PingEntityHook", ctx, id)} +} + +func (_c *GithubClient_PingEntityHook_Call) Run(run func(ctx context.Context, id int64)) *GithubClient_PingEntityHook_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64)) + }) + return _c +} + +func (_c *GithubClient_PingEntityHook_Call) Return(ret *github.Response, err error) *GithubClient_PingEntityHook_Call { + _c.Call.Return(ret, err) + return _c +} + +func (_c *GithubClient_PingEntityHook_Call) RunAndReturn(run func(context.Context, int64) (*github.Response, error)) *GithubClient_PingEntityHook_Call { + _c.Call.Return(run) + return _c +} + // RateLimit provides a mock function with given fields: ctx func (_m *GithubClient) RateLimit(ctx context.Context) (*github.RateLimits, error) { ret := _m.Called(ctx) @@ -440,6 +794,34 @@ func (_m *GithubClient) RateLimit(ctx context.Context) (*github.RateLimits, erro return r0, r1 } +// GithubClient_RateLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RateLimit' +type GithubClient_RateLimit_Call struct { + *mock.Call +} + +// RateLimit is a helper method to define mock.On call +// - ctx context.Context +func (_e *GithubClient_Expecter) RateLimit(ctx interface{}) *GithubClient_RateLimit_Call { + return &GithubClient_RateLimit_Call{Call: _e.mock.On("RateLimit", ctx)} +} + +func (_c *GithubClient_RateLimit_Call) Run(run func(ctx context.Context)) *GithubClient_RateLimit_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *GithubClient_RateLimit_Call) Return(_a0 *github.RateLimits, _a1 error) *GithubClient_RateLimit_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *GithubClient_RateLimit_Call) RunAndReturn(run func(context.Context) (*github.RateLimits, error)) *GithubClient_RateLimit_Call { + _c.Call.Return(run) + return _c +} + // RemoveEntityRunner provides a mock function with given fields: ctx, runnerID func (_m *GithubClient) RemoveEntityRunner(ctx context.Context, runnerID int64) error { ret := _m.Called(ctx, runnerID) @@ -458,6 +840,35 @@ func (_m *GithubClient) RemoveEntityRunner(ctx context.Context, runnerID int64) return r0 } +// GithubClient_RemoveEntityRunner_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveEntityRunner' +type GithubClient_RemoveEntityRunner_Call struct { + *mock.Call +} + +// RemoveEntityRunner is a helper method to define mock.On call +// - ctx context.Context +// - runnerID int64 +func (_e *GithubClient_Expecter) RemoveEntityRunner(ctx interface{}, runnerID interface{}) *GithubClient_RemoveEntityRunner_Call { + return &GithubClient_RemoveEntityRunner_Call{Call: _e.mock.On("RemoveEntityRunner", ctx, runnerID)} +} + +func (_c *GithubClient_RemoveEntityRunner_Call) Run(run func(ctx context.Context, runnerID int64)) *GithubClient_RemoveEntityRunner_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64)) + }) + return _c +} + +func (_c *GithubClient_RemoveEntityRunner_Call) Return(_a0 error) *GithubClient_RemoveEntityRunner_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *GithubClient_RemoveEntityRunner_Call) RunAndReturn(run func(context.Context, int64) error) *GithubClient_RemoveEntityRunner_Call { + _c.Call.Return(run) + return _c +} + // NewGithubClient creates a new instance of GithubClient. 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 NewGithubClient(t interface { diff --git a/runner/common/mocks/GithubEntityOperations.go b/runner/common/mocks/GithubEntityOperations.go index 15326795..2448df4c 100644 --- a/runner/common/mocks/GithubEntityOperations.go +++ b/runner/common/mocks/GithubEntityOperations.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery. DO NOT EDIT. package mocks @@ -18,6 +18,14 @@ type GithubEntityOperations struct { mock.Mock } +type GithubEntityOperations_Expecter struct { + mock *mock.Mock +} + +func (_m *GithubEntityOperations) EXPECT() *GithubEntityOperations_Expecter { + return &GithubEntityOperations_Expecter{mock: &_m.Mock} +} + // CreateEntityHook provides a mock function with given fields: ctx, hook func (_m *GithubEntityOperations) CreateEntityHook(ctx context.Context, hook *github.Hook) (*github.Hook, error) { ret := _m.Called(ctx, hook) @@ -48,6 +56,35 @@ func (_m *GithubEntityOperations) CreateEntityHook(ctx context.Context, hook *gi return r0, r1 } +// GithubEntityOperations_CreateEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEntityHook' +type GithubEntityOperations_CreateEntityHook_Call struct { + *mock.Call +} + +// CreateEntityHook is a helper method to define mock.On call +// - ctx context.Context +// - hook *github.Hook +func (_e *GithubEntityOperations_Expecter) CreateEntityHook(ctx interface{}, hook interface{}) *GithubEntityOperations_CreateEntityHook_Call { + return &GithubEntityOperations_CreateEntityHook_Call{Call: _e.mock.On("CreateEntityHook", ctx, hook)} +} + +func (_c *GithubEntityOperations_CreateEntityHook_Call) Run(run func(ctx context.Context, hook *github.Hook)) *GithubEntityOperations_CreateEntityHook_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*github.Hook)) + }) + return _c +} + +func (_c *GithubEntityOperations_CreateEntityHook_Call) Return(ret *github.Hook, err error) *GithubEntityOperations_CreateEntityHook_Call { + _c.Call.Return(ret, err) + return _c +} + +func (_c *GithubEntityOperations_CreateEntityHook_Call) RunAndReturn(run func(context.Context, *github.Hook) (*github.Hook, error)) *GithubEntityOperations_CreateEntityHook_Call { + _c.Call.Return(run) + return _c +} + // CreateEntityRegistrationToken provides a mock function with given fields: ctx func (_m *GithubEntityOperations) CreateEntityRegistrationToken(ctx context.Context) (*github.RegistrationToken, *github.Response, error) { ret := _m.Called(ctx) @@ -87,6 +124,34 @@ func (_m *GithubEntityOperations) CreateEntityRegistrationToken(ctx context.Cont return r0, r1, r2 } +// GithubEntityOperations_CreateEntityRegistrationToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEntityRegistrationToken' +type GithubEntityOperations_CreateEntityRegistrationToken_Call struct { + *mock.Call +} + +// CreateEntityRegistrationToken is a helper method to define mock.On call +// - ctx context.Context +func (_e *GithubEntityOperations_Expecter) CreateEntityRegistrationToken(ctx interface{}) *GithubEntityOperations_CreateEntityRegistrationToken_Call { + return &GithubEntityOperations_CreateEntityRegistrationToken_Call{Call: _e.mock.On("CreateEntityRegistrationToken", ctx)} +} + +func (_c *GithubEntityOperations_CreateEntityRegistrationToken_Call) Run(run func(ctx context.Context)) *GithubEntityOperations_CreateEntityRegistrationToken_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *GithubEntityOperations_CreateEntityRegistrationToken_Call) Return(_a0 *github.RegistrationToken, _a1 *github.Response, _a2 error) *GithubEntityOperations_CreateEntityRegistrationToken_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *GithubEntityOperations_CreateEntityRegistrationToken_Call) RunAndReturn(run func(context.Context) (*github.RegistrationToken, *github.Response, error)) *GithubEntityOperations_CreateEntityRegistrationToken_Call { + _c.Call.Return(run) + return _c +} + // DeleteEntityHook provides a mock function with given fields: ctx, id func (_m *GithubEntityOperations) DeleteEntityHook(ctx context.Context, id int64) (*github.Response, error) { ret := _m.Called(ctx, id) @@ -117,6 +182,35 @@ func (_m *GithubEntityOperations) DeleteEntityHook(ctx context.Context, id int64 return r0, r1 } +// GithubEntityOperations_DeleteEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteEntityHook' +type GithubEntityOperations_DeleteEntityHook_Call struct { + *mock.Call +} + +// DeleteEntityHook is a helper method to define mock.On call +// - ctx context.Context +// - id int64 +func (_e *GithubEntityOperations_Expecter) DeleteEntityHook(ctx interface{}, id interface{}) *GithubEntityOperations_DeleteEntityHook_Call { + return &GithubEntityOperations_DeleteEntityHook_Call{Call: _e.mock.On("DeleteEntityHook", ctx, id)} +} + +func (_c *GithubEntityOperations_DeleteEntityHook_Call) Run(run func(ctx context.Context, id int64)) *GithubEntityOperations_DeleteEntityHook_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64)) + }) + return _c +} + +func (_c *GithubEntityOperations_DeleteEntityHook_Call) Return(ret *github.Response, err error) *GithubEntityOperations_DeleteEntityHook_Call { + _c.Call.Return(ret, err) + return _c +} + +func (_c *GithubEntityOperations_DeleteEntityHook_Call) RunAndReturn(run func(context.Context, int64) (*github.Response, error)) *GithubEntityOperations_DeleteEntityHook_Call { + _c.Call.Return(run) + return _c +} + // GetEntity provides a mock function with no fields func (_m *GithubEntityOperations) GetEntity() params.ForgeEntity { ret := _m.Called() @@ -135,6 +229,33 @@ func (_m *GithubEntityOperations) GetEntity() params.ForgeEntity { return r0 } +// GithubEntityOperations_GetEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEntity' +type GithubEntityOperations_GetEntity_Call struct { + *mock.Call +} + +// GetEntity is a helper method to define mock.On call +func (_e *GithubEntityOperations_Expecter) GetEntity() *GithubEntityOperations_GetEntity_Call { + return &GithubEntityOperations_GetEntity_Call{Call: _e.mock.On("GetEntity")} +} + +func (_c *GithubEntityOperations_GetEntity_Call) Run(run func()) *GithubEntityOperations_GetEntity_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *GithubEntityOperations_GetEntity_Call) Return(_a0 params.ForgeEntity) *GithubEntityOperations_GetEntity_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *GithubEntityOperations_GetEntity_Call) RunAndReturn(run func() params.ForgeEntity) *GithubEntityOperations_GetEntity_Call { + _c.Call.Return(run) + return _c +} + // GetEntityHook provides a mock function with given fields: ctx, id func (_m *GithubEntityOperations) GetEntityHook(ctx context.Context, id int64) (*github.Hook, error) { ret := _m.Called(ctx, id) @@ -165,6 +286,35 @@ func (_m *GithubEntityOperations) GetEntityHook(ctx context.Context, id int64) ( return r0, r1 } +// GithubEntityOperations_GetEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEntityHook' +type GithubEntityOperations_GetEntityHook_Call struct { + *mock.Call +} + +// GetEntityHook is a helper method to define mock.On call +// - ctx context.Context +// - id int64 +func (_e *GithubEntityOperations_Expecter) GetEntityHook(ctx interface{}, id interface{}) *GithubEntityOperations_GetEntityHook_Call { + return &GithubEntityOperations_GetEntityHook_Call{Call: _e.mock.On("GetEntityHook", ctx, id)} +} + +func (_c *GithubEntityOperations_GetEntityHook_Call) Run(run func(ctx context.Context, id int64)) *GithubEntityOperations_GetEntityHook_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64)) + }) + return _c +} + +func (_c *GithubEntityOperations_GetEntityHook_Call) Return(ret *github.Hook, err error) *GithubEntityOperations_GetEntityHook_Call { + _c.Call.Return(ret, err) + return _c +} + +func (_c *GithubEntityOperations_GetEntityHook_Call) RunAndReturn(run func(context.Context, int64) (*github.Hook, error)) *GithubEntityOperations_GetEntityHook_Call { + _c.Call.Return(run) + return _c +} + // GetEntityJITConfig provides a mock function with given fields: ctx, instance, pool, labels func (_m *GithubEntityOperations) GetEntityJITConfig(ctx context.Context, instance string, pool params.Pool, labels []string) (map[string]string, *github.Runner, error) { ret := _m.Called(ctx, instance, pool, labels) @@ -204,6 +354,37 @@ func (_m *GithubEntityOperations) GetEntityJITConfig(ctx context.Context, instan return r0, r1, r2 } +// GithubEntityOperations_GetEntityJITConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEntityJITConfig' +type GithubEntityOperations_GetEntityJITConfig_Call struct { + *mock.Call +} + +// GetEntityJITConfig is a helper method to define mock.On call +// - ctx context.Context +// - instance string +// - pool params.Pool +// - labels []string +func (_e *GithubEntityOperations_Expecter) GetEntityJITConfig(ctx interface{}, instance interface{}, pool interface{}, labels interface{}) *GithubEntityOperations_GetEntityJITConfig_Call { + return &GithubEntityOperations_GetEntityJITConfig_Call{Call: _e.mock.On("GetEntityJITConfig", ctx, instance, pool, labels)} +} + +func (_c *GithubEntityOperations_GetEntityJITConfig_Call) Run(run func(ctx context.Context, instance string, pool params.Pool, labels []string)) *GithubEntityOperations_GetEntityJITConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(params.Pool), args[3].([]string)) + }) + return _c +} + +func (_c *GithubEntityOperations_GetEntityJITConfig_Call) Return(jitConfigMap map[string]string, runner *github.Runner, err error) *GithubEntityOperations_GetEntityJITConfig_Call { + _c.Call.Return(jitConfigMap, runner, err) + return _c +} + +func (_c *GithubEntityOperations_GetEntityJITConfig_Call) RunAndReturn(run func(context.Context, string, params.Pool, []string) (map[string]string, *github.Runner, error)) *GithubEntityOperations_GetEntityJITConfig_Call { + _c.Call.Return(run) + return _c +} + // GithubBaseURL provides a mock function with no fields func (_m *GithubEntityOperations) GithubBaseURL() *url.URL { ret := _m.Called() @@ -224,6 +405,33 @@ func (_m *GithubEntityOperations) GithubBaseURL() *url.URL { return r0 } +// GithubEntityOperations_GithubBaseURL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GithubBaseURL' +type GithubEntityOperations_GithubBaseURL_Call struct { + *mock.Call +} + +// GithubBaseURL is a helper method to define mock.On call +func (_e *GithubEntityOperations_Expecter) GithubBaseURL() *GithubEntityOperations_GithubBaseURL_Call { + return &GithubEntityOperations_GithubBaseURL_Call{Call: _e.mock.On("GithubBaseURL")} +} + +func (_c *GithubEntityOperations_GithubBaseURL_Call) Run(run func()) *GithubEntityOperations_GithubBaseURL_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *GithubEntityOperations_GithubBaseURL_Call) Return(_a0 *url.URL) *GithubEntityOperations_GithubBaseURL_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *GithubEntityOperations_GithubBaseURL_Call) RunAndReturn(run func() *url.URL) *GithubEntityOperations_GithubBaseURL_Call { + _c.Call.Return(run) + return _c +} + // ListEntityHooks provides a mock function with given fields: ctx, opts func (_m *GithubEntityOperations) ListEntityHooks(ctx context.Context, opts *github.ListOptions) ([]*github.Hook, *github.Response, error) { ret := _m.Called(ctx, opts) @@ -263,6 +471,35 @@ func (_m *GithubEntityOperations) ListEntityHooks(ctx context.Context, opts *git return r0, r1, r2 } +// GithubEntityOperations_ListEntityHooks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityHooks' +type GithubEntityOperations_ListEntityHooks_Call struct { + *mock.Call +} + +// ListEntityHooks is a helper method to define mock.On call +// - ctx context.Context +// - opts *github.ListOptions +func (_e *GithubEntityOperations_Expecter) ListEntityHooks(ctx interface{}, opts interface{}) *GithubEntityOperations_ListEntityHooks_Call { + return &GithubEntityOperations_ListEntityHooks_Call{Call: _e.mock.On("ListEntityHooks", ctx, opts)} +} + +func (_c *GithubEntityOperations_ListEntityHooks_Call) Run(run func(ctx context.Context, opts *github.ListOptions)) *GithubEntityOperations_ListEntityHooks_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*github.ListOptions)) + }) + return _c +} + +func (_c *GithubEntityOperations_ListEntityHooks_Call) Return(ret []*github.Hook, response *github.Response, err error) *GithubEntityOperations_ListEntityHooks_Call { + _c.Call.Return(ret, response, err) + return _c +} + +func (_c *GithubEntityOperations_ListEntityHooks_Call) RunAndReturn(run func(context.Context, *github.ListOptions) ([]*github.Hook, *github.Response, error)) *GithubEntityOperations_ListEntityHooks_Call { + _c.Call.Return(run) + return _c +} + // ListEntityRunnerApplicationDownloads provides a mock function with given fields: ctx func (_m *GithubEntityOperations) ListEntityRunnerApplicationDownloads(ctx context.Context) ([]*github.RunnerApplicationDownload, *github.Response, error) { ret := _m.Called(ctx) @@ -302,6 +539,34 @@ func (_m *GithubEntityOperations) ListEntityRunnerApplicationDownloads(ctx conte return r0, r1, r2 } +// GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityRunnerApplicationDownloads' +type GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call struct { + *mock.Call +} + +// ListEntityRunnerApplicationDownloads is a helper method to define mock.On call +// - ctx context.Context +func (_e *GithubEntityOperations_Expecter) ListEntityRunnerApplicationDownloads(ctx interface{}) *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call { + return &GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call{Call: _e.mock.On("ListEntityRunnerApplicationDownloads", ctx)} +} + +func (_c *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call) Run(run func(ctx context.Context)) *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call) Return(_a0 []*github.RunnerApplicationDownload, _a1 *github.Response, _a2 error) *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call) RunAndReturn(run func(context.Context) ([]*github.RunnerApplicationDownload, *github.Response, error)) *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call { + _c.Call.Return(run) + return _c +} + // ListEntityRunners provides a mock function with given fields: ctx, opts func (_m *GithubEntityOperations) ListEntityRunners(ctx context.Context, opts *github.ListRunnersOptions) (*github.Runners, *github.Response, error) { ret := _m.Called(ctx, opts) @@ -341,6 +606,35 @@ func (_m *GithubEntityOperations) ListEntityRunners(ctx context.Context, opts *g return r0, r1, r2 } +// GithubEntityOperations_ListEntityRunners_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityRunners' +type GithubEntityOperations_ListEntityRunners_Call struct { + *mock.Call +} + +// ListEntityRunners is a helper method to define mock.On call +// - ctx context.Context +// - opts *github.ListRunnersOptions +func (_e *GithubEntityOperations_Expecter) ListEntityRunners(ctx interface{}, opts interface{}) *GithubEntityOperations_ListEntityRunners_Call { + return &GithubEntityOperations_ListEntityRunners_Call{Call: _e.mock.On("ListEntityRunners", ctx, opts)} +} + +func (_c *GithubEntityOperations_ListEntityRunners_Call) Run(run func(ctx context.Context, opts *github.ListRunnersOptions)) *GithubEntityOperations_ListEntityRunners_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*github.ListRunnersOptions)) + }) + return _c +} + +func (_c *GithubEntityOperations_ListEntityRunners_Call) Return(_a0 *github.Runners, _a1 *github.Response, _a2 error) *GithubEntityOperations_ListEntityRunners_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *GithubEntityOperations_ListEntityRunners_Call) RunAndReturn(run func(context.Context, *github.ListRunnersOptions) (*github.Runners, *github.Response, error)) *GithubEntityOperations_ListEntityRunners_Call { + _c.Call.Return(run) + return _c +} + // PingEntityHook provides a mock function with given fields: ctx, id func (_m *GithubEntityOperations) PingEntityHook(ctx context.Context, id int64) (*github.Response, error) { ret := _m.Called(ctx, id) @@ -371,6 +665,35 @@ func (_m *GithubEntityOperations) PingEntityHook(ctx context.Context, id int64) return r0, r1 } +// GithubEntityOperations_PingEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PingEntityHook' +type GithubEntityOperations_PingEntityHook_Call struct { + *mock.Call +} + +// PingEntityHook is a helper method to define mock.On call +// - ctx context.Context +// - id int64 +func (_e *GithubEntityOperations_Expecter) PingEntityHook(ctx interface{}, id interface{}) *GithubEntityOperations_PingEntityHook_Call { + return &GithubEntityOperations_PingEntityHook_Call{Call: _e.mock.On("PingEntityHook", ctx, id)} +} + +func (_c *GithubEntityOperations_PingEntityHook_Call) Run(run func(ctx context.Context, id int64)) *GithubEntityOperations_PingEntityHook_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64)) + }) + return _c +} + +func (_c *GithubEntityOperations_PingEntityHook_Call) Return(ret *github.Response, err error) *GithubEntityOperations_PingEntityHook_Call { + _c.Call.Return(ret, err) + return _c +} + +func (_c *GithubEntityOperations_PingEntityHook_Call) RunAndReturn(run func(context.Context, int64) (*github.Response, error)) *GithubEntityOperations_PingEntityHook_Call { + _c.Call.Return(run) + return _c +} + // RateLimit provides a mock function with given fields: ctx func (_m *GithubEntityOperations) RateLimit(ctx context.Context) (*github.RateLimits, error) { ret := _m.Called(ctx) @@ -401,6 +724,34 @@ func (_m *GithubEntityOperations) RateLimit(ctx context.Context) (*github.RateLi return r0, r1 } +// GithubEntityOperations_RateLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RateLimit' +type GithubEntityOperations_RateLimit_Call struct { + *mock.Call +} + +// RateLimit is a helper method to define mock.On call +// - ctx context.Context +func (_e *GithubEntityOperations_Expecter) RateLimit(ctx interface{}) *GithubEntityOperations_RateLimit_Call { + return &GithubEntityOperations_RateLimit_Call{Call: _e.mock.On("RateLimit", ctx)} +} + +func (_c *GithubEntityOperations_RateLimit_Call) Run(run func(ctx context.Context)) *GithubEntityOperations_RateLimit_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *GithubEntityOperations_RateLimit_Call) Return(_a0 *github.RateLimits, _a1 error) *GithubEntityOperations_RateLimit_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *GithubEntityOperations_RateLimit_Call) RunAndReturn(run func(context.Context) (*github.RateLimits, error)) *GithubEntityOperations_RateLimit_Call { + _c.Call.Return(run) + return _c +} + // RemoveEntityRunner provides a mock function with given fields: ctx, runnerID func (_m *GithubEntityOperations) RemoveEntityRunner(ctx context.Context, runnerID int64) error { ret := _m.Called(ctx, runnerID) @@ -419,6 +770,35 @@ func (_m *GithubEntityOperations) RemoveEntityRunner(ctx context.Context, runner return r0 } +// GithubEntityOperations_RemoveEntityRunner_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveEntityRunner' +type GithubEntityOperations_RemoveEntityRunner_Call struct { + *mock.Call +} + +// RemoveEntityRunner is a helper method to define mock.On call +// - ctx context.Context +// - runnerID int64 +func (_e *GithubEntityOperations_Expecter) RemoveEntityRunner(ctx interface{}, runnerID interface{}) *GithubEntityOperations_RemoveEntityRunner_Call { + return &GithubEntityOperations_RemoveEntityRunner_Call{Call: _e.mock.On("RemoveEntityRunner", ctx, runnerID)} +} + +func (_c *GithubEntityOperations_RemoveEntityRunner_Call) Run(run func(ctx context.Context, runnerID int64)) *GithubEntityOperations_RemoveEntityRunner_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64)) + }) + return _c +} + +func (_c *GithubEntityOperations_RemoveEntityRunner_Call) Return(_a0 error) *GithubEntityOperations_RemoveEntityRunner_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *GithubEntityOperations_RemoveEntityRunner_Call) RunAndReturn(run func(context.Context, int64) error) *GithubEntityOperations_RemoveEntityRunner_Call { + _c.Call.Return(run) + return _c +} + // NewGithubEntityOperations creates a new instance of GithubEntityOperations. 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 NewGithubEntityOperations(t interface { diff --git a/runner/common/mocks/PoolManager.go b/runner/common/mocks/PoolManager.go index 08cfb975..a1a62f4f 100644 --- a/runner/common/mocks/PoolManager.go +++ b/runner/common/mocks/PoolManager.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery. DO NOT EDIT. package mocks @@ -14,6 +14,14 @@ type PoolManager struct { mock.Mock } +type PoolManager_Expecter struct { + mock *mock.Mock +} + +func (_m *PoolManager) EXPECT() *PoolManager_Expecter { + return &PoolManager_Expecter{mock: &_m.Mock} +} + // GetWebhookInfo provides a mock function with given fields: ctx func (_m *PoolManager) GetWebhookInfo(ctx context.Context) (params.HookInfo, error) { ret := _m.Called(ctx) @@ -42,6 +50,34 @@ func (_m *PoolManager) GetWebhookInfo(ctx context.Context) (params.HookInfo, err return r0, r1 } +// PoolManager_GetWebhookInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWebhookInfo' +type PoolManager_GetWebhookInfo_Call struct { + *mock.Call +} + +// GetWebhookInfo is a helper method to define mock.On call +// - ctx context.Context +func (_e *PoolManager_Expecter) GetWebhookInfo(ctx interface{}) *PoolManager_GetWebhookInfo_Call { + return &PoolManager_GetWebhookInfo_Call{Call: _e.mock.On("GetWebhookInfo", ctx)} +} + +func (_c *PoolManager_GetWebhookInfo_Call) Run(run func(ctx context.Context)) *PoolManager_GetWebhookInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *PoolManager_GetWebhookInfo_Call) Return(_a0 params.HookInfo, _a1 error) *PoolManager_GetWebhookInfo_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoolManager_GetWebhookInfo_Call) RunAndReturn(run func(context.Context) (params.HookInfo, error)) *PoolManager_GetWebhookInfo_Call { + _c.Call.Return(run) + return _c +} + // GithubRunnerRegistrationToken provides a mock function with no fields func (_m *PoolManager) GithubRunnerRegistrationToken() (string, error) { ret := _m.Called() @@ -70,6 +106,33 @@ func (_m *PoolManager) GithubRunnerRegistrationToken() (string, error) { return r0, r1 } +// PoolManager_GithubRunnerRegistrationToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GithubRunnerRegistrationToken' +type PoolManager_GithubRunnerRegistrationToken_Call struct { + *mock.Call +} + +// GithubRunnerRegistrationToken is a helper method to define mock.On call +func (_e *PoolManager_Expecter) GithubRunnerRegistrationToken() *PoolManager_GithubRunnerRegistrationToken_Call { + return &PoolManager_GithubRunnerRegistrationToken_Call{Call: _e.mock.On("GithubRunnerRegistrationToken")} +} + +func (_c *PoolManager_GithubRunnerRegistrationToken_Call) Run(run func()) *PoolManager_GithubRunnerRegistrationToken_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PoolManager_GithubRunnerRegistrationToken_Call) Return(_a0 string, _a1 error) *PoolManager_GithubRunnerRegistrationToken_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoolManager_GithubRunnerRegistrationToken_Call) RunAndReturn(run func() (string, error)) *PoolManager_GithubRunnerRegistrationToken_Call { + _c.Call.Return(run) + return _c +} + // HandleWorkflowJob provides a mock function with given fields: job func (_m *PoolManager) HandleWorkflowJob(job params.WorkflowJob) error { ret := _m.Called(job) @@ -88,6 +151,34 @@ func (_m *PoolManager) HandleWorkflowJob(job params.WorkflowJob) error { return r0 } +// PoolManager_HandleWorkflowJob_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HandleWorkflowJob' +type PoolManager_HandleWorkflowJob_Call struct { + *mock.Call +} + +// HandleWorkflowJob is a helper method to define mock.On call +// - job params.WorkflowJob +func (_e *PoolManager_Expecter) HandleWorkflowJob(job interface{}) *PoolManager_HandleWorkflowJob_Call { + return &PoolManager_HandleWorkflowJob_Call{Call: _e.mock.On("HandleWorkflowJob", job)} +} + +func (_c *PoolManager_HandleWorkflowJob_Call) Run(run func(job params.WorkflowJob)) *PoolManager_HandleWorkflowJob_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(params.WorkflowJob)) + }) + return _c +} + +func (_c *PoolManager_HandleWorkflowJob_Call) Return(_a0 error) *PoolManager_HandleWorkflowJob_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PoolManager_HandleWorkflowJob_Call) RunAndReturn(run func(params.WorkflowJob) error) *PoolManager_HandleWorkflowJob_Call { + _c.Call.Return(run) + return _c +} + // ID provides a mock function with no fields func (_m *PoolManager) ID() string { ret := _m.Called() @@ -106,6 +197,33 @@ func (_m *PoolManager) ID() string { return r0 } +// PoolManager_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID' +type PoolManager_ID_Call struct { + *mock.Call +} + +// ID is a helper method to define mock.On call +func (_e *PoolManager_Expecter) ID() *PoolManager_ID_Call { + return &PoolManager_ID_Call{Call: _e.mock.On("ID")} +} + +func (_c *PoolManager_ID_Call) Run(run func()) *PoolManager_ID_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PoolManager_ID_Call) Return(_a0 string) *PoolManager_ID_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PoolManager_ID_Call) RunAndReturn(run func() string) *PoolManager_ID_Call { + _c.Call.Return(run) + return _c +} + // InstallWebhook provides a mock function with given fields: ctx, param func (_m *PoolManager) InstallWebhook(ctx context.Context, param params.InstallWebhookParams) (params.HookInfo, error) { ret := _m.Called(ctx, param) @@ -134,6 +252,35 @@ func (_m *PoolManager) InstallWebhook(ctx context.Context, param params.InstallW return r0, r1 } +// PoolManager_InstallWebhook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InstallWebhook' +type PoolManager_InstallWebhook_Call struct { + *mock.Call +} + +// InstallWebhook is a helper method to define mock.On call +// - ctx context.Context +// - param params.InstallWebhookParams +func (_e *PoolManager_Expecter) InstallWebhook(ctx interface{}, param interface{}) *PoolManager_InstallWebhook_Call { + return &PoolManager_InstallWebhook_Call{Call: _e.mock.On("InstallWebhook", ctx, param)} +} + +func (_c *PoolManager_InstallWebhook_Call) Run(run func(ctx context.Context, param params.InstallWebhookParams)) *PoolManager_InstallWebhook_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.InstallWebhookParams)) + }) + return _c +} + +func (_c *PoolManager_InstallWebhook_Call) Return(_a0 params.HookInfo, _a1 error) *PoolManager_InstallWebhook_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoolManager_InstallWebhook_Call) RunAndReturn(run func(context.Context, params.InstallWebhookParams) (params.HookInfo, error)) *PoolManager_InstallWebhook_Call { + _c.Call.Return(run) + return _c +} + // RootCABundle provides a mock function with no fields func (_m *PoolManager) RootCABundle() (params.CertificateBundle, error) { ret := _m.Called() @@ -162,11 +309,67 @@ func (_m *PoolManager) RootCABundle() (params.CertificateBundle, error) { return r0, r1 } +// PoolManager_RootCABundle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RootCABundle' +type PoolManager_RootCABundle_Call struct { + *mock.Call +} + +// RootCABundle is a helper method to define mock.On call +func (_e *PoolManager_Expecter) RootCABundle() *PoolManager_RootCABundle_Call { + return &PoolManager_RootCABundle_Call{Call: _e.mock.On("RootCABundle")} +} + +func (_c *PoolManager_RootCABundle_Call) Run(run func()) *PoolManager_RootCABundle_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PoolManager_RootCABundle_Call) Return(_a0 params.CertificateBundle, _a1 error) *PoolManager_RootCABundle_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoolManager_RootCABundle_Call) RunAndReturn(run func() (params.CertificateBundle, error)) *PoolManager_RootCABundle_Call { + _c.Call.Return(run) + return _c +} + // SetPoolRunningState provides a mock function with given fields: isRunning, failureReason func (_m *PoolManager) SetPoolRunningState(isRunning bool, failureReason string) { _m.Called(isRunning, failureReason) } +// PoolManager_SetPoolRunningState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetPoolRunningState' +type PoolManager_SetPoolRunningState_Call struct { + *mock.Call +} + +// SetPoolRunningState is a helper method to define mock.On call +// - isRunning bool +// - failureReason string +func (_e *PoolManager_Expecter) SetPoolRunningState(isRunning interface{}, failureReason interface{}) *PoolManager_SetPoolRunningState_Call { + return &PoolManager_SetPoolRunningState_Call{Call: _e.mock.On("SetPoolRunningState", isRunning, failureReason)} +} + +func (_c *PoolManager_SetPoolRunningState_Call) Run(run func(isRunning bool, failureReason string)) *PoolManager_SetPoolRunningState_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(bool), args[1].(string)) + }) + return _c +} + +func (_c *PoolManager_SetPoolRunningState_Call) Return() *PoolManager_SetPoolRunningState_Call { + _c.Call.Return() + return _c +} + +func (_c *PoolManager_SetPoolRunningState_Call) RunAndReturn(run func(bool, string)) *PoolManager_SetPoolRunningState_Call { + _c.Run(run) + return _c +} + // Start provides a mock function with no fields func (_m *PoolManager) Start() error { ret := _m.Called() @@ -185,6 +388,33 @@ func (_m *PoolManager) Start() error { return r0 } +// PoolManager_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type PoolManager_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +func (_e *PoolManager_Expecter) Start() *PoolManager_Start_Call { + return &PoolManager_Start_Call{Call: _e.mock.On("Start")} +} + +func (_c *PoolManager_Start_Call) Run(run func()) *PoolManager_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PoolManager_Start_Call) Return(_a0 error) *PoolManager_Start_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PoolManager_Start_Call) RunAndReturn(run func() error) *PoolManager_Start_Call { + _c.Call.Return(run) + return _c +} + // Status provides a mock function with no fields func (_m *PoolManager) Status() params.PoolManagerStatus { ret := _m.Called() @@ -203,6 +433,33 @@ func (_m *PoolManager) Status() params.PoolManagerStatus { return r0 } +// PoolManager_Status_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Status' +type PoolManager_Status_Call struct { + *mock.Call +} + +// Status is a helper method to define mock.On call +func (_e *PoolManager_Expecter) Status() *PoolManager_Status_Call { + return &PoolManager_Status_Call{Call: _e.mock.On("Status")} +} + +func (_c *PoolManager_Status_Call) Run(run func()) *PoolManager_Status_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PoolManager_Status_Call) Return(_a0 params.PoolManagerStatus) *PoolManager_Status_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PoolManager_Status_Call) RunAndReturn(run func() params.PoolManagerStatus) *PoolManager_Status_Call { + _c.Call.Return(run) + return _c +} + // Stop provides a mock function with no fields func (_m *PoolManager) Stop() error { ret := _m.Called() @@ -221,6 +478,33 @@ func (_m *PoolManager) Stop() error { return r0 } +// PoolManager_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop' +type PoolManager_Stop_Call struct { + *mock.Call +} + +// Stop is a helper method to define mock.On call +func (_e *PoolManager_Expecter) Stop() *PoolManager_Stop_Call { + return &PoolManager_Stop_Call{Call: _e.mock.On("Stop")} +} + +func (_c *PoolManager_Stop_Call) Run(run func()) *PoolManager_Stop_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PoolManager_Stop_Call) Return(_a0 error) *PoolManager_Stop_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PoolManager_Stop_Call) RunAndReturn(run func() error) *PoolManager_Stop_Call { + _c.Call.Return(run) + return _c +} + // UninstallWebhook provides a mock function with given fields: ctx func (_m *PoolManager) UninstallWebhook(ctx context.Context) error { ret := _m.Called(ctx) @@ -239,6 +523,34 @@ func (_m *PoolManager) UninstallWebhook(ctx context.Context) error { return r0 } +// PoolManager_UninstallWebhook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UninstallWebhook' +type PoolManager_UninstallWebhook_Call struct { + *mock.Call +} + +// UninstallWebhook is a helper method to define mock.On call +// - ctx context.Context +func (_e *PoolManager_Expecter) UninstallWebhook(ctx interface{}) *PoolManager_UninstallWebhook_Call { + return &PoolManager_UninstallWebhook_Call{Call: _e.mock.On("UninstallWebhook", ctx)} +} + +func (_c *PoolManager_UninstallWebhook_Call) Run(run func(ctx context.Context)) *PoolManager_UninstallWebhook_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *PoolManager_UninstallWebhook_Call) Return(_a0 error) *PoolManager_UninstallWebhook_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PoolManager_UninstallWebhook_Call) RunAndReturn(run func(context.Context) error) *PoolManager_UninstallWebhook_Call { + _c.Call.Return(run) + return _c +} + // Wait provides a mock function with no fields func (_m *PoolManager) Wait() error { ret := _m.Called() @@ -257,6 +569,33 @@ func (_m *PoolManager) Wait() error { return r0 } +// PoolManager_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait' +type PoolManager_Wait_Call struct { + *mock.Call +} + +// Wait is a helper method to define mock.On call +func (_e *PoolManager_Expecter) Wait() *PoolManager_Wait_Call { + return &PoolManager_Wait_Call{Call: _e.mock.On("Wait")} +} + +func (_c *PoolManager_Wait_Call) Run(run func()) *PoolManager_Wait_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PoolManager_Wait_Call) Return(_a0 error) *PoolManager_Wait_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PoolManager_Wait_Call) RunAndReturn(run func() error) *PoolManager_Wait_Call { + _c.Call.Return(run) + return _c +} + // WebhookSecret provides a mock function with no fields func (_m *PoolManager) WebhookSecret() string { ret := _m.Called() @@ -275,6 +614,33 @@ func (_m *PoolManager) WebhookSecret() string { return r0 } +// PoolManager_WebhookSecret_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WebhookSecret' +type PoolManager_WebhookSecret_Call struct { + *mock.Call +} + +// WebhookSecret is a helper method to define mock.On call +func (_e *PoolManager_Expecter) WebhookSecret() *PoolManager_WebhookSecret_Call { + return &PoolManager_WebhookSecret_Call{Call: _e.mock.On("WebhookSecret")} +} + +func (_c *PoolManager_WebhookSecret_Call) Run(run func()) *PoolManager_WebhookSecret_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PoolManager_WebhookSecret_Call) Return(_a0 string) *PoolManager_WebhookSecret_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PoolManager_WebhookSecret_Call) RunAndReturn(run func() string) *PoolManager_WebhookSecret_Call { + _c.Call.Return(run) + return _c +} + // NewPoolManager creates a new instance of PoolManager. 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 NewPoolManager(t interface { diff --git a/runner/common/mocks/Provider.go b/runner/common/mocks/Provider.go index e7491ac5..5bf94a10 100644 --- a/runner/common/mocks/Provider.go +++ b/runner/common/mocks/Provider.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery. DO NOT EDIT. package mocks @@ -19,6 +19,14 @@ type Provider struct { mock.Mock } +type Provider_Expecter struct { + mock *mock.Mock +} + +func (_m *Provider) EXPECT() *Provider_Expecter { + return &Provider_Expecter{mock: &_m.Mock} +} + // AsParams provides a mock function with no fields func (_m *Provider) AsParams() params.Provider { ret := _m.Called() @@ -37,6 +45,33 @@ func (_m *Provider) AsParams() params.Provider { return r0 } +// Provider_AsParams_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AsParams' +type Provider_AsParams_Call struct { + *mock.Call +} + +// AsParams is a helper method to define mock.On call +func (_e *Provider_Expecter) AsParams() *Provider_AsParams_Call { + return &Provider_AsParams_Call{Call: _e.mock.On("AsParams")} +} + +func (_c *Provider_AsParams_Call) Run(run func()) *Provider_AsParams_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Provider_AsParams_Call) Return(_a0 params.Provider) *Provider_AsParams_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Provider_AsParams_Call) RunAndReturn(run func() params.Provider) *Provider_AsParams_Call { + _c.Call.Return(run) + return _c +} + // CreateInstance provides a mock function with given fields: ctx, bootstrapParams, createInstanceParams func (_m *Provider) CreateInstance(ctx context.Context, bootstrapParams garm_provider_commonparams.BootstrapInstance, createInstanceParams common.CreateInstanceParams) (garm_provider_commonparams.ProviderInstance, error) { ret := _m.Called(ctx, bootstrapParams, createInstanceParams) @@ -65,6 +100,36 @@ func (_m *Provider) CreateInstance(ctx context.Context, bootstrapParams garm_pro return r0, r1 } +// Provider_CreateInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateInstance' +type Provider_CreateInstance_Call struct { + *mock.Call +} + +// CreateInstance is a helper method to define mock.On call +// - ctx context.Context +// - bootstrapParams garm_provider_commonparams.BootstrapInstance +// - createInstanceParams common.CreateInstanceParams +func (_e *Provider_Expecter) CreateInstance(ctx interface{}, bootstrapParams interface{}, createInstanceParams interface{}) *Provider_CreateInstance_Call { + return &Provider_CreateInstance_Call{Call: _e.mock.On("CreateInstance", ctx, bootstrapParams, createInstanceParams)} +} + +func (_c *Provider_CreateInstance_Call) Run(run func(ctx context.Context, bootstrapParams garm_provider_commonparams.BootstrapInstance, createInstanceParams common.CreateInstanceParams)) *Provider_CreateInstance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(garm_provider_commonparams.BootstrapInstance), args[2].(common.CreateInstanceParams)) + }) + return _c +} + +func (_c *Provider_CreateInstance_Call) Return(_a0 garm_provider_commonparams.ProviderInstance, _a1 error) *Provider_CreateInstance_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Provider_CreateInstance_Call) RunAndReturn(run func(context.Context, garm_provider_commonparams.BootstrapInstance, common.CreateInstanceParams) (garm_provider_commonparams.ProviderInstance, error)) *Provider_CreateInstance_Call { + _c.Call.Return(run) + return _c +} + // DeleteInstance provides a mock function with given fields: ctx, instance, deleteInstanceParams func (_m *Provider) DeleteInstance(ctx context.Context, instance string, deleteInstanceParams common.DeleteInstanceParams) error { ret := _m.Called(ctx, instance, deleteInstanceParams) @@ -83,6 +148,36 @@ func (_m *Provider) DeleteInstance(ctx context.Context, instance string, deleteI return r0 } +// Provider_DeleteInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteInstance' +type Provider_DeleteInstance_Call struct { + *mock.Call +} + +// DeleteInstance is a helper method to define mock.On call +// - ctx context.Context +// - instance string +// - deleteInstanceParams common.DeleteInstanceParams +func (_e *Provider_Expecter) DeleteInstance(ctx interface{}, instance interface{}, deleteInstanceParams interface{}) *Provider_DeleteInstance_Call { + return &Provider_DeleteInstance_Call{Call: _e.mock.On("DeleteInstance", ctx, instance, deleteInstanceParams)} +} + +func (_c *Provider_DeleteInstance_Call) Run(run func(ctx context.Context, instance string, deleteInstanceParams common.DeleteInstanceParams)) *Provider_DeleteInstance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(common.DeleteInstanceParams)) + }) + return _c +} + +func (_c *Provider_DeleteInstance_Call) Return(_a0 error) *Provider_DeleteInstance_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Provider_DeleteInstance_Call) RunAndReturn(run func(context.Context, string, common.DeleteInstanceParams) error) *Provider_DeleteInstance_Call { + _c.Call.Return(run) + return _c +} + // DisableJITConfig provides a mock function with no fields func (_m *Provider) DisableJITConfig() bool { ret := _m.Called() @@ -101,6 +196,33 @@ func (_m *Provider) DisableJITConfig() bool { return r0 } +// Provider_DisableJITConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DisableJITConfig' +type Provider_DisableJITConfig_Call struct { + *mock.Call +} + +// DisableJITConfig is a helper method to define mock.On call +func (_e *Provider_Expecter) DisableJITConfig() *Provider_DisableJITConfig_Call { + return &Provider_DisableJITConfig_Call{Call: _e.mock.On("DisableJITConfig")} +} + +func (_c *Provider_DisableJITConfig_Call) Run(run func()) *Provider_DisableJITConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Provider_DisableJITConfig_Call) Return(_a0 bool) *Provider_DisableJITConfig_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Provider_DisableJITConfig_Call) RunAndReturn(run func() bool) *Provider_DisableJITConfig_Call { + _c.Call.Return(run) + return _c +} + // GetInstance provides a mock function with given fields: ctx, instance, getInstanceParams func (_m *Provider) GetInstance(ctx context.Context, instance string, getInstanceParams common.GetInstanceParams) (garm_provider_commonparams.ProviderInstance, error) { ret := _m.Called(ctx, instance, getInstanceParams) @@ -129,6 +251,36 @@ func (_m *Provider) GetInstance(ctx context.Context, instance string, getInstanc return r0, r1 } +// Provider_GetInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetInstance' +type Provider_GetInstance_Call struct { + *mock.Call +} + +// GetInstance is a helper method to define mock.On call +// - ctx context.Context +// - instance string +// - getInstanceParams common.GetInstanceParams +func (_e *Provider_Expecter) GetInstance(ctx interface{}, instance interface{}, getInstanceParams interface{}) *Provider_GetInstance_Call { + return &Provider_GetInstance_Call{Call: _e.mock.On("GetInstance", ctx, instance, getInstanceParams)} +} + +func (_c *Provider_GetInstance_Call) Run(run func(ctx context.Context, instance string, getInstanceParams common.GetInstanceParams)) *Provider_GetInstance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(common.GetInstanceParams)) + }) + return _c +} + +func (_c *Provider_GetInstance_Call) Return(_a0 garm_provider_commonparams.ProviderInstance, _a1 error) *Provider_GetInstance_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Provider_GetInstance_Call) RunAndReturn(run func(context.Context, string, common.GetInstanceParams) (garm_provider_commonparams.ProviderInstance, error)) *Provider_GetInstance_Call { + _c.Call.Return(run) + return _c +} + // ListInstances provides a mock function with given fields: ctx, poolID, listInstancesParams func (_m *Provider) ListInstances(ctx context.Context, poolID string, listInstancesParams common.ListInstancesParams) ([]garm_provider_commonparams.ProviderInstance, error) { ret := _m.Called(ctx, poolID, listInstancesParams) @@ -159,6 +311,36 @@ func (_m *Provider) ListInstances(ctx context.Context, poolID string, listInstan return r0, r1 } +// Provider_ListInstances_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListInstances' +type Provider_ListInstances_Call struct { + *mock.Call +} + +// ListInstances is a helper method to define mock.On call +// - ctx context.Context +// - poolID string +// - listInstancesParams common.ListInstancesParams +func (_e *Provider_Expecter) ListInstances(ctx interface{}, poolID interface{}, listInstancesParams interface{}) *Provider_ListInstances_Call { + return &Provider_ListInstances_Call{Call: _e.mock.On("ListInstances", ctx, poolID, listInstancesParams)} +} + +func (_c *Provider_ListInstances_Call) Run(run func(ctx context.Context, poolID string, listInstancesParams common.ListInstancesParams)) *Provider_ListInstances_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(common.ListInstancesParams)) + }) + return _c +} + +func (_c *Provider_ListInstances_Call) Return(_a0 []garm_provider_commonparams.ProviderInstance, _a1 error) *Provider_ListInstances_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Provider_ListInstances_Call) RunAndReturn(run func(context.Context, string, common.ListInstancesParams) ([]garm_provider_commonparams.ProviderInstance, error)) *Provider_ListInstances_Call { + _c.Call.Return(run) + return _c +} + // RemoveAllInstances provides a mock function with given fields: ctx, removeAllInstancesParams func (_m *Provider) RemoveAllInstances(ctx context.Context, removeAllInstancesParams common.RemoveAllInstancesParams) error { ret := _m.Called(ctx, removeAllInstancesParams) @@ -177,6 +359,35 @@ func (_m *Provider) RemoveAllInstances(ctx context.Context, removeAllInstancesPa return r0 } +// Provider_RemoveAllInstances_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveAllInstances' +type Provider_RemoveAllInstances_Call struct { + *mock.Call +} + +// RemoveAllInstances is a helper method to define mock.On call +// - ctx context.Context +// - removeAllInstancesParams common.RemoveAllInstancesParams +func (_e *Provider_Expecter) RemoveAllInstances(ctx interface{}, removeAllInstancesParams interface{}) *Provider_RemoveAllInstances_Call { + return &Provider_RemoveAllInstances_Call{Call: _e.mock.On("RemoveAllInstances", ctx, removeAllInstancesParams)} +} + +func (_c *Provider_RemoveAllInstances_Call) Run(run func(ctx context.Context, removeAllInstancesParams common.RemoveAllInstancesParams)) *Provider_RemoveAllInstances_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.RemoveAllInstancesParams)) + }) + return _c +} + +func (_c *Provider_RemoveAllInstances_Call) Return(_a0 error) *Provider_RemoveAllInstances_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Provider_RemoveAllInstances_Call) RunAndReturn(run func(context.Context, common.RemoveAllInstancesParams) error) *Provider_RemoveAllInstances_Call { + _c.Call.Return(run) + return _c +} + // Start provides a mock function with given fields: ctx, instance, startParams func (_m *Provider) Start(ctx context.Context, instance string, startParams common.StartParams) error { ret := _m.Called(ctx, instance, startParams) @@ -195,6 +406,36 @@ func (_m *Provider) Start(ctx context.Context, instance string, startParams comm return r0 } +// Provider_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type Provider_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +// - ctx context.Context +// - instance string +// - startParams common.StartParams +func (_e *Provider_Expecter) Start(ctx interface{}, instance interface{}, startParams interface{}) *Provider_Start_Call { + return &Provider_Start_Call{Call: _e.mock.On("Start", ctx, instance, startParams)} +} + +func (_c *Provider_Start_Call) Run(run func(ctx context.Context, instance string, startParams common.StartParams)) *Provider_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(common.StartParams)) + }) + return _c +} + +func (_c *Provider_Start_Call) Return(_a0 error) *Provider_Start_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Provider_Start_Call) RunAndReturn(run func(context.Context, string, common.StartParams) error) *Provider_Start_Call { + _c.Call.Return(run) + return _c +} + // Stop provides a mock function with given fields: ctx, instance, stopParams func (_m *Provider) Stop(ctx context.Context, instance string, stopParams common.StopParams) error { ret := _m.Called(ctx, instance, stopParams) @@ -213,6 +454,36 @@ func (_m *Provider) Stop(ctx context.Context, instance string, stopParams common return r0 } +// Provider_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop' +type Provider_Stop_Call struct { + *mock.Call +} + +// Stop is a helper method to define mock.On call +// - ctx context.Context +// - instance string +// - stopParams common.StopParams +func (_e *Provider_Expecter) Stop(ctx interface{}, instance interface{}, stopParams interface{}) *Provider_Stop_Call { + return &Provider_Stop_Call{Call: _e.mock.On("Stop", ctx, instance, stopParams)} +} + +func (_c *Provider_Stop_Call) Run(run func(ctx context.Context, instance string, stopParams common.StopParams)) *Provider_Stop_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(common.StopParams)) + }) + return _c +} + +func (_c *Provider_Stop_Call) Return(_a0 error) *Provider_Stop_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Provider_Stop_Call) RunAndReturn(run func(context.Context, string, common.StopParams) error) *Provider_Stop_Call { + _c.Call.Return(run) + return _c +} + // NewProvider creates a new instance of Provider. 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 NewProvider(t interface { diff --git a/runner/common/mocks/RateLimitClient.go b/runner/common/mocks/RateLimitClient.go index 119f62e1..b7e52f71 100644 --- a/runner/common/mocks/RateLimitClient.go +++ b/runner/common/mocks/RateLimitClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery. DO NOT EDIT. package mocks @@ -14,6 +14,14 @@ type RateLimitClient struct { mock.Mock } +type RateLimitClient_Expecter struct { + mock *mock.Mock +} + +func (_m *RateLimitClient) EXPECT() *RateLimitClient_Expecter { + return &RateLimitClient_Expecter{mock: &_m.Mock} +} + // RateLimit provides a mock function with given fields: ctx func (_m *RateLimitClient) RateLimit(ctx context.Context) (*github.RateLimits, error) { ret := _m.Called(ctx) @@ -44,6 +52,34 @@ func (_m *RateLimitClient) RateLimit(ctx context.Context) (*github.RateLimits, e return r0, r1 } +// RateLimitClient_RateLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RateLimit' +type RateLimitClient_RateLimit_Call struct { + *mock.Call +} + +// RateLimit is a helper method to define mock.On call +// - ctx context.Context +func (_e *RateLimitClient_Expecter) RateLimit(ctx interface{}) *RateLimitClient_RateLimit_Call { + return &RateLimitClient_RateLimit_Call{Call: _e.mock.On("RateLimit", ctx)} +} + +func (_c *RateLimitClient_RateLimit_Call) Run(run func(ctx context.Context)) *RateLimitClient_RateLimit_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *RateLimitClient_RateLimit_Call) Return(_a0 *github.RateLimits, _a1 error) *RateLimitClient_RateLimit_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *RateLimitClient_RateLimit_Call) RunAndReturn(run func(context.Context) (*github.RateLimits, error)) *RateLimitClient_RateLimit_Call { + _c.Call.Return(run) + return _c +} + // NewRateLimitClient creates a new instance of RateLimitClient. 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 NewRateLimitClient(t interface { diff --git a/runner/common/pool.go b/runner/common/pool.go index 18f46a9d..4cb86a62 100644 --- a/runner/common/pool.go +++ b/runner/common/pool.go @@ -36,7 +36,7 @@ const ( BackoffTimer = 1 * time.Minute ) -//go:generate mockery --all +//go:generate go run github.com/vektra/mockery/v2@latest type PoolManager interface { // ID returns the ID of the entity (repo, org, enterprise) ID() string diff --git a/runner/common/provider.go b/runner/common/provider.go index 7454540f..a5d0db66 100644 --- a/runner/common/provider.go +++ b/runner/common/provider.go @@ -21,7 +21,7 @@ import ( "github.com/cloudbase/garm/params" ) -//go:generate mockery --all +//go:generate go run github.com/vektra/mockery/v2@latest type Provider interface { // CreateInstance creates a new compute instance in the provider. CreateInstance(ctx context.Context, bootstrapParams commonParams.BootstrapInstance, createInstanceParams CreateInstanceParams) (commonParams.ProviderInstance, error) diff --git a/runner/common/util.go b/runner/common/util.go index 588ab68e..d8519438 100644 --- a/runner/common/util.go +++ b/runner/common/util.go @@ -49,7 +49,7 @@ type RateLimitClient interface { // GithubClient that describes the minimum list of functions we need to interact with github. // Allows for easier testing. // -//go:generate mockery --all +//go:generate go run github.com/vektra/mockery/v2@latest type GithubClient interface { GithubEntityOperations diff --git a/runner/interfaces.go b/runner/interfaces.go index ff8129ed..3d4703f7 100644 --- a/runner/interfaces.go +++ b/runner/interfaces.go @@ -43,7 +43,7 @@ type EnterprisePoolManager interface { GetEnterprisePoolManagers() (map[string]common.PoolManager, error) } -//go:generate mockery --name=PoolManagerController +//go:generate go run github.com/vektra/mockery/v2@latest type PoolManagerController interface { RepoPoolManager diff --git a/runner/mocks/PoolManagerController.go b/runner/mocks/PoolManagerController.go index 05720ebe..b17196ec 100644 --- a/runner/mocks/PoolManagerController.go +++ b/runner/mocks/PoolManagerController.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery. DO NOT EDIT. package mocks @@ -19,6 +19,14 @@ type PoolManagerController struct { mock.Mock } +type PoolManagerController_Expecter struct { + mock *mock.Mock +} + +func (_m *PoolManagerController) EXPECT() *PoolManagerController_Expecter { + return &PoolManagerController_Expecter{mock: &_m.Mock} +} + // CreateEnterprisePoolManager provides a mock function with given fields: ctx, enterprise, providers, store func (_m *PoolManagerController) CreateEnterprisePoolManager(ctx context.Context, enterprise params.Enterprise, providers map[string]common.Provider, store databasecommon.Store) (common.PoolManager, error) { ret := _m.Called(ctx, enterprise, providers, store) @@ -49,6 +57,37 @@ func (_m *PoolManagerController) CreateEnterprisePoolManager(ctx context.Context return r0, r1 } +// PoolManagerController_CreateEnterprisePoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEnterprisePoolManager' +type PoolManagerController_CreateEnterprisePoolManager_Call struct { + *mock.Call +} + +// CreateEnterprisePoolManager is a helper method to define mock.On call +// - ctx context.Context +// - enterprise params.Enterprise +// - providers map[string]common.Provider +// - store databasecommon.Store +func (_e *PoolManagerController_Expecter) CreateEnterprisePoolManager(ctx interface{}, enterprise interface{}, providers interface{}, store interface{}) *PoolManagerController_CreateEnterprisePoolManager_Call { + return &PoolManagerController_CreateEnterprisePoolManager_Call{Call: _e.mock.On("CreateEnterprisePoolManager", ctx, enterprise, providers, store)} +} + +func (_c *PoolManagerController_CreateEnterprisePoolManager_Call) Run(run func(ctx context.Context, enterprise params.Enterprise, providers map[string]common.Provider, store databasecommon.Store)) *PoolManagerController_CreateEnterprisePoolManager_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.Enterprise), args[2].(map[string]common.Provider), args[3].(databasecommon.Store)) + }) + return _c +} + +func (_c *PoolManagerController_CreateEnterprisePoolManager_Call) Return(_a0 common.PoolManager, _a1 error) *PoolManagerController_CreateEnterprisePoolManager_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoolManagerController_CreateEnterprisePoolManager_Call) RunAndReturn(run func(context.Context, params.Enterprise, map[string]common.Provider, databasecommon.Store) (common.PoolManager, error)) *PoolManagerController_CreateEnterprisePoolManager_Call { + _c.Call.Return(run) + return _c +} + // CreateOrgPoolManager provides a mock function with given fields: ctx, org, providers, store func (_m *PoolManagerController) CreateOrgPoolManager(ctx context.Context, org params.Organization, providers map[string]common.Provider, store databasecommon.Store) (common.PoolManager, error) { ret := _m.Called(ctx, org, providers, store) @@ -79,6 +118,37 @@ func (_m *PoolManagerController) CreateOrgPoolManager(ctx context.Context, org p return r0, r1 } +// PoolManagerController_CreateOrgPoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateOrgPoolManager' +type PoolManagerController_CreateOrgPoolManager_Call struct { + *mock.Call +} + +// CreateOrgPoolManager is a helper method to define mock.On call +// - ctx context.Context +// - org params.Organization +// - providers map[string]common.Provider +// - store databasecommon.Store +func (_e *PoolManagerController_Expecter) CreateOrgPoolManager(ctx interface{}, org interface{}, providers interface{}, store interface{}) *PoolManagerController_CreateOrgPoolManager_Call { + return &PoolManagerController_CreateOrgPoolManager_Call{Call: _e.mock.On("CreateOrgPoolManager", ctx, org, providers, store)} +} + +func (_c *PoolManagerController_CreateOrgPoolManager_Call) Run(run func(ctx context.Context, org params.Organization, providers map[string]common.Provider, store databasecommon.Store)) *PoolManagerController_CreateOrgPoolManager_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.Organization), args[2].(map[string]common.Provider), args[3].(databasecommon.Store)) + }) + return _c +} + +func (_c *PoolManagerController_CreateOrgPoolManager_Call) Return(_a0 common.PoolManager, _a1 error) *PoolManagerController_CreateOrgPoolManager_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoolManagerController_CreateOrgPoolManager_Call) RunAndReturn(run func(context.Context, params.Organization, map[string]common.Provider, databasecommon.Store) (common.PoolManager, error)) *PoolManagerController_CreateOrgPoolManager_Call { + _c.Call.Return(run) + return _c +} + // CreateRepoPoolManager provides a mock function with given fields: ctx, repo, providers, store func (_m *PoolManagerController) CreateRepoPoolManager(ctx context.Context, repo params.Repository, providers map[string]common.Provider, store databasecommon.Store) (common.PoolManager, error) { ret := _m.Called(ctx, repo, providers, store) @@ -109,6 +179,37 @@ func (_m *PoolManagerController) CreateRepoPoolManager(ctx context.Context, repo return r0, r1 } +// PoolManagerController_CreateRepoPoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateRepoPoolManager' +type PoolManagerController_CreateRepoPoolManager_Call struct { + *mock.Call +} + +// CreateRepoPoolManager is a helper method to define mock.On call +// - ctx context.Context +// - repo params.Repository +// - providers map[string]common.Provider +// - store databasecommon.Store +func (_e *PoolManagerController_Expecter) CreateRepoPoolManager(ctx interface{}, repo interface{}, providers interface{}, store interface{}) *PoolManagerController_CreateRepoPoolManager_Call { + return &PoolManagerController_CreateRepoPoolManager_Call{Call: _e.mock.On("CreateRepoPoolManager", ctx, repo, providers, store)} +} + +func (_c *PoolManagerController_CreateRepoPoolManager_Call) Run(run func(ctx context.Context, repo params.Repository, providers map[string]common.Provider, store databasecommon.Store)) *PoolManagerController_CreateRepoPoolManager_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(params.Repository), args[2].(map[string]common.Provider), args[3].(databasecommon.Store)) + }) + return _c +} + +func (_c *PoolManagerController_CreateRepoPoolManager_Call) Return(_a0 common.PoolManager, _a1 error) *PoolManagerController_CreateRepoPoolManager_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoolManagerController_CreateRepoPoolManager_Call) RunAndReturn(run func(context.Context, params.Repository, map[string]common.Provider, databasecommon.Store) (common.PoolManager, error)) *PoolManagerController_CreateRepoPoolManager_Call { + _c.Call.Return(run) + return _c +} + // DeleteEnterprisePoolManager provides a mock function with given fields: enterprise func (_m *PoolManagerController) DeleteEnterprisePoolManager(enterprise params.Enterprise) error { ret := _m.Called(enterprise) @@ -127,6 +228,34 @@ func (_m *PoolManagerController) DeleteEnterprisePoolManager(enterprise params.E return r0 } +// PoolManagerController_DeleteEnterprisePoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteEnterprisePoolManager' +type PoolManagerController_DeleteEnterprisePoolManager_Call struct { + *mock.Call +} + +// DeleteEnterprisePoolManager is a helper method to define mock.On call +// - enterprise params.Enterprise +func (_e *PoolManagerController_Expecter) DeleteEnterprisePoolManager(enterprise interface{}) *PoolManagerController_DeleteEnterprisePoolManager_Call { + return &PoolManagerController_DeleteEnterprisePoolManager_Call{Call: _e.mock.On("DeleteEnterprisePoolManager", enterprise)} +} + +func (_c *PoolManagerController_DeleteEnterprisePoolManager_Call) Run(run func(enterprise params.Enterprise)) *PoolManagerController_DeleteEnterprisePoolManager_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(params.Enterprise)) + }) + return _c +} + +func (_c *PoolManagerController_DeleteEnterprisePoolManager_Call) Return(_a0 error) *PoolManagerController_DeleteEnterprisePoolManager_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PoolManagerController_DeleteEnterprisePoolManager_Call) RunAndReturn(run func(params.Enterprise) error) *PoolManagerController_DeleteEnterprisePoolManager_Call { + _c.Call.Return(run) + return _c +} + // DeleteOrgPoolManager provides a mock function with given fields: org func (_m *PoolManagerController) DeleteOrgPoolManager(org params.Organization) error { ret := _m.Called(org) @@ -145,6 +274,34 @@ func (_m *PoolManagerController) DeleteOrgPoolManager(org params.Organization) e return r0 } +// PoolManagerController_DeleteOrgPoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteOrgPoolManager' +type PoolManagerController_DeleteOrgPoolManager_Call struct { + *mock.Call +} + +// DeleteOrgPoolManager is a helper method to define mock.On call +// - org params.Organization +func (_e *PoolManagerController_Expecter) DeleteOrgPoolManager(org interface{}) *PoolManagerController_DeleteOrgPoolManager_Call { + return &PoolManagerController_DeleteOrgPoolManager_Call{Call: _e.mock.On("DeleteOrgPoolManager", org)} +} + +func (_c *PoolManagerController_DeleteOrgPoolManager_Call) Run(run func(org params.Organization)) *PoolManagerController_DeleteOrgPoolManager_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(params.Organization)) + }) + return _c +} + +func (_c *PoolManagerController_DeleteOrgPoolManager_Call) Return(_a0 error) *PoolManagerController_DeleteOrgPoolManager_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PoolManagerController_DeleteOrgPoolManager_Call) RunAndReturn(run func(params.Organization) error) *PoolManagerController_DeleteOrgPoolManager_Call { + _c.Call.Return(run) + return _c +} + // DeleteRepoPoolManager provides a mock function with given fields: repo func (_m *PoolManagerController) DeleteRepoPoolManager(repo params.Repository) error { ret := _m.Called(repo) @@ -163,6 +320,34 @@ func (_m *PoolManagerController) DeleteRepoPoolManager(repo params.Repository) e return r0 } +// PoolManagerController_DeleteRepoPoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteRepoPoolManager' +type PoolManagerController_DeleteRepoPoolManager_Call struct { + *mock.Call +} + +// DeleteRepoPoolManager is a helper method to define mock.On call +// - repo params.Repository +func (_e *PoolManagerController_Expecter) DeleteRepoPoolManager(repo interface{}) *PoolManagerController_DeleteRepoPoolManager_Call { + return &PoolManagerController_DeleteRepoPoolManager_Call{Call: _e.mock.On("DeleteRepoPoolManager", repo)} +} + +func (_c *PoolManagerController_DeleteRepoPoolManager_Call) Run(run func(repo params.Repository)) *PoolManagerController_DeleteRepoPoolManager_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(params.Repository)) + }) + return _c +} + +func (_c *PoolManagerController_DeleteRepoPoolManager_Call) Return(_a0 error) *PoolManagerController_DeleteRepoPoolManager_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PoolManagerController_DeleteRepoPoolManager_Call) RunAndReturn(run func(params.Repository) error) *PoolManagerController_DeleteRepoPoolManager_Call { + _c.Call.Return(run) + return _c +} + // GetEnterprisePoolManager provides a mock function with given fields: enterprise func (_m *PoolManagerController) GetEnterprisePoolManager(enterprise params.Enterprise) (common.PoolManager, error) { ret := _m.Called(enterprise) @@ -193,6 +378,34 @@ func (_m *PoolManagerController) GetEnterprisePoolManager(enterprise params.Ente return r0, r1 } +// PoolManagerController_GetEnterprisePoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEnterprisePoolManager' +type PoolManagerController_GetEnterprisePoolManager_Call struct { + *mock.Call +} + +// GetEnterprisePoolManager is a helper method to define mock.On call +// - enterprise params.Enterprise +func (_e *PoolManagerController_Expecter) GetEnterprisePoolManager(enterprise interface{}) *PoolManagerController_GetEnterprisePoolManager_Call { + return &PoolManagerController_GetEnterprisePoolManager_Call{Call: _e.mock.On("GetEnterprisePoolManager", enterprise)} +} + +func (_c *PoolManagerController_GetEnterprisePoolManager_Call) Run(run func(enterprise params.Enterprise)) *PoolManagerController_GetEnterprisePoolManager_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(params.Enterprise)) + }) + return _c +} + +func (_c *PoolManagerController_GetEnterprisePoolManager_Call) Return(_a0 common.PoolManager, _a1 error) *PoolManagerController_GetEnterprisePoolManager_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoolManagerController_GetEnterprisePoolManager_Call) RunAndReturn(run func(params.Enterprise) (common.PoolManager, error)) *PoolManagerController_GetEnterprisePoolManager_Call { + _c.Call.Return(run) + return _c +} + // GetEnterprisePoolManagers provides a mock function with no fields func (_m *PoolManagerController) GetEnterprisePoolManagers() (map[string]common.PoolManager, error) { ret := _m.Called() @@ -223,6 +436,33 @@ func (_m *PoolManagerController) GetEnterprisePoolManagers() (map[string]common. return r0, r1 } +// PoolManagerController_GetEnterprisePoolManagers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEnterprisePoolManagers' +type PoolManagerController_GetEnterprisePoolManagers_Call struct { + *mock.Call +} + +// GetEnterprisePoolManagers is a helper method to define mock.On call +func (_e *PoolManagerController_Expecter) GetEnterprisePoolManagers() *PoolManagerController_GetEnterprisePoolManagers_Call { + return &PoolManagerController_GetEnterprisePoolManagers_Call{Call: _e.mock.On("GetEnterprisePoolManagers")} +} + +func (_c *PoolManagerController_GetEnterprisePoolManagers_Call) Run(run func()) *PoolManagerController_GetEnterprisePoolManagers_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PoolManagerController_GetEnterprisePoolManagers_Call) Return(_a0 map[string]common.PoolManager, _a1 error) *PoolManagerController_GetEnterprisePoolManagers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoolManagerController_GetEnterprisePoolManagers_Call) RunAndReturn(run func() (map[string]common.PoolManager, error)) *PoolManagerController_GetEnterprisePoolManagers_Call { + _c.Call.Return(run) + return _c +} + // GetOrgPoolManager provides a mock function with given fields: org func (_m *PoolManagerController) GetOrgPoolManager(org params.Organization) (common.PoolManager, error) { ret := _m.Called(org) @@ -253,6 +493,34 @@ func (_m *PoolManagerController) GetOrgPoolManager(org params.Organization) (com return r0, r1 } +// PoolManagerController_GetOrgPoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOrgPoolManager' +type PoolManagerController_GetOrgPoolManager_Call struct { + *mock.Call +} + +// GetOrgPoolManager is a helper method to define mock.On call +// - org params.Organization +func (_e *PoolManagerController_Expecter) GetOrgPoolManager(org interface{}) *PoolManagerController_GetOrgPoolManager_Call { + return &PoolManagerController_GetOrgPoolManager_Call{Call: _e.mock.On("GetOrgPoolManager", org)} +} + +func (_c *PoolManagerController_GetOrgPoolManager_Call) Run(run func(org params.Organization)) *PoolManagerController_GetOrgPoolManager_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(params.Organization)) + }) + return _c +} + +func (_c *PoolManagerController_GetOrgPoolManager_Call) Return(_a0 common.PoolManager, _a1 error) *PoolManagerController_GetOrgPoolManager_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoolManagerController_GetOrgPoolManager_Call) RunAndReturn(run func(params.Organization) (common.PoolManager, error)) *PoolManagerController_GetOrgPoolManager_Call { + _c.Call.Return(run) + return _c +} + // GetOrgPoolManagers provides a mock function with no fields func (_m *PoolManagerController) GetOrgPoolManagers() (map[string]common.PoolManager, error) { ret := _m.Called() @@ -283,6 +551,33 @@ func (_m *PoolManagerController) GetOrgPoolManagers() (map[string]common.PoolMan return r0, r1 } +// PoolManagerController_GetOrgPoolManagers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOrgPoolManagers' +type PoolManagerController_GetOrgPoolManagers_Call struct { + *mock.Call +} + +// GetOrgPoolManagers is a helper method to define mock.On call +func (_e *PoolManagerController_Expecter) GetOrgPoolManagers() *PoolManagerController_GetOrgPoolManagers_Call { + return &PoolManagerController_GetOrgPoolManagers_Call{Call: _e.mock.On("GetOrgPoolManagers")} +} + +func (_c *PoolManagerController_GetOrgPoolManagers_Call) Run(run func()) *PoolManagerController_GetOrgPoolManagers_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PoolManagerController_GetOrgPoolManagers_Call) Return(_a0 map[string]common.PoolManager, _a1 error) *PoolManagerController_GetOrgPoolManagers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoolManagerController_GetOrgPoolManagers_Call) RunAndReturn(run func() (map[string]common.PoolManager, error)) *PoolManagerController_GetOrgPoolManagers_Call { + _c.Call.Return(run) + return _c +} + // GetRepoPoolManager provides a mock function with given fields: repo func (_m *PoolManagerController) GetRepoPoolManager(repo params.Repository) (common.PoolManager, error) { ret := _m.Called(repo) @@ -313,6 +608,34 @@ func (_m *PoolManagerController) GetRepoPoolManager(repo params.Repository) (com return r0, r1 } +// PoolManagerController_GetRepoPoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRepoPoolManager' +type PoolManagerController_GetRepoPoolManager_Call struct { + *mock.Call +} + +// GetRepoPoolManager is a helper method to define mock.On call +// - repo params.Repository +func (_e *PoolManagerController_Expecter) GetRepoPoolManager(repo interface{}) *PoolManagerController_GetRepoPoolManager_Call { + return &PoolManagerController_GetRepoPoolManager_Call{Call: _e.mock.On("GetRepoPoolManager", repo)} +} + +func (_c *PoolManagerController_GetRepoPoolManager_Call) Run(run func(repo params.Repository)) *PoolManagerController_GetRepoPoolManager_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(params.Repository)) + }) + return _c +} + +func (_c *PoolManagerController_GetRepoPoolManager_Call) Return(_a0 common.PoolManager, _a1 error) *PoolManagerController_GetRepoPoolManager_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoolManagerController_GetRepoPoolManager_Call) RunAndReturn(run func(params.Repository) (common.PoolManager, error)) *PoolManagerController_GetRepoPoolManager_Call { + _c.Call.Return(run) + return _c +} + // GetRepoPoolManagers provides a mock function with no fields func (_m *PoolManagerController) GetRepoPoolManagers() (map[string]common.PoolManager, error) { ret := _m.Called() @@ -343,6 +666,33 @@ func (_m *PoolManagerController) GetRepoPoolManagers() (map[string]common.PoolMa return r0, r1 } +// PoolManagerController_GetRepoPoolManagers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRepoPoolManagers' +type PoolManagerController_GetRepoPoolManagers_Call struct { + *mock.Call +} + +// GetRepoPoolManagers is a helper method to define mock.On call +func (_e *PoolManagerController_Expecter) GetRepoPoolManagers() *PoolManagerController_GetRepoPoolManagers_Call { + return &PoolManagerController_GetRepoPoolManagers_Call{Call: _e.mock.On("GetRepoPoolManagers")} +} + +func (_c *PoolManagerController_GetRepoPoolManagers_Call) Run(run func()) *PoolManagerController_GetRepoPoolManagers_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PoolManagerController_GetRepoPoolManagers_Call) Return(_a0 map[string]common.PoolManager, _a1 error) *PoolManagerController_GetRepoPoolManagers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoolManagerController_GetRepoPoolManagers_Call) RunAndReturn(run func() (map[string]common.PoolManager, error)) *PoolManagerController_GetRepoPoolManagers_Call { + _c.Call.Return(run) + return _c +} + // NewPoolManagerController creates a new instance of PoolManagerController. 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 NewPoolManagerController(t interface { diff --git a/testdata/config.toml b/testdata/config.toml index ee85ee33..337c0dd6 100644 --- a/testdata/config.toml +++ b/testdata/config.toml @@ -82,6 +82,8 @@ time_to_live = "8760h" certificate = "" # The path on disk to the corresponding private key for the certificate. key = "" + [apiserver.webui] + enable = true [database] # Turn on/off debugging for database queries. diff --git a/util/util.go b/util/util.go index da1264d2..994e4637 100644 --- a/util/util.go +++ b/util/util.go @@ -17,6 +17,7 @@ package util import ( "context" "net/http" + "unicode/utf8" "github.com/pkg/errors" @@ -43,3 +44,70 @@ func FetchTools(ctx context.Context, cli common.GithubClient) ([]commonParams.Ru } return ret, nil } + +func ASCIIEqualFold(s, t string) bool { + // Fast ASCII path for equal-length ASCII strings + if len(s) == len(t) && isASCII(s) && isASCII(t) { + for i := 0; i < len(s); i++ { + a, b := s[i], t[i] + if a != b { + if 'A' <= a && a <= 'Z' { + a = a + 'a' - 'A' + } + if 'A' <= b && b <= 'Z' { + b = b + 'a' - 'A' + } + if a != b { + return false + } + } + } + return true + } + + // UTF-8 path - handle different byte lengths correctly + i, j := 0, 0 + for i < len(s) && j < len(t) { + sr, sizeS := utf8.DecodeRuneInString(s[i:]) + tr, sizeT := utf8.DecodeRuneInString(t[j:]) + + // Handle invalid UTF-8 - they must be identical + if sr == utf8.RuneError || tr == utf8.RuneError { + // For invalid UTF-8, compare the raw bytes + if sr == utf8.RuneError && tr == utf8.RuneError { + if sizeS == sizeT && s[i:i+sizeS] == t[j:j+sizeT] { + i += sizeS + j += sizeT + continue + } + } + return false + } + + if sr != tr { + // Apply ASCII case folding only + if 'A' <= sr && sr <= 'Z' { + sr = sr + 'a' - 'A' + } + if 'A' <= tr && tr <= 'Z' { + tr = tr + 'a' - 'A' + } + if sr != tr { + return false + } + } + + i += sizeS + j += sizeT + } + return i == len(s) && j == len(t) +} + +func isASCII(s string) bool { + for i := 0; i < len(s); i++ { + if s[i] >= 0x80 { + return false + } + } + return true +} diff --git a/util/util_test.go b/util/util_test.go new file mode 100644 index 00000000..f04dab84 --- /dev/null +++ b/util/util_test.go @@ -0,0 +1,394 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +package util + +import ( + "testing" +) + +func TestASCIIEqualFold(t *testing.T) { + tests := []struct { + name string + s string + t string + expected bool + reason string + }{ + // Basic ASCII case folding tests + { + name: "identical strings", + s: "hello", + t: "hello", + expected: true, + reason: "identical strings should match", + }, + { + name: "simple case difference", + s: "Hello", + t: "hello", + expected: true, + reason: "ASCII case folding should match H/h", + }, + { + name: "all uppercase vs lowercase", + s: "HELLO", + t: "hello", + expected: true, + reason: "ASCII case folding should match all cases", + }, + { + name: "mixed case", + s: "HeLLo", + t: "hEllO", + expected: true, + reason: "mixed case should match after folding", + }, + + // Empty string tests + { + name: "both empty", + s: "", + t: "", + expected: true, + reason: "empty strings should match", + }, + { + name: "one empty", + s: "hello", + t: "", + expected: false, + reason: "different length strings should not match", + }, + { + name: "other empty", + s: "", + t: "hello", + expected: false, + reason: "different length strings should not match", + }, + + // Different content tests + { + name: "different strings same case", + s: "hello", + t: "world", + expected: false, + reason: "different content should not match", + }, + { + name: "different strings different case", + s: "Hello", + t: "World", + expected: false, + reason: "different content should not match regardless of case", + }, + { + name: "different length", + s: "hello", + t: "hello world", + expected: false, + reason: "different length strings should not match", + }, + + // ASCII non-alphabetic characters + { + name: "numbers and symbols", + s: "Hello123!@#", + t: "hello123!@#", + expected: true, + reason: "numbers and symbols should be preserved, only letters folded", + }, + { + name: "different numbers", + s: "Hello123", + t: "Hello124", + expected: false, + reason: "different numbers should not match", + }, + { + name: "different symbols", + s: "Hello!", + t: "Hello?", + expected: false, + reason: "different symbols should not match", + }, + + // URL-specific tests (CORS security focus) + { + name: "HTTP scheme case", + s: "HTTP://example.com", + t: "http://example.com", + expected: true, + reason: "HTTP scheme should be case-insensitive", + }, + { + name: "HTTPS scheme case", + s: "HTTPS://EXAMPLE.COM", + t: "https://example.com", + expected: true, + reason: "HTTPS scheme and domain should be case-insensitive", + }, + { + name: "complex URL case", + s: "HTTPS://API.EXAMPLE.COM:8080/PATH", + t: "https://api.example.com:8080/path", + expected: true, + reason: "entire URL should be case-insensitive for ASCII", + }, + { + name: "subdomain case", + s: "https://API.SUB.EXAMPLE.COM", + t: "https://api.sub.example.com", + expected: true, + reason: "subdomains should be case-insensitive", + }, + + // Unicode security tests (homograph attack prevention) + { + name: "cyrillic homograph attack", + s: "https://еxample.com", // Cyrillic 'е' (U+0435) + t: "https://example.com", // Latin 'e' (U+0065) + expected: false, + reason: "should block Cyrillic homograph attack", + }, + { + name: "mixed cyrillic attack", + s: "https://ехample.com", // Cyrillic 'е' and 'х' + t: "https://example.com", // Latin 'e' and 'x' + expected: false, + reason: "should block mixed Cyrillic homograph attack", + }, + { + name: "cyrillic 'а' attack", + s: "https://exаmple.com", // Cyrillic 'а' (U+0430) + t: "https://example.com", // Latin 'a' (U+0061) + expected: false, + reason: "should block Cyrillic 'а' homograph attack", + }, + + // Unicode case folding security tests + { + name: "unicode case folding attack", + s: "https://CAFÉ.com", // Latin É (U+00C9) + t: "https://café.com", // Latin é (U+00E9) + expected: false, + reason: "should NOT perform Unicode case folding (security)", + }, + { + name: "turkish i attack", + s: "https://İSTANBUL.com", // Turkish İ (U+0130) + t: "https://istanbul.com", // Latin i + expected: false, + reason: "should NOT perform Turkish case folding", + }, + { + name: "german sharp s", + s: "https://GROß.com", // German ß (U+00DF) + t: "https://gross.com", // Expanded form + expected: false, + reason: "should NOT perform German ß expansion", + }, + + // Valid Unicode exact matches + { + name: "identical unicode", + s: "https://café.com", + t: "https://café.com", + expected: true, + reason: "identical Unicode strings should match", + }, + { + name: "identical cyrillic", + s: "https://пример.com", // Russian + t: "https://пример.com", // Russian + expected: true, + reason: "identical Cyrillic strings should match", + }, + { + name: "ascii part of unicode domain", + s: "HTTPS://café.COM", // ASCII parts should fold + t: "https://café.com", + expected: true, + reason: "ASCII parts should fold even in Unicode strings", + }, + + // Edge cases with UTF-8 + { + name: "different UTF-8 byte length same rune count", + s: "Café", // é is 2 bytes + t: "Café", // é is 2 bytes (same) + expected: true, + reason: "same Unicode content should match", + }, + { + name: "UTF-8 normalization difference", + s: "café\u0301", // é as e + combining acute (3 bytes for é part) + t: "café", // é as single character (2 bytes for é part) + expected: false, + reason: "different Unicode normalization should not match", + }, + { + name: "CRITICAL: current implementation flaw", + s: "ABC" + string([]byte{0xC3, 0xA9}), // ABC + é (2 bytes) = 5 bytes + t: "abc" + string([]byte{0xC3, 0xA9}), // abc + é (2 bytes) = 5 bytes + expected: true, + reason: "should match after ASCII folding (this should pass with correct implementation)", + }, + { + name: "invalid UTF-8 sequence", + s: "hello\xff", // Invalid UTF-8 + t: "hello\xff", // Invalid UTF-8 + expected: true, + reason: "identical invalid UTF-8 should match", + }, + { + name: "different invalid UTF-8", + s: "hello\xff", // Invalid UTF-8 + t: "hello\xfe", // Different invalid UTF-8 + expected: false, + reason: "different invalid UTF-8 should not match", + }, + + // ASCII boundary tests + { + name: "ascii boundary characters", + s: "A@Z[`a{z", // Test boundaries around A-Z + t: "a@z[`A{Z", + expected: true, + reason: "only A-Z should be folded, not punctuation", + }, + { + name: "digit boundaries", + s: "Test123ABC", + t: "test123abc", + expected: true, + reason: "digits should not be folded, only letters", + }, + + // Long string performance tests + { + name: "long ascii string", + s: "HTTP://" + repeatString("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 100) + ".COM", + t: "http://" + repeatString("abcdefghijklmnopqrstuvwxyz", 100) + ".com", + expected: true, + reason: "long ASCII strings should be handled efficiently", + }, + { + name: "long unicode string", + s: repeatString("CAFÉ", 100), + t: repeatString("CAFÉ", 100), // Same case - should match + expected: true, + reason: "long identical Unicode strings should match", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := ASCIIEqualFold(tt.s, tt.t) + if result != tt.expected { + t.Errorf("ASCIIEqualFold(%q, %q) = %v, expected %v\nReason: %s", + tt.s, tt.t, result, tt.expected, tt.reason) + } + }) + } +} + +// Helper function for generating long test strings +func repeatString(s string, count int) string { + if count <= 0 { + return "" + } + result := make([]byte, 0, len(s)*count) + for i := 0; i < count; i++ { + result = append(result, s...) + } + return string(result) +} + +// Benchmark tests for performance verification +func BenchmarkASCIIEqualFold(b *testing.B) { + benchmarks := []struct { + name string + s string + t string + }{ + { + name: "short_ascii_match", + s: "HTTP://EXAMPLE.COM", + t: "http://example.com", + }, + { + name: "short_ascii_nomatch", + s: "HTTP://EXAMPLE.COM", + t: "http://different.com", + }, + { + name: "long_ascii_match", + s: "HTTP://" + repeatString("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 100) + ".COM", + t: "http://" + repeatString("abcdefghijklmnopqrstuvwxyz", 100) + ".com", + }, + { + name: "unicode_nomatch", + s: "https://café.com", + t: "https://CAFÉ.com", + }, + { + name: "unicode_exact_match", + s: "https://café.com", + t: "https://café.com", + }, + } + + for _, bm := range benchmarks { + b.Run(bm.name, func(b *testing.B) { + for i := 0; i < b.N; i++ { + ASCIIEqualFold(bm.s, bm.t) + } + }) + } +} + +// Fuzzing test to catch edge cases +func FuzzASCIIEqualFold(f *testing.F) { + // Seed with interesting test cases + seeds := [][]string{ + {"hello", "HELLO"}, + {"", ""}, + {"café", "CAFÉ"}, + {"https://example.com", "HTTPS://EXAMPLE.COM"}, + {"еxample", "example"}, // Cyrillic attack + {string([]byte{0xff}), string([]byte{0xfe})}, // Invalid UTF-8 + } + + for _, seed := range seeds { + f.Add(seed[0], seed[1]) + } + + f.Fuzz(func(t *testing.T, s1, s2 string) { + // Just ensure it doesn't panic and returns a boolean + result := ASCIIEqualFold(s1, s2) + _ = result // Use the result to prevent optimization + + // Property: function should be symmetric + if ASCIIEqualFold(s1, s2) != ASCIIEqualFold(s2, s1) { + t.Errorf("ASCIIEqualFold is not symmetric: (%q, %q)", s1, s2) + } + + // Property: identical strings should always match + if s1 == s2 && !ASCIIEqualFold(s1, s2) { + t.Errorf("identical strings should match: %q", s1) + } + }) +} diff --git a/vendor/github.com/go-openapi/jsonpointer/.golangci.yml b/vendor/github.com/go-openapi/jsonpointer/.golangci.yml index d2fafb8a..50063062 100644 --- a/vendor/github.com/go-openapi/jsonpointer/.golangci.yml +++ b/vendor/github.com/go-openapi/jsonpointer/.golangci.yml @@ -1,56 +1,62 @@ -linters-settings: - gocyclo: - min-complexity: 45 - dupl: - threshold: 200 - goconst: - min-len: 2 - min-occurrences: 3 - +version: "2" linters: - enable-all: true + default: all disable: - - recvcheck - - unparam - - lll - - gochecknoinits - - gochecknoglobals - - funlen - - godox - - gocognit - - whitespace - - wsl - - wrapcheck - - testpackage - - nlreturn - - errorlint - - nestif - - godot - - gofumpt - - paralleltest - - tparallel - - thelper - - exhaustruct - - varnamelen - - gci + - cyclop - depguard - errchkjson - - inamedparam - - nonamedreturns - - musttag - - ireturn + - errorlint + - exhaustruct - forcetypeassert - - cyclop - # deprecated linters - #- deadcode - #- interfacer - #- scopelint - #- varcheck - #- structcheck - #- golint - #- nosnakecase - #- maligned - #- goerr113 - #- ifshort - #- gomnd - #- exhaustivestruct + - funlen + - gochecknoglobals + - gochecknoinits + - gocognit + - godot + - godox + - gosmopolitan + - inamedparam + - ireturn + - lll + - musttag + - nestif + - nlreturn + - nonamedreturns + - paralleltest + - testpackage + - thelper + - tparallel + - unparam + - varnamelen + - whitespace + - wrapcheck + - wsl + settings: + dupl: + threshold: 200 + goconst: + min-len: 2 + min-occurrences: 3 + gocyclo: + min-complexity: 45 + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/vendor/github.com/go-openapi/jsonpointer/pointer.go b/vendor/github.com/go-openapi/jsonpointer/pointer.go index a08cd68a..61362105 100644 --- a/vendor/github.com/go-openapi/jsonpointer/pointer.go +++ b/vendor/github.com/go-openapi/jsonpointer/pointer.go @@ -179,6 +179,11 @@ func getSingleImpl(node any, decodedToken string, nameProvider *swag.NameProvide func setSingleImpl(node, data any, decodedToken string, nameProvider *swag.NameProvider) error { rValue := reflect.Indirect(reflect.ValueOf(node)) + // Check for nil to prevent panic when calling rValue.Type() + if isNil(node) { + return fmt.Errorf("cannot set field %q on nil value: %w", decodedToken, ErrPointer) + } + if ns, ok := node.(JSONSetable); ok { // pointer impl return ns.JSONSet(decodedToken, data) } @@ -285,6 +290,11 @@ func (p *Pointer) set(node, data any, nameProvider *swag.NameProvider) error { return setSingleImpl(node, data, decodedToken, nameProvider) } + // Check for nil during traversal + if isNil(node) { + return fmt.Errorf("cannot traverse through nil value at %q: %w", decodedToken, ErrPointer) + } + rValue := reflect.Indirect(reflect.ValueOf(node)) kind := rValue.Kind() diff --git a/vendor/github.com/mattn/go-sqlite3/README.md b/vendor/github.com/mattn/go-sqlite3/README.md index 3b43b033..76f49bac 100644 --- a/vendor/github.com/mattn/go-sqlite3/README.md +++ b/vendor/github.com/mattn/go-sqlite3/README.md @@ -351,6 +351,8 @@ For example the TDM-GCC Toolchain can be found [here](https://jmeubank.github.io # User Authentication +***This is deprecated*** + This package supports the SQLite User Authentication module. ## Compile diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c b/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c index e9cca66c..44d91d9d 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c @@ -1,7 +1,7 @@ #ifndef USE_LIBSQLITE3 /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.49.1. By combining all the individual C code files into this +** version 3.50.3. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -19,7 +19,7 @@ ** separate file. This file contains only code for the core SQLite library. ** ** The content in this amalgamation comes from Fossil check-in -** 873d4e274b4988d260ba8354a9718324a1c2 with changes in files: +** 3ce993b8657d6d9deda380a93cdd6404a8c8 with changes in files: ** ** */ @@ -453,7 +453,7 @@ extern "C" { ** ** Since [version 3.6.18] ([dateof:3.6.18]), ** SQLite source code has been stored in the -** Fossil configuration management +** Fossil configuration management ** system. ^The SQLITE_SOURCE_ID macro evaluates to ** a string which identifies a particular check-in of SQLite ** within its configuration management system. ^The SQLITE_SOURCE_ID @@ -466,9 +466,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.49.1" -#define SQLITE_VERSION_NUMBER 3049001 -#define SQLITE_SOURCE_ID "2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f10e70" +#define SQLITE_VERSION "3.50.3" +#define SQLITE_VERSION_NUMBER 3050003 +#define SQLITE_SOURCE_ID "2025-07-17 13:25:10 3ce993b8657d6d9deda380a93cdd6404a8c8ba1b185b2bc423703e41ae5f2543" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -1483,6 +1483,12 @@ struct sqlite3_io_methods { ** the value that M is to be set to. Before returning, the 32-bit signed ** integer is overwritten with the previous value of M. ** +**
  • [[SQLITE_FCNTL_BLOCK_ON_CONNECT]] +** The [SQLITE_FCNTL_BLOCK_ON_CONNECT] opcode is used to configure the +** VFS to block when taking a SHARED lock to connect to a wal mode database. +** This is used to implement the functionality associated with +** SQLITE_SETLK_BLOCK_ON_CONNECT. +** **
  • [[SQLITE_FCNTL_DATA_VERSION]] ** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to ** a database file. The argument is a pointer to a 32-bit unsigned integer. @@ -1579,6 +1585,7 @@ struct sqlite3_io_methods { #define SQLITE_FCNTL_CKSM_FILE 41 #define SQLITE_FCNTL_RESET_CACHE 42 #define SQLITE_FCNTL_NULL_IO 43 +#define SQLITE_FCNTL_BLOCK_ON_CONNECT 44 /* deprecated names */ #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE @@ -2309,13 +2316,16 @@ struct sqlite3_mem_methods { ** ** [[SQLITE_CONFIG_LOOKASIDE]]
    SQLITE_CONFIG_LOOKASIDE
    **
    ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine -** the default size of lookaside memory on each [database connection]. +** the default size of [lookaside memory] on each [database connection]. ** The first argument is the -** size of each lookaside buffer slot and the second is the number of -** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE -** sets the default lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE] -** option to [sqlite3_db_config()] can be used to change the lookaside -** configuration on individual connections.)^
    +** size of each lookaside buffer slot ("sz") and the second is the number of +** slots allocated to each database connection ("cnt").)^ +** ^(SQLITE_CONFIG_LOOKASIDE sets the default lookaside size. +** The [SQLITE_DBCONFIG_LOOKASIDE] option to [sqlite3_db_config()] can +** be used to change the lookaside configuration on individual connections.)^ +** The [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to change the +** default lookaside configuration at compile-time. +** ** ** [[SQLITE_CONFIG_PCACHE2]]
    SQLITE_CONFIG_PCACHE2
    **
    ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is @@ -2552,31 +2562,50 @@ struct sqlite3_mem_methods { ** [[SQLITE_DBCONFIG_LOOKASIDE]] **
    SQLITE_DBCONFIG_LOOKASIDE
    **
    The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the -** configuration of the lookaside memory allocator within a database +** configuration of the [lookaside memory allocator] within a database ** connection. ** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are not ** in the [DBCONFIG arguments|usual format]. ** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two, ** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE ** should have a total of five parameters. -** ^The first argument (the third parameter to [sqlite3_db_config()] is a +**
      +**
    1. The first argument ("buf") is a ** pointer to a memory buffer to use for lookaside memory. -** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb -** may be NULL in which case SQLite will allocate the -** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the -** size of each lookaside buffer slot. ^The third argument is the number of -** slots. The size of the buffer in the first argument must be greater than -** or equal to the product of the second and third arguments. The buffer -** must be aligned to an 8-byte boundary. ^If the second argument to -** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally -** rounded down to the next smaller multiple of 8. ^(The lookaside memory +** The first argument may be NULL in which case SQLite will allocate the +** lookaside buffer itself using [sqlite3_malloc()]. +**

    2. The second argument ("sz") is the +** size of each lookaside buffer slot. Lookaside is disabled if "sz" +** is less than 8. The "sz" argument should be a multiple of 8 less than +** 65536. If "sz" does not meet this constraint, it is reduced in size until +** it does. +**

    3. The third argument ("cnt") is the number of slots. Lookaside is disabled +** if "cnt"is less than 1. The "cnt" value will be reduced, if necessary, so +** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt" +** parameter is usually chosen so that the product of "sz" and "cnt" is less +** than 1,000,000. +**

    +**

    If the "buf" argument is not NULL, then it must +** point to a memory buffer with a size that is greater than +** or equal to the product of "sz" and "cnt". +** The buffer must be aligned to an 8-byte boundary. +** The lookaside memory ** configuration for a database connection can only be changed when that ** connection is not currently using lookaside memory, or in other words -** when the "current value" returned by -** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero. +** when the value returned by [SQLITE_DBSTATUS_LOOKASIDE_USED] is zero. ** Any attempt to change the lookaside memory configuration when lookaside ** memory is in use leaves the configuration unchanged and returns -** [SQLITE_BUSY].)^

    +** [SQLITE_BUSY]. +** If the "buf" argument is NULL and an attempt +** to allocate memory based on "sz" and "cnt" fails, then +** lookaside is silently disabled. +**

    +** The [SQLITE_CONFIG_LOOKASIDE] configuration option can be used to set the +** default lookaside configuration at initialization. The +** [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to set the default lookaside +** configuration at compile-time. Typical values for lookaside are 1200 for +** "sz" and 40 to 100 for "cnt". +** ** ** [[SQLITE_DBCONFIG_ENABLE_FKEY]] **

    SQLITE_DBCONFIG_ENABLE_FKEY
    @@ -3313,6 +3342,44 @@ SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*); */ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); +/* +** CAPI3REF: Set the Setlk Timeout +** METHOD: sqlite3 +** +** This routine is only useful in SQLITE_ENABLE_SETLK_TIMEOUT builds. If +** the VFS supports blocking locks, it sets the timeout in ms used by +** eligible locks taken on wal mode databases by the specified database +** handle. In non-SQLITE_ENABLE_SETLK_TIMEOUT builds, or if the VFS does +** not support blocking locks, this function is a no-op. +** +** Passing 0 to this function disables blocking locks altogether. Passing +** -1 to this function requests that the VFS blocks for a long time - +** indefinitely if possible. The results of passing any other negative value +** are undefined. +** +** Internally, each SQLite database handle store two timeout values - the +** busy-timeout (used for rollback mode databases, or if the VFS does not +** support blocking locks) and the setlk-timeout (used for blocking locks +** on wal-mode databases). The sqlite3_busy_timeout() method sets both +** values, this function sets only the setlk-timeout value. Therefore, +** to configure separate busy-timeout and setlk-timeout values for a single +** database handle, call sqlite3_busy_timeout() followed by this function. +** +** Whenever the number of connections to a wal mode database falls from +** 1 to 0, the last connection takes an exclusive lock on the database, +** then checkpoints and deletes the wal file. While it is doing this, any +** new connection that tries to read from the database fails with an +** SQLITE_BUSY error. Or, if the SQLITE_SETLK_BLOCK_ON_CONNECT flag is +** passed to this API, the new connection blocks until the exclusive lock +** has been released. +*/ +SQLITE_API int sqlite3_setlk_timeout(sqlite3*, int ms, int flags); + +/* +** CAPI3REF: Flags for sqlite3_setlk_timeout() +*/ +#define SQLITE_SETLK_BLOCK_ON_CONNECT 0x01 + /* ** CAPI3REF: Convenience Routines For Running Queries ** METHOD: sqlite3 @@ -4332,7 +4399,7 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*); ** ** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of ** database filename D with corresponding journal file J and WAL file W and -** with N URI parameters key/values pairs in the array P. The result from +** an array P of N URI Key/Value pairs. The result from ** sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that ** is safe to pass to routines like: **