yamlmapper

package
v0.0.0-...-86133c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

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

type ConfigMapDef struct {
	Name string
	Data map[string]string
}

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

type ExpectedComponentPods struct {
	ClusterAgent        int
	ClusterChecksRunner int
}

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) Enabled

func (c *MapperLogSink) Enabled(_ context.Context, level slog.Level) bool

Enabled implements slog.Handler

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) Handle

func (c *MapperLogSink) Handle(_ context.Context, r slog.Record) error

Handle implements slog.Handler - thread-safe log message capture

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)

func (*MapperLogSink) WithAttrs

func (c *MapperLogSink) WithAttrs(attrs []slog.Attr) slog.Handler

WithAttrs implements slog.Handler

func (*MapperLogSink) WithGroup

func (c *MapperLogSink) WithGroup(name string) slog.Handler

WithGroup implements slog.Handler

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

type PodSelectors struct {
	Agent               string
	ClusterAgent        string
	ClusterChecksRunner string
}

PodSelectors groups label selectors for agent components.

type PriorityClassDef

type PriorityClassDef struct {
	Name        string
	Value       int32
	Description string
}

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 SecretDef

type SecretDef struct {
	Name string
	Data map[string]string
}

SecretDef defines a Secret to be created before the test

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL