Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
Start(env *envtest.Environment) (*rest.Config, error)
Stop(env *envtest.Environment) error
}
Backend defines the control-plane operations required by Environment. v1 defaults to EnvtestBackend; future commits can swap this implementation.
type Environment ¶
type Environment envtest.Environment
Environment is a drop-in compatible envtest surface. It keeps the same field contract as upstream envtest while allowing backend selection and instrumentation through package internals.
func (*Environment) AddUser ¶
func (e *Environment) AddUser(user envtest.User, baseConfig *rest.Config) (*envtest.AuthenticatedUser, error)
AddUser matches upstream envtest behavior.
func (*Environment) MetricsSnapshot ¶
func (e *Environment) MetricsSnapshot() MetricsSnapshot
MetricsSnapshot returns lifecycle metrics for this Environment.
func (*Environment) SetBackend ¶
func (e *Environment) SetBackend(b Backend)
SetBackend overrides backend selection for this Environment instance.
func (*Environment) Start ¶
func (e *Environment) Start() (*rest.Config, error)
Start boots the environment and returns a rest.Config, following upstream envtest behavior.
func (*Environment) Stop ¶
func (e *Environment) Stop() error
Stop tears down the environment, following upstream envtest behavior.
type EnvtestBackend ¶
type EnvtestBackend struct{}
EnvtestBackend delegates lifecycle operations to upstream envtest directly.
func (EnvtestBackend) Start ¶
func (b EnvtestBackend) Start(env *envtest.Environment) (*rest.Config, error)
func (EnvtestBackend) Stop ¶
func (b EnvtestBackend) Stop(env *envtest.Environment) error
type KplaneBackend ¶
type KplaneBackend struct {
// contains filtered or unexported fields
}
KplaneBackend starts a shared kplane-dev/apiserver and points envtest to it. It uses kcp embeddedetcd for local in-process etcd.
func NewKplaneBackend ¶
func NewKplaneBackend() *KplaneBackend
func (*KplaneBackend) Start ¶
func (b *KplaneBackend) Start(env *envtest.Environment) (*rest.Config, error)
func (*KplaneBackend) Stop ¶
func (b *KplaneBackend) Stop(env *envtest.Environment) error
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics stores lifecycle timings in-memory for tests and assertions.
func NewMetrics ¶
func NewMetrics() *Metrics
func (*Metrics) Snapshot ¶
func (m *Metrics) Snapshot() MetricsSnapshot
Snapshot returns counters and percentile timings for lifecycle operations.
type MetricsSnapshot ¶
type MetricsSnapshot struct {
StartAttempts int
StartSuccesses int
StopAttempts int
StopSuccesses int
StartP50 time.Duration
StartP95 time.Duration
StopP50 time.Duration
StopP95 time.Duration
}
MetricsSnapshot is a point-in-time view of observed lifecycle metrics.
type SharedEnvtestBackend ¶
type SharedEnvtestBackend struct {
// contains filtered or unexported fields
}
SharedEnvtestBackend is an experimental backend that reuses a single upstream envtest control plane across multiple Environment users in-process.
func NewSharedEnvtestBackend ¶
func NewSharedEnvtestBackend() *SharedEnvtestBackend
func (*SharedEnvtestBackend) Start ¶
func (b *SharedEnvtestBackend) Start(env *envtest.Environment) (*rest.Config, error)
func (*SharedEnvtestBackend) Stop ¶
func (b *SharedEnvtestBackend) Stop(_ *envtest.Environment) error