Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestHarness ¶
type TestHarness struct {
// attributes for the test harness
Context context.Context
Server *apiserver.Server
Agent *agent.Agent
Client *apiclient.ClientWithResponses
Store *store.Store
TestDirPath string
// contains filtered or unexported fields
}
func NewTestHarness ¶
func NewTestHarness(ctx context.Context, testDirPath string, goRoutineErrorHandler func(error), opts ...TestHarnessOption) (*TestHarness, error)
NewTestHarness creates a new test harness and returns a new test harness The test harness can be used from testing code to interact with a set of agent/server/store instances. It provides the necessary elements to perform tests against the agent and server.
func (*TestHarness) AgentDownloadedCertificate ¶
func (h *TestHarness) AgentDownloadedCertificate() bool
func (*TestHarness) Cleanup ¶
func (h *TestHarness) Cleanup()
func (*TestHarness) GetMockK8sClient ¶
func (h *TestHarness) GetMockK8sClient() *k8sclient.MockK8SClient
func (*TestHarness) RestartAgent ¶
func (h *TestHarness) RestartAgent()
func (*TestHarness) StartAgent ¶
func (h *TestHarness) StartAgent()
func (*TestHarness) StopAgent ¶
func (h *TestHarness) StopAgent()
type TestHarnessOption ¶ added in v1.0.0
type TestHarnessOption func(h *TestHarness)
func WithAgentAudit ¶ added in v1.0.0
func WithAgentAudit() TestHarnessOption
WithAgentAudit enables the agent's audit logging when the harness starts the agent. Note: Audit logging is enabled by default, so this option is primarily for test clarity.
func WithAgentMetrics ¶ added in v1.0.0
func WithAgentMetrics() TestHarnessOption
WithAgentMetrics enables the agent's Prometheus metrics endpoint when the harness starts the agent.
func WithAgentPprof ¶ added in v1.0.0
func WithAgentPprof() TestHarnessOption
WithAgentPprof enables the agent's pprof HTTP server when the harness starts the agent.
Click to show internal directories.
Click to hide internal directories.