Documentation
¶
Overview ¶
Package testhelper provides test helpers for FODC agent components.
Index ¶
- func NewFlightRecorder(capacitySize int64) *flightrecorder.FlightRecorder
- func NewProxyClient(proxyAddr string, nodeRole string, podName string, containerNames []string, ...) *proxy.Client
- func NewProxyClientWithCollector(proxyAddr string, nodeRole string, podName string, containerNames []string, ...) *proxy.Client
- func UpdateMetrics(fr interface{}, rawMetrics []RawMetric) error
- func ValidateMetricsBufferAlignment(fr interface{}) error
- type Label
- type ProxyClientWrapper
- func (w *ProxyClientWrapper) Connect(ctx context.Context) error
- func (w *ProxyClientWrapper) Disconnect() error
- func (w *ProxyClientWrapper) SetClusterTopology(nodes []*databasev1.Node, calls []*fodcv1.Call) error
- func (w *ProxyClientWrapper) Start(ctx context.Context) error
- func (w *ProxyClientWrapper) StartClusterStateStream(ctx context.Context) error
- func (w *ProxyClientWrapper) StartConnManager(ctx context.Context)
- func (w *ProxyClientWrapper) StartLifecycleStream(ctx context.Context) error
- func (w *ProxyClientWrapper) StartMetricsStream(ctx context.Context) error
- func (w *ProxyClientWrapper) StartRegistrationStream(ctx context.Context) error
- type RawMetric
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFlightRecorder ¶
func NewFlightRecorder(capacitySize int64) *flightrecorder.FlightRecorder
NewFlightRecorder creates a new FlightRecorder instance for testing.
func NewProxyClient ¶
func NewProxyClient( proxyAddr string, nodeRole string, podName string, containerNames []string, labels map[string]string, heartbeatInterval time.Duration, reconnectInterval time.Duration, flightRecorder interface{}, logger *logger.Logger, ) *proxy.Client
NewProxyClient creates a new ProxyClient instance for testing.
func NewProxyClientWithCollector ¶
func NewProxyClientWithCollector( proxyAddr string, nodeRole string, podName string, containerNames []string, labels map[string]string, heartbeatInterval time.Duration, reconnectInterval time.Duration, flightRecorder interface{}, collector *agentcluster.Collector, logger *logger.Logger, ) *proxy.Client
NewProxyClientWithCollector creates a new ProxyClient instance for testing with optional cluster collector.
func UpdateMetrics ¶
UpdateMetrics updates the FlightRecorder with metrics. fr should be a *flightrecorder.FlightRecorder instance.
func ValidateMetricsBufferAlignment ¶
func ValidateMetricsBufferAlignment(fr interface{}) error
ValidateMetricsBufferAlignment validates that the timestamps buffer length equals each metric buffer length.
Types ¶
type ProxyClientWrapper ¶
type ProxyClientWrapper struct {
// contains filtered or unexported fields
}
ProxyClientWrapper wraps ProxyClient methods for testing.
func NewProxyClientWrapper ¶
func NewProxyClientWrapper( proxyAddr string, nodeRole string, podName string, containerNames []string, labels map[string]string, heartbeatInterval time.Duration, reconnectInterval time.Duration, flightRecorder interface{}, logger *logger.Logger, reportDir string, ) *ProxyClientWrapper
NewProxyClientWrapper creates a wrapped ProxyClient for testing.
func (*ProxyClientWrapper) Connect ¶
func (w *ProxyClientWrapper) Connect(ctx context.Context) error
Connect establishes a gRPC connection to Proxy.
func (*ProxyClientWrapper) Disconnect ¶
func (w *ProxyClientWrapper) Disconnect() error
Disconnect closes connection to Proxy.
func (*ProxyClientWrapper) SetClusterTopology ¶
func (w *ProxyClientWrapper) SetClusterTopology(nodes []*databasev1.Node, calls []*fodcv1.Call) error
SetClusterTopology seeds the wrapped client's cluster collector for testing.
func (*ProxyClientWrapper) Start ¶
func (w *ProxyClientWrapper) Start(ctx context.Context) error
Start starts the proxy client with automatic connection and stream setup.
func (*ProxyClientWrapper) StartClusterStateStream ¶
func (w *ProxyClientWrapper) StartClusterStateStream(ctx context.Context) error
StartClusterStateStream establishes bi-directional cluster state stream with Proxy.
func (*ProxyClientWrapper) StartConnManager ¶
func (w *ProxyClientWrapper) StartConnManager(ctx context.Context)
StartConnManager starts the connection manager.
func (*ProxyClientWrapper) StartLifecycleStream ¶ added in v0.10.1
func (w *ProxyClientWrapper) StartLifecycleStream(ctx context.Context) error
StartLifecycleStream establishes bi-directional lifecycle stream with Proxy.
func (*ProxyClientWrapper) StartMetricsStream ¶
func (w *ProxyClientWrapper) StartMetricsStream(ctx context.Context) error
StartMetricsStream establishes bi-directional metrics stream with Proxy.
func (*ProxyClientWrapper) StartRegistrationStream ¶
func (w *ProxyClientWrapper) StartRegistrationStream(ctx context.Context) error
StartRegistrationStream establishes bi-directional registration stream with Proxy.