testing

package
v0.0.0-...-0b35af4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AITestCase

type AITestCase struct {
	Name             string
	Prompt           string
	ExpectedKeywords []string      // Keywords that must appear in response
	ForbiddenWords   []string      // Words that must NOT appear
	MinLength        int           // Minimum response length
	MaxLatency       time.Duration // Maximum acceptable latency
	RiskScore        float64
}

AITestCase represents a test case for AI behavior

type AITestSuite

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

AITestSuite runs sanity checks on AI responses

func NewAITestSuite

func NewAITestSuite(orchestrator *ai.UnifiedOrchestrator, t *testing.T) *AITestSuite

NewAITestSuite creates a new AI test suite

func (*AITestSuite) RunSanityChecks

func (s *AITestSuite) RunSanityChecks()

RunSanityChecks runs a comprehensive suite of sanity checks

func (*AITestSuite) RunTest

func (s *AITestSuite) RunTest(testCase AITestCase) bool

RunTest executes a single AI test case

func (*AITestSuite) TestConsistency

func (s *AITestSuite) TestConsistency()

TestConsistency checks if AI gives consistent answers

type ChaosEngine

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

ChaosEngine runs chaos tests

func NewChaosEngine

func NewChaosEngine(t *testing.T) *ChaosEngine

NewChaosEngine creates a new chaos testing engine

func (*ChaosEngine) AddTest

func (c *ChaosEngine) AddTest(test ChaosTest)

AddTest adds a chaos test

func (*ChaosEngine) RunAll

func (c *ChaosEngine) RunAll()

RunAll runs all chaos tests

type ChaosScenario

type ChaosScenario interface {
	Execute(ctx context.Context) error
	Rollback(ctx context.Context) error
}

ChaosScenario defines the chaos to inject

type ChaosTest

type ChaosTest struct {
	Name        string
	Description string
	Duration    time.Duration
	Scenario    ChaosScenario
}

ChaosTest represents a chaos testing scenario

func GetStandardChaosTests

func GetStandardChaosTests() []ChaosTest

Predefined chaos tests

type DatabaseSlowdownScenario

type DatabaseSlowdownScenario struct {
	SlowdownFactor int // Multiply query time by this
}

DatabaseSlowdownScenario simulates slow database

func (*DatabaseSlowdownScenario) Execute

func (*DatabaseSlowdownScenario) Rollback

func (s *DatabaseSlowdownScenario) Rollback(ctx context.Context) error

type LoadTest

type LoadTest struct {
	Name           string
	TargetURL      string
	Concurrency    int
	Duration       time.Duration
	RequestsPerSec int
}

LoadTest represents a load test configuration

type LoadTestResult

type LoadTestResult struct {
	TotalRequests  int
	SuccessfulReqs int
	FailedReqs     int
	AvgLatency     time.Duration
	MinLatency     time.Duration
	MaxLatency     time.Duration
	RequestsPerSec float64
}

LoadTestResult contains load test results

func RunLoadTest

func RunLoadTest(t *testing.T, test LoadTest) LoadTestResult

RunLoadTest executes a load test

type NetworkLatencyScenario

type NetworkLatencyScenario struct {
	TargetService string
	LatencyMs     int
}

NetworkLatencyScenario adds network latency

func (*NetworkLatencyScenario) Execute

func (s *NetworkLatencyScenario) Execute(ctx context.Context) error

func (*NetworkLatencyScenario) Rollback

func (s *NetworkLatencyScenario) Rollback(ctx context.Context) error

type ServiceFailureScenario

type ServiceFailureScenario struct {
	TargetService string
	FailureRate   float64 // 0.0 to 1.0
}

ServiceFailureScenario simulates service failures

func (*ServiceFailureScenario) Execute

func (s *ServiceFailureScenario) Execute(ctx context.Context) error

func (*ServiceFailureScenario) Rollback

func (s *ServiceFailureScenario) Rollback(ctx context.Context) error

Jump to

Keyboard shortcuts

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