framework

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ObjectKeyFromObject

func ObjectKeyFromObject(obj client.Object) types.NamespacedName

ObjectKeyFromObject returns a client.ObjectKey for the given object. This is a compatibility helper for the deprecated client.ObjectKeyFromObject function.

func RunIntegrationTests

func RunIntegrationTests(t *testing.T, config *TestConfig)

Types

type BenchmarkResult

type BenchmarkResult struct {
	Name string

	Iterations int

	NsPerOp int64

	AllocsPerOp int64

	BytesPerOp int64

	MemAllocsPerOp int64

	MemBytesPerOp int64
}

type CPUSnapshot

type CPUSnapshot struct {
	Timestamp time.Time

	NumCPU int

	NumGoroutine int

	GOMAXPROCS int
}

type CoverageData

type CoverageData struct {
	TotalLines int

	CoveredLines int

	Percentage float64

	PackageCoverage map[string]float64

	FileCoverage map[string]float64
}

type LoadTestRequest

type LoadTestRequest struct {
	Timestamp time.Time

	Latency time.Duration

	Error error
}

type LoadTestResult

type LoadTestResult struct {
	TestName string

	StartTime time.Time

	EndTime time.Time

	TotalRequests int

	SuccessfulReq int

	FailedReq int

	AvgLatency time.Duration

	P95Latency time.Duration

	P99Latency time.Duration

	MaxLatency time.Duration

	MinLatency time.Duration

	Throughput float64 // requests per second

	ErrorRate float64

	ConcurrentUsers int
}

type MemorySnapshot

type MemorySnapshot struct {
	Timestamp time.Time

	Alloc uint64

	TotalAlloc uint64

	Sys uint64

	NumGC uint32

	HeapAlloc uint64

	HeapSys uint64

	HeapInuse uint64
}

type MockK8sClient

type MockK8sClient struct {
	mock.Mock
}

func (*MockK8sClient) Create

func (m *MockK8sClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

func (*MockK8sClient) Delete

func (m *MockK8sClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

func (*MockK8sClient) Get

func (*MockK8sClient) Reset

func (m *MockK8sClient) Reset()

func (*MockK8sClient) Update

func (m *MockK8sClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

type MockLLMClient

type MockLLMClient struct {
	mock.Mock
}

func (*MockLLMClient) ProcessIntent

func (m *MockLLMClient) ProcessIntent(ctx context.Context, intent string) (map[string]interface{}, error)

func (*MockLLMClient) Reset

func (m *MockLLMClient) Reset()

type MockManager

type MockManager struct {
	// contains filtered or unexported fields
}

func NewMockManager

func NewMockManager() *MockManager

func (*MockManager) Cleanup

func (mm *MockManager) Cleanup()

func (*MockManager) GenerateReport

func (mm *MockManager) GenerateReport()

func (*MockManager) GetK8sMock

func (mm *MockManager) GetK8sMock() *MockK8sClient

func (*MockManager) GetLLMMock

func (mm *MockManager) GetLLMMock() *MockLLMClient

func (*MockManager) GetMockServerURLs

func (mm *MockManager) GetMockServerURLs() map[string]string

func (*MockManager) GetRedisMock

func (mm *MockManager) GetRedisMock() *MockRedisClient

func (*MockManager) GetWeaviateMock

func (mm *MockManager) GetWeaviateMock() *MockWeaviateClient

func (*MockManager) Initialize

func (mm *MockManager) Initialize(config *TestConfig)

func (*MockManager) InjectChaos

func (mm *MockManager) InjectChaos(failureRate float64, testFunc func() error) error

func (*MockManager) Reset

func (mm *MockManager) Reset()

type MockRedisClient

type MockRedisClient struct {
	mock.Mock
}

func (*MockRedisClient) Get

func (*MockRedisClient) Reset

func (m *MockRedisClient) Reset()

func (*MockRedisClient) Set

func (m *MockRedisClient) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd

type MockWeaviateClient

type MockWeaviateClient struct {
	mock.Mock
}

func (*MockWeaviateClient) Query

func (m *MockWeaviateClient) Query() interface{}

func (*MockWeaviateClient) Reset

func (m *MockWeaviateClient) Reset()

type TestConfig

type TestConfig struct {
	UseExistingCluster bool

	CRDPath string

	BinaryAssetsPath string

	Timeout time.Duration

	CleanupTimeout time.Duration

	ParallelNodes int

	CoverageEnabled bool

	CoverageThreshold float64

	LoadTestEnabled bool

	MaxConcurrency int

	TestDuration time.Duration

	ChaosTestEnabled bool

	FailureRate float64

	WeaviateURL string

	LLMProviderURL string

	MockExternalAPIs bool
}

func DefaultTestConfig

func DefaultTestConfig() *TestConfig

type TestMetrics

type TestMetrics struct {
	// contains filtered or unexported fields
}

func NewTestMetrics

func NewTestMetrics() *TestMetrics

func (*TestMetrics) CollectTestMetrics

func (tm *TestMetrics) CollectTestMetrics()

func (*TestMetrics) ExecuteLoadTest

func (tm *TestMetrics) ExecuteLoadTest(concurrency int, duration time.Duration, testFunc func() error) error

func (*TestMetrics) GenerateReport

func (tm *TestMetrics) GenerateReport()

func (*TestMetrics) GetCoveragePercentage

func (tm *TestMetrics) GetCoveragePercentage() float64

func (*TestMetrics) GetLoadTestResults

func (tm *TestMetrics) GetLoadTestResults() map[string]*LoadTestResult

func (*TestMetrics) Initialize

func (tm *TestMetrics) Initialize()

func (*TestMetrics) RecordBenchmark

func (tm *TestMetrics) RecordBenchmark(name string, iterations int, nsPerOp, allocsPerOp, bytesPerOp int64)

func (*TestMetrics) RecordErrorRate

func (tm *TestMetrics) RecordErrorRate(operation string, errorRate float64)

func (*TestMetrics) RecordLatency

func (tm *TestMetrics) RecordLatency(operation string, latency time.Duration)

func (*TestMetrics) RecordTestResult

func (tm *TestMetrics) RecordTestResult(passed, skipped bool)

func (*TestMetrics) RecordThroughput

func (tm *TestMetrics) RecordThroughput(operation string, throughput float64)

func (*TestMetrics) Reset

func (tm *TestMetrics) Reset()

func (*TestMetrics) UpdateCoverageData

func (tm *TestMetrics) UpdateCoverageData(totalLines, coveredLines int)

type TestSuite

type TestSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

func NewTestSuite

func NewTestSuite(config *TestConfig) *TestSuite

func (*TestSuite) GetConfig

func (ts *TestSuite) GetConfig() *rest.Config

func (*TestSuite) GetContext

func (ts *TestSuite) GetContext() context.Context

func (*TestSuite) GetK8sClient

func (ts *TestSuite) GetK8sClient() client.Client

func (*TestSuite) GetMetrics

func (ts *TestSuite) GetMetrics() *TestMetrics

func (*TestSuite) GetMocks

func (ts *TestSuite) GetMocks() *MockManager

func (*TestSuite) GetTestConfig

func (ts *TestSuite) GetTestConfig() *TestConfig

func (*TestSuite) GetTestNamespace

func (ts *TestSuite) GetTestNamespace() string

GetTestNamespace returns a unique namespace for testing.

func (*TestSuite) RunChaosTest

func (ts *TestSuite) RunChaosTest(testFunc func() error) error

func (*TestSuite) RunLoadTest

func (ts *TestSuite) RunLoadTest(testFunc func() error) error

func (*TestSuite) SetupSuite

func (ts *TestSuite) SetupSuite()

func (*TestSuite) SetupTest

func (ts *TestSuite) SetupTest()

func (*TestSuite) TearDownSuite

func (ts *TestSuite) TearDownSuite()

func (*TestSuite) TearDownTest

func (ts *TestSuite) TearDownTest()

func (*TestSuite) ValidateTestEnvironment

func (ts *TestSuite) ValidateTestEnvironment() error

Jump to

Keyboard shortcuts

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