Documentation ¶
Index ¶
- type LoggingCache
- func (c *LoggingCache) Clear(_ context.Context) error
- func (c *LoggingCache) CloseAndRemove(_ context.Context, id string) error
- func (c *LoggingCache) Create(id string, opts *options.Output) (*options.CachedLogger, error)
- func (c *LoggingCache) Get(id string) *options.CachedLogger
- func (c *LoggingCache) Len() int
- func (c *LoggingCache) Prune(lastAccessed time.Time)
- func (c *LoggingCache) Put(id string, logger *options.CachedLogger) error
- func (c *LoggingCache) Remove(id string)
- type Manager
- func (m *Manager) Clear(ctx context.Context)
- func (m *Manager) Close(ctx context.Context) error
- func (m *Manager) CreateCommand(ctx context.Context) *jasper.Command
- func (m *Manager) CreateProcess(ctx context.Context, opts *options.Create) (jasper.Process, error)
- func (m *Manager) Get(ctx context.Context, id string) (jasper.Process, error)
- func (m *Manager) Group(ctx context.Context, tag string) ([]jasper.Process, error)
- func (m *Manager) ID() string
- func (m *Manager) List(ctx context.Context, f options.Filter) ([]jasper.Process, error)
- func (m *Manager) LoggingCache(ctx context.Context) jasper.LoggingCache
- func (m *Manager) Register(ctx context.Context, proc jasper.Process) error
- func (m *Manager) WriteFile(ctx context.Context, opts options.WriteFile) error
- type Process
- func (p *Process) Complete(ctx context.Context) bool
- func (p *Process) GetTags() []string
- func (p *Process) ID() string
- func (p *Process) Info(ctx context.Context) jasper.ProcessInfo
- func (p *Process) RegisterSignalTrigger(ctx context.Context, t jasper.SignalTrigger) error
- func (p *Process) RegisterSignalTriggerID(ctx context.Context, sigID jasper.SignalTriggerID) error
- func (p *Process) RegisterTrigger(ctx context.Context, t jasper.ProcessTrigger) error
- func (p *Process) ResetTags()
- func (p *Process) Respawn(ctx context.Context) (jasper.Process, error)
- func (p *Process) Running(ctx context.Context) bool
- func (p *Process) Signal(ctx context.Context, sig syscall.Signal) error
- func (p *Process) Tag(tag string)
- func (p *Process) Wait(ctx context.Context) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoggingCache ¶
type LoggingCache struct { Cache map[string]*options.CachedLogger AllowCreateOverwrite bool FailCreate bool AllowPutOverwrite bool FailPut bool }
LoggingCache implements the LoggingCache interfaces based on an in-memory logging cache with exported fields to configure and introspect the mock's behavior.
func (*LoggingCache) Clear ¶
func (c *LoggingCache) Clear(_ context.Context) error
Clear closes and removes all objects in the in-memory logging cache.
func (*LoggingCache) CloseAndRemove ¶
func (c *LoggingCache) CloseAndRemove(_ context.Context, id string) error
CloseAndRemove closes the cached logger and removes it from the in-memory logging cache.
func (*LoggingCache) Create ¶
func (c *LoggingCache) Create(id string, opts *options.Output) (*options.CachedLogger, error)
Create creates a cached logger from the given options.Output and stores it in the cache. If AllowCreateOverwrite is set, the newly created logger will overwrite an existing one with the same ID if it already exists. If FailCreate is set, it returns an error.
func (*LoggingCache) Get ¶
func (c *LoggingCache) Get(id string) *options.CachedLogger
Get returns an object from the in-memory logging cache.
func (*LoggingCache) Len ¶
func (c *LoggingCache) Len() int
Len returns the size of the in-memory logging cache.
func (*LoggingCache) Prune ¶
func (c *LoggingCache) Prune(lastAccessed time.Time)
Prune removes all items from the cache whose most recent access time is older than lastAccessed.
func (*LoggingCache) Put ¶
func (c *LoggingCache) Put(id string, logger *options.CachedLogger) error
Put adds the given cached logger with the given ID to the cache. If AllowPutOverwrite is set, the given logger will overwrite an existing one with the same ID if it already exists. If FailPut is set, it returns an error.
func (*LoggingCache) Remove ¶
func (c *LoggingCache) Remove(id string)
Remove removes an object from the in-memory logging cache.
type Manager ¶
type Manager struct { FailCreate bool FailRegister bool FailList bool FailGroup bool FailGet bool FailClose bool NilLoggingCache bool FailWriteFile bool Create func(*options.Create) Process CreateConfig Process ManagerID string Procs []jasper.Process ScriptingEnv scripting.Harness LoggingCacheVal jasper.LoggingCache // WriteFile input WriteFileOptions options.WriteFile }
Manager implements the Manager interface with exported fields to configure and introspect the mock's behavior.
func (*Manager) Close ¶
Close clears all processes in Procs. If FailClose is set, it returns an error.
func (*Manager) CreateCommand ¶
CreateCommand creates a Command that invokes CreateProcess to create the underlying processes.
func (*Manager) CreateProcess ¶
CreateProcess creates a new mock Process. If Create is set, it is invoked to create the mock Process. Otherwise, CreateConfig is used as a template to create the mock Process. The new mock Process is put in Procs. If FailCreate is set, it returns an error.
func (*Manager) Get ¶
Get returns a process given by ID from Procs. If a matching process is not found in Procs or if FailGet is set, it returns an error.
func (*Manager) Group ¶
Group returns all processses that have the given tag. If FailGroup is set, it returns an error.
func (*Manager) List ¶
List returns all processes that match the given filter. If FailList is set, it returns an error.
func (*Manager) LoggingCache ¶
func (m *Manager) LoggingCache(ctx context.Context) jasper.LoggingCache
LoggingCache returns the implementation's logging cache.
type Process ¶
type Process struct { FailRespawn bool FailRegisterTrigger bool FailRegisterSignalTrigger bool FailRegisterSignalTriggerID bool FailSignal bool FailWait bool WaitExitCode int ProcInfo jasper.ProcessInfo Triggers jasper.ProcessTriggerSequence `json:"-"` SignalTriggers jasper.SignalTriggerSequence `json:"-"` SignalTriggerIDs []jasper.SignalTriggerID Signals []syscall.Signal Tags []string }
Process implements the Process interface with exported fields to configure and introspect the mock's behavior.
func (*Process) Info ¶
func (p *Process) Info(ctx context.Context) jasper.ProcessInfo
Info returns the ProcInfo set by the user.
func (*Process) RegisterSignalTrigger ¶
RegisterSignalTrigger records the signal trigger in SignalTriggers. If FailRegisterSignalTrigger is set, it returns an error.
func (*Process) RegisterSignalTriggerID ¶
RegisterSignalTriggerID records the ID of the signal trigger in SignalTriggers. If FailRegisterSignalTriggerID is set, it returns an error.
func (*Process) RegisterTrigger ¶
RegisterTrigger records the trigger in Triggers. If FailRegisterTrigger is set, it returns an error.
func (*Process) ResetTags ¶
func (p *Process) ResetTags()
ResetTags removes all tags stored in Tags.
func (*Process) Respawn ¶
Respawn creates a new Process, which has a copy of all the fields in the current Process. If FailRespawn is set, it returns an error.