fakes

package
v0.0.0-...-fb7f86c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeBackendPlugin

type FakeBackendPlugin struct {
	Managed bool

	StartCount     int
	StopCount      int
	Decommissioned bool
	Running        bool

	backendplugin.Plugin
	// contains filtered or unexported fields
}

func NewFakeBackendPlugin

func NewFakeBackendPlugin(managed bool) *FakeBackendPlugin

func (*FakeBackendPlugin) Decommission

func (p *FakeBackendPlugin) Decommission() error

func (*FakeBackendPlugin) Exited

func (p *FakeBackendPlugin) Exited() bool

func (*FakeBackendPlugin) IsDecommissioned

func (p *FakeBackendPlugin) IsDecommissioned() bool

func (*FakeBackendPlugin) IsManaged

func (p *FakeBackendPlugin) IsManaged() bool

func (*FakeBackendPlugin) Kill

func (p *FakeBackendPlugin) Kill()

func (*FakeBackendPlugin) Start

func (p *FakeBackendPlugin) Start(_ context.Context) error

func (*FakeBackendPlugin) Stop

type FakeBackendProcessProvider

type FakeBackendProcessProvider struct {
	Requested          map[string]int
	Invoked            map[string]int
	BackendFactoryFunc func(context.Context, *plugins.Plugin) backendplugin.PluginFactoryFunc
}

func NewFakeBackendProcessProvider

func NewFakeBackendProcessProvider() *FakeBackendProcessProvider

func (*FakeBackendProcessProvider) BackendFactory

type FakeBootstrapper

type FakeBootstrapper struct {
	BootstrapFunc func(ctx context.Context, src plugins.PluginSource, bundles []*plugins.FoundBundle) ([]*plugins.Plugin, error)
}

func (*FakeBootstrapper) Bootstrap

func (f *FakeBootstrapper) Bootstrap(ctx context.Context, src plugins.PluginSource, bundles []*plugins.FoundBundle) ([]*plugins.Plugin, error)

type FakeDiscoverer

type FakeDiscoverer struct {
	DiscoverFunc func(ctx context.Context, src plugins.PluginSource) ([]*plugins.FoundBundle, error)
}

func (*FakeDiscoverer) Discover

type FakeInitializer

type FakeInitializer struct {
	IntializeFunc func(ctx context.Context, ps []*plugins.Plugin) ([]*plugins.Plugin, error)
}

func (*FakeInitializer) Initialize

func (f *FakeInitializer) Initialize(ctx context.Context, ps []*plugins.Plugin) ([]*plugins.Plugin, error)

type FakeLicensingService

type FakeLicensingService struct {
	LicenseEdition string
	TokenRaw       string
	LicensePath    string
	LicenseAppURL  string
}

func NewFakeLicensingService

func NewFakeLicensingService() *FakeLicensingService

func (*FakeLicensingService) AppURL

func (s *FakeLicensingService) AppURL() string

func (*FakeLicensingService) Edition

func (s *FakeLicensingService) Edition() string

func (*FakeLicensingService) Environment

func (s *FakeLicensingService) Environment() []string

func (*FakeLicensingService) Path

func (s *FakeLicensingService) Path() string

type FakeLoader

type FakeLoader struct {
	LoadFunc   func(_ context.Context, _ plugins.PluginSource) ([]*plugins.Plugin, error)
	UnloadFunc func(_ context.Context, _ *plugins.Plugin) (*plugins.Plugin, error)
}

func (*FakeLoader) Load

func (*FakeLoader) Unload

func (l *FakeLoader) Unload(ctx context.Context, p *plugins.Plugin) (*plugins.Plugin, error)

type FakeOauthService

type FakeOauthService struct {
	Result *oauth.ExternalService
}

func (*FakeOauthService) RegisterExternalService

func (f *FakeOauthService) RegisterExternalService(ctx context.Context, name string, svc *plugindef.ExternalServiceRegistration) (*oauth.ExternalService, error)

type FakePluginClient

type FakePluginClient struct {
	ID      string
	Managed bool
	Log     log.Logger

	backend.CollectMetricsHandlerFunc
	backend.CheckHealthHandlerFunc
	backend.QueryDataHandlerFunc
	backend.CallResourceHandlerFunc

	backendplugin.Plugin
	// contains filtered or unexported fields
}

func (*FakePluginClient) CallResource

func (*FakePluginClient) CheckHealth

func (*FakePluginClient) CollectMetrics

func (*FakePluginClient) Decommission

func (pc *FakePluginClient) Decommission() error

func (*FakePluginClient) Exited

func (pc *FakePluginClient) Exited() bool

func (*FakePluginClient) IsDecommissioned

func (pc *FakePluginClient) IsDecommissioned() bool

func (*FakePluginClient) IsManaged

func (pc *FakePluginClient) IsManaged() bool

func (*FakePluginClient) Logger

func (pc *FakePluginClient) Logger() log.Logger

func (*FakePluginClient) PluginID

func (pc *FakePluginClient) PluginID() string

func (*FakePluginClient) PublishStream

func (*FakePluginClient) QueryData

func (*FakePluginClient) RunStream

func (*FakePluginClient) Start

func (pc *FakePluginClient) Start(_ context.Context) error

func (*FakePluginClient) Stop

func (pc *FakePluginClient) Stop(_ context.Context) error

func (*FakePluginClient) SubscribeStream

type FakePluginFileStore

type FakePluginFileStore struct {
	FileFunc func(ctx context.Context, pluginID, filename string) (*plugins.File, error)
}

func (*FakePluginFileStore) File

func (f *FakePluginFileStore) File(ctx context.Context, pluginID, filename string) (*plugins.File, error)

type FakePluginFiles

type FakePluginFiles struct {
	OpenFunc   func(name string) (fs.File, error)
	RemoveFunc func() error
	// contains filtered or unexported fields
}

func NewFakePluginFiles

func NewFakePluginFiles(base string) *FakePluginFiles

func (*FakePluginFiles) Base

func (f *FakePluginFiles) Base() string

func (*FakePluginFiles) Files

func (f *FakePluginFiles) Files() ([]string, error)

func (*FakePluginFiles) Open

func (f *FakePluginFiles) Open(name string) (fs.File, error)

func (*FakePluginFiles) Remove

func (f *FakePluginFiles) Remove() error

type FakePluginInstaller

type FakePluginInstaller struct {
	AddFunc func(ctx context.Context, pluginID, version string, opts plugins.CompatOpts) error
	// Remove removes a plugin from the store.
	RemoveFunc func(ctx context.Context, pluginID string) error
}

func (*FakePluginInstaller) Add

func (i *FakePluginInstaller) Add(ctx context.Context, pluginID, version string, opts plugins.CompatOpts) error

func (*FakePluginInstaller) Remove

func (i *FakePluginInstaller) Remove(ctx context.Context, pluginID string) error

type FakePluginRegistry

type FakePluginRegistry struct {
	Store map[string]*plugins.Plugin
}

func NewFakePluginRegistry

func NewFakePluginRegistry() *FakePluginRegistry

func (*FakePluginRegistry) Add

func (*FakePluginRegistry) Plugin

func (*FakePluginRegistry) Plugins

func (f *FakePluginRegistry) Plugins(_ context.Context) []*plugins.Plugin

func (*FakePluginRegistry) Remove

func (f *FakePluginRegistry) Remove(_ context.Context, id string) error

type FakePluginRepo

type FakePluginRepo struct {
	GetPluginArchiveFunc      func(_ context.Context, pluginID, version string, _ repo.CompatOpts) (*repo.PluginArchive, error)
	GetPluginArchiveByURLFunc func(_ context.Context, archiveURL string, _ repo.CompatOpts) (*repo.PluginArchive, error)
	GetPluginArchiveInfoFunc  func(_ context.Context, pluginID, version string, _ repo.CompatOpts) (*repo.PluginArchiveInfo, error)
}

func (*FakePluginRepo) GetPluginArchive

func (r *FakePluginRepo) GetPluginArchive(ctx context.Context, pluginID, version string, opts repo.CompatOpts) (*repo.PluginArchive, error)

GetPluginArchive fetches the requested plugin archive.

func (*FakePluginRepo) GetPluginArchiveByURL

func (r *FakePluginRepo) GetPluginArchiveByURL(ctx context.Context, archiveURL string, opts repo.CompatOpts) (*repo.PluginArchive, error)

GetPluginArchiveByURL fetches the requested plugin from the specified URL.

func (*FakePluginRepo) GetPluginArchiveInfo

func (r *FakePluginRepo) GetPluginArchiveInfo(ctx context.Context, pluginID, version string, opts repo.CompatOpts) (*repo.PluginArchiveInfo, error)

GetPluginArchiveInfo fetches information for downloading the requested plugin.

type FakePluginSource

type FakePluginSource struct {
	PluginClassFunc      func(ctx context.Context) plugins.Class
	PluginURIsFunc       func(ctx context.Context) []string
	DefaultSignatureFunc func(ctx context.Context) (plugins.Signature, bool)
}

func (*FakePluginSource) DefaultSignature

func (s *FakePluginSource) DefaultSignature(ctx context.Context) (plugins.Signature, bool)

func (*FakePluginSource) PluginClass

func (s *FakePluginSource) PluginClass(ctx context.Context) plugins.Class

func (*FakePluginSource) PluginURIs

func (s *FakePluginSource) PluginURIs(ctx context.Context) []string

type FakePluginStorage

type FakePluginStorage struct {
	ExtractFunc func(_ context.Context, pluginID string, dirNameFunc storage.DirNameGeneratorFunc, z *zip.ReadCloser) (*storage.ExtractedPluginArchive, error)
}

func NewFakePluginStorage

func NewFakePluginStorage() *FakePluginStorage

func (*FakePluginStorage) Extract

type FakePluginStore

type FakePluginStore struct {
	PluginList []plugins.PluginDTO
}

func (*FakePluginStore) Plugin

func (pr *FakePluginStore) Plugin(_ context.Context, pluginID string) (plugins.PluginDTO, bool)

func (*FakePluginStore) Plugins

func (pr *FakePluginStore) Plugins(_ context.Context, pluginTypes ...plugins.Type) []plugins.PluginDTO

type FakeProcessManager

type FakeProcessManager struct {
	StartFunc func(_ context.Context, p *plugins.Plugin) error
	StopFunc  func(_ context.Context, p *plugins.Plugin) error
	Started   map[string]int
	Stopped   map[string]int
}

func NewFakeProcessManager

func NewFakeProcessManager() *FakeProcessManager

func (*FakeProcessManager) Start

func (*FakeProcessManager) Stop

type FakeRoleRegistry

type FakeRoleRegistry struct {
	ExpectedErr error
}

func NewFakeRoleRegistry

func NewFakeRoleRegistry() *FakeRoleRegistry

func (*FakeRoleRegistry) DeclarePluginRoles

func (f *FakeRoleRegistry) DeclarePluginRoles(_ context.Context, _ string, _ string, _ []plugins.RoleRegistration) error

type FakeSourceRegistry

type FakeSourceRegistry struct {
	ListFunc func(_ context.Context) []plugins.PluginSource
}

func (*FakeSourceRegistry) List

type FakeTerminator

type FakeTerminator struct {
	TerminateFunc func(ctx context.Context, p *plugins.Plugin) (*plugins.Plugin, error)
}

func (*FakeTerminator) Terminate

func (f *FakeTerminator) Terminate(ctx context.Context, p *plugins.Plugin) (*plugins.Plugin, error)

type FakeValidator

type FakeValidator struct {
	ValidateFunc func(ctx context.Context, ps []*plugins.Plugin) ([]*plugins.Plugin, error)
}

func (*FakeValidator) Validate

func (f *FakeValidator) Validate(ctx context.Context, ps []*plugins.Plugin) ([]*plugins.Plugin, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL