testtask

package
v0.0.3-beta.9 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoClose

type AutoClose struct {
	// contains filtered or unexported fields
}

AutoClose simulates a task that starts and then fails with an error after a delay.

func NewAutoClose

func NewAutoClose() *AutoClose

func NewAutoCloseWithDelay

func NewAutoCloseWithDelay(delay time.Duration) *AutoClose

func (*AutoClose) Identifier

func (a *AutoClose) Identifier() string

func (*AutoClose) Start

func (a *AutoClose) Start(ctx context.Context) error

func (*AutoClose) Stop

func (a *AutoClose) Stop(ctx context.Context) error

type AutoPanic

type AutoPanic struct {
	// contains filtered or unexported fields
}

AutoPanic simulates a task that panics during startup.

func NewAutoPanic

func NewAutoPanic() *AutoPanic

func NewAutoPanicWithDelay

func NewAutoPanicWithDelay(delay time.Duration) *AutoPanic

func (*AutoPanic) Identifier

func (a *AutoPanic) Identifier() string

func (*AutoPanic) Start

func (a *AutoPanic) Start(ctx context.Context) error

func (*AutoPanic) Stop

func (a *AutoPanic) Stop(ctx context.Context) error

type ContextAwareTask

type ContextAwareTask struct {
	// contains filtered or unexported fields
}

ContextAwareTask simulates a task that properly respects context cancellation.

func NewContextAwareTask

func NewContextAwareTask(id string) *ContextAwareTask

func (*ContextAwareTask) Identifier

func (c *ContextAwareTask) Identifier() string

func (*ContextAwareTask) IsStarted

func (c *ContextAwareTask) IsStarted() bool

func (*ContextAwareTask) IsStopped

func (c *ContextAwareTask) IsStopped() bool

func (*ContextAwareTask) Start

func (c *ContextAwareTask) Start(ctx context.Context) error

func (*ContextAwareTask) Stop

func (c *ContextAwareTask) Stop(ctx context.Context) error

type FailingStartTask

type FailingStartTask struct {
	// contains filtered or unexported fields
}

FailingStartTask simulates a task that fails to start immediately.

func NewFailingStartTask

func NewFailingStartTask(id string, err error) *FailingStartTask

func (*FailingStartTask) Identifier

func (f *FailingStartTask) Identifier() string

func (*FailingStartTask) IsStopped

func (f *FailingStartTask) IsStopped() bool

func (*FailingStartTask) Start

func (f *FailingStartTask) Start(ctx context.Context) error

func (*FailingStartTask) Stop

func (f *FailingStartTask) Stop(ctx context.Context) error

type FailingStopTask

type FailingStopTask struct {
	// contains filtered or unexported fields
}

FailingStopTask simulates a task that fails to stop gracefully.

func NewFailingStopTask

func NewFailingStopTask(id string, stopError error) *FailingStopTask

func (*FailingStopTask) Identifier

func (f *FailingStopTask) Identifier() string

func (*FailingStopTask) IsStarted

func (f *FailingStopTask) IsStarted() bool

func (*FailingStopTask) IsStopped

func (f *FailingStopTask) IsStopped() bool

func (*FailingStopTask) Start

func (f *FailingStopTask) Start(ctx context.Context) error

func (*FailingStopTask) Stop

func (f *FailingStopTask) Stop(ctx context.Context) error

type ServerExample

type ServerExample struct {
	// contains filtered or unexported fields
}

ServerExample simulates a long-running HTTP server task.

func NewServerExample

func NewServerExample() *ServerExample

func (*ServerExample) Identifier

func (s *ServerExample) Identifier() string

func (*ServerExample) Start

func (s *ServerExample) Start(ctx context.Context) error

func (*ServerExample) Stop

func (s *ServerExample) Stop(ctx context.Context) error

type SlowStartTask

type SlowStartTask struct {
	// contains filtered or unexported fields
}

SlowStartTask simulates a task with slow startup.

func NewSlowStartTask

func NewSlowStartTask(id string, startTime time.Duration) *SlowStartTask

func (*SlowStartTask) Identifier

func (s *SlowStartTask) Identifier() string

func (*SlowStartTask) IsStarted

func (s *SlowStartTask) IsStarted() bool

func (*SlowStartTask) IsStopped

func (s *SlowStartTask) IsStopped() bool

func (*SlowStartTask) Start

func (s *SlowStartTask) Start(ctx context.Context) error

func (*SlowStartTask) Stop

func (s *SlowStartTask) Stop(ctx context.Context) error

type SlowStopTask

type SlowStopTask struct {
	// contains filtered or unexported fields
}

SlowStopTask simulates a task that takes time to stop.

func NewSlowStopTask

func NewSlowStopTask(id string, stopTime time.Duration) *SlowStopTask

func (*SlowStopTask) Identifier

func (s *SlowStopTask) Identifier() string

func (*SlowStopTask) IsStarted

func (s *SlowStopTask) IsStarted() bool

func (*SlowStopTask) IsStopped

func (s *SlowStopTask) IsStopped() bool

func (*SlowStopTask) Start

func (s *SlowStopTask) Start(ctx context.Context) error

func (*SlowStopTask) Stop

func (s *SlowStopTask) Stop(ctx context.Context) error

type SuccessTask

type SuccessTask struct {
	// contains filtered or unexported fields
}

SuccessTask simulates a task that starts successfully and runs until stopped.

func NewSuccessTask

func NewSuccessTask(id string) *SuccessTask

func (*SuccessTask) Identifier

func (s *SuccessTask) Identifier() string

func (*SuccessTask) IsStarted

func (s *SuccessTask) IsStarted() bool

func (*SuccessTask) IsStopped

func (s *SuccessTask) IsStopped() bool

func (*SuccessTask) Start

func (s *SuccessTask) Start(ctx context.Context) error

func (*SuccessTask) Stop

func (s *SuccessTask) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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