Documentation
¶
Overview ¶
Package support provides shared test harness helpers for E2E/BDD tests.
Index ¶
- func BinaryPath() (string, error)
- func CleanupBinary()
- func FreePort() (int, error)
- type ControllerWorld
- func (w *ControllerWorld) Cleanup()
- func (w *ControllerWorld) EnsureController(opts ...controls.ControllerOpt)
- func (w *ControllerWorld) RegisterService(name string, extraOpts ...controls.ServiceOption) *StateCounters
- func (w *ControllerWorld) WaitForState(state controls.State, timeout time.Duration) error
- type StateCounters
- type SyncBuffer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinaryPath ¶
BinaryPath returns the path to the compiled gtb binary, building it on first call. The binary is placed in a temp directory and reused for all subsequent calls.
Types ¶
type ControllerWorld ¶
type ControllerWorld struct {
Controller *controls.Controller
Ctx context.Context
Cancel context.CancelFunc
Counters map[string]*StateCounters
LogBuf *SyncBuffer
Logger logger.Logger
HTTPPort int
GRPCPort int
// Health check tracking
CheckCounts map[string]*atomic.Int64
// Channels for coordination
RequestStarted chan struct{}
RequestFinished chan struct{}
ClientResult chan error
StartupDelay chan struct{}
}
ControllerWorld holds per-scenario state for controls BDD tests.
func NewControllerWorld ¶
func NewControllerWorld() *ControllerWorld
NewControllerWorld creates a fresh scenario world.
func (*ControllerWorld) Cleanup ¶
func (w *ControllerWorld) Cleanup()
Cleanup stops the controller if still running.
func (*ControllerWorld) EnsureController ¶
func (w *ControllerWorld) EnsureController(opts ...controls.ControllerOpt)
EnsureController creates the controller if it doesn't exist yet.
func (*ControllerWorld) RegisterService ¶
func (w *ControllerWorld) RegisterService(name string, extraOpts ...controls.ServiceOption) *StateCounters
RegisterService registers a service with atomic counters for tracking.
func (*ControllerWorld) WaitForState ¶
WaitForState polls until the controller reaches the desired state or timeout.
type StateCounters ¶
StateCounters tracks service lifecycle invocations atomically.
type SyncBuffer ¶
type SyncBuffer struct {
// contains filtered or unexported fields
}
SyncBuffer is a thread-safe bytes.Buffer for capturing log output.
func (*SyncBuffer) String ¶
func (b *SyncBuffer) String() string