Documentation
¶
Index ¶
- type BaseTestCase
- type ConfigMapDef
- type ExpectedComponentContainers
- type ExpectedComponentPods
- type MapperLogSink
- func (c *MapperLogSink) Clear()
- func (c *MapperLogSink) Enabled(_ context.Context, level slog.Level) bool
- func (c *MapperLogSink) ErrorCount() int
- func (c *MapperLogSink) GetErrors() []string
- func (c *MapperLogSink) GetInfos() []string
- func (c *MapperLogSink) GetWarnings() []string
- func (c *MapperLogSink) Handle(_ context.Context, r slog.Record) error
- func (c *MapperLogSink) HasErrors() bool
- func (c *MapperLogSink) HasWarnings() bool
- func (c *MapperLogSink) WarningCount() int
- func (c *MapperLogSink) WithAttrs(attrs []slog.Attr) slog.Handler
- func (c *MapperLogSink) WithGroup(name string) slog.Handler
- type NegativeTestCase
- type PodSelectors
- type PriorityClassDef
- type ResourceDependentTestCase
- type SecretDef
- type TestCleanupRegistry
- type TestContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseTestCase ¶
type BaseTestCase struct {
Name string
ValuesFile string
ExpectedPods ExpectedComponentPods
ExpectedComponentContainers ExpectedComponentContainers
SkipReason string
}
BaseTestCase defines a simple test case without dependencies
type ConfigMapDef ¶
ConfigMapDef defines a ConfigMap to be created before the test
type ExpectedComponentContainers ¶
type ExpectedComponentContainers struct {
Agent []string
ClusterAgent []string
ClusterChecksRunner []string
}
ExpectedComponentContainers defines required container names per component.
type ExpectedComponentPods ¶
ExpectedComponentPods defines explicit expected pod counts for each component. DaemonSet Agent pod count is always calculated dynamically based on cluster node count.
type MapperLogSink ¶
type MapperLogSink struct {
// contains filtered or unexported fields
}
MapperLogSink captures slog output during mapper runs. It is safe for concurrent use from multiple goroutines.
func (*MapperLogSink) Clear ¶
func (c *MapperLogSink) Clear()
Clear resets all captured logs (thread-safe)
func (*MapperLogSink) ErrorCount ¶
func (c *MapperLogSink) ErrorCount() int
ErrorCount returns the number of captured errors (thread-safe)
func (*MapperLogSink) GetErrors ¶
func (c *MapperLogSink) GetErrors() []string
GetErrors returns a copy of all captured errors (thread-safe)
func (*MapperLogSink) GetInfos ¶
func (c *MapperLogSink) GetInfos() []string
GetInfos returns a copy of all captured info messages (thread-safe)
func (*MapperLogSink) GetWarnings ¶
func (c *MapperLogSink) GetWarnings() []string
GetWarnings returns a copy of all captured warnings (thread-safe)
func (*MapperLogSink) HasErrors ¶
func (c *MapperLogSink) HasErrors() bool
HasErrors returns true if any errors were captured (thread-safe)
func (*MapperLogSink) HasWarnings ¶
func (c *MapperLogSink) HasWarnings() bool
HasWarnings returns true if any warnings were captured (thread-safe)
func (*MapperLogSink) WarningCount ¶
func (c *MapperLogSink) WarningCount() int
WarningCount returns the number of captured warnings (thread-safe)
type NegativeTestCase ¶
type NegativeTestCase struct {
Name string
ValuesFile string
ExpectedErrMsg string
Description string
}
NegativeTestCase defines a test case that expects the mapper to fail
type PodSelectors ¶
PodSelectors groups label selectors for agent components.
type PriorityClassDef ¶
PriorityClassDef defines a PriorityClass to be created before the test
type ResourceDependentTestCase ¶
type ResourceDependentTestCase struct {
Name string
ValuesFile string
ExpectedPods ExpectedComponentPods
ExpectedComponentContainers ExpectedComponentContainers
ConfigMaps []ConfigMapDef
Secrets []SecretDef
PriorityClasses []PriorityClassDef
SkipReason string
}
ResourceDependentTestCase defines a test case that requires pre-created resources.
- Name: test name (usually the filename)
- ValuesFile: path to the values file relative to the yamlmapper directory
- ExpectedPods: explicit pod counts for each component
- ExpectedComponentContainers: required container names per component
- ConfigMaps: ConfigMaps to create before the test
- Secrets: Secrets to create before the test
- PriorityClasses: PriorityClasses to create before the test
- SkipReason: if set, the test will be skipped with this reason
type TestCleanupRegistry ¶
type TestCleanupRegistry struct {
// contains filtered or unexported fields
}
TestCleanupRegistry stores cleanup hooks for test runs. - datadog: datadog helm chart uninstall function - operator: operator chart uninstall function
func (*TestCleanupRegistry) SetDatadog ¶
func (c *TestCleanupRegistry) SetDatadog(cleanup func())
func (*TestCleanupRegistry) SetOperator ¶
func (c *TestCleanupRegistry) SetOperator(cleanup func())
func (*TestCleanupRegistry) UninstallDatadog ¶
func (c *TestCleanupRegistry) UninstallDatadog()
func (*TestCleanupRegistry) UninstallOperator ¶
func (c *TestCleanupRegistry) UninstallOperator()
type TestContext ¶
type TestContext struct {
T *testing.T
Namespace string
KubectlOptions *k8s.KubectlOptions
TestCleanupRegistry *TestCleanupRegistry
// contains filtered or unexported fields
}
func (*TestContext) SetupCleanup ¶
func (tc *TestContext) SetupCleanup()
SetupCleanup registers the cleanup function with t.Cleanup(). This should be called after creating the test context.
func (*TestContext) SetupSecretsFromEnv ¶
func (tc *TestContext) SetupSecretsFromEnv()
SetupSecretsFromEnv creates secrets from environment variables if available.
func (*TestContext) SetupTestResources ¶
func (tc *TestContext) SetupTestResources(testCase *ResourceDependentTestCase)
SetupTestResources creates test-specific resources (ConfigMaps, Secrets, PriorityClasses).