Documentation
¶
Overview ¶
Package load provides realistic OpenWebIF mocks for load and performance testing
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EPGConfig ¶
type EPGConfig struct {
EventsPerChannel int // Number of EPG events per channel
EventDuration time.Duration // Average event duration
EnableImages bool // Include event images
}
EPGConfig configures EPG mock behavior
func DefaultEPGConfig ¶
func DefaultEPGConfig() EPGConfig
DefaultEPGConfig returns default EPG configuration
type EPGMockServer ¶
type EPGMockServer struct {
*MockServer
// contains filtered or unexported fields
}
EPGMockServer adds EPG endpoint support
func NewEPGMockServer ¶
func NewEPGMockServer(config MockConfig, epgConfig EPGConfig) *EPGMockServer
NewEPGMockServer creates a mock server with EPG support
func (*EPGMockServer) Handler ¶
func (e *EPGMockServer) Handler() http.Handler
Handler returns HTTP handler with EPG endpoints
type Metrics ¶
type Metrics struct {
RequestsTotal atomic.Int64
RequestsSuccess atomic.Int64
RequestsError atomic.Int64
RequestsTimeout atomic.Int64
TotalLatency atomic.Int64 // Microseconds
}
Metrics tracks mock server statistics
type MetricsSnapshot ¶
type MetricsSnapshot struct {
RequestsTotal int64
RequestsSuccess int64
RequestsError int64
RequestsTimeout int64
AverageLatency time.Duration
}
MetricsSnapshot is an immutable snapshot of metrics
type MockConfig ¶
type MockConfig struct {
// Latency configuration
MinLatency time.Duration // Minimum response latency
MaxLatency time.Duration // Maximum response latency
// Failure simulation
ErrorRate float64 // Probability of returning 500 error (0.0-1.0)
TimeoutRate float64 // Probability of timing out (0.0-1.0)
TimeoutDuration time.Duration // How long to block on timeout
// Data generation
BouquetCount int // Number of bouquets to generate
ChannelsPerBouquet int // Channels per bouquet
// Rate limiting
MaxRequestsPerSecond int // 0 = unlimited
// Metrics
EnableMetrics bool
}
MockConfig configures the behavior of the mock OpenWebIF server
func DefaultMockConfig ¶
func DefaultMockConfig() MockConfig
DefaultMockConfig returns a realistic OpenWebIF mock configuration
func HighLoadConfig ¶
func HighLoadConfig() MockConfig
HighLoadConfig returns configuration for high-load scenarios
func UnstableConfig ¶
func UnstableConfig() MockConfig
UnstableConfig returns configuration for resilience testing
type MockServer ¶
type MockServer struct {
// contains filtered or unexported fields
}
MockServer is a realistic OpenWebIF mock for load testing
func NewMockServer ¶
func NewMockServer(config MockConfig) *MockServer
NewMockServer creates a new mock OpenWebIF server
func (*MockServer) GetMetrics ¶
func (m *MockServer) GetMetrics() MetricsSnapshot
GetMetrics returns current metrics snapshot
func (*MockServer) Handler ¶
func (m *MockServer) Handler() http.Handler
Handler returns the HTTP handler for the mock server
type RealisticChannelGenerator ¶
type RealisticChannelGenerator struct {
// contains filtered or unexported fields
}
RealisticChannelGenerator generates realistic channel data
func NewRealisticChannelGenerator ¶
func NewRealisticChannelGenerator() *RealisticChannelGenerator
NewRealisticChannelGenerator creates a generator with realistic channel names
func (*RealisticChannelGenerator) GenerateChannel ¶
func (g *RealisticChannelGenerator) GenerateChannel(index int) (name string, ref string, channelType string)
GenerateChannel returns a realistic channel at the given index