test

package
v0.0.0-...-6eb52ac Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 30 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CreateContext global function for creating context.
	// This function should be set by Context implementation.
	CreateContext = createSimpleContext

	// Test is a singleton for test execution object.
	// This object should be set by Executor implementation.
	Test = createSimpleExecutor()
)

Functions

func CompileTestConfig

func CompileTestConfig(ctx Context) (*api.Config, *errors.ErrorList)

CompileTestConfig loads the test configuration and nested modules.

func RunTest

func RunTest(ctx Context) *errors.ErrorList

RunTest runs test based on provided test configuration.

Types

type Context

type Context interface {
	GetClusterLoaderConfig() *config.ClusterLoaderConfig
	GetClusterFramework() *framework.Framework
	GetPrometheusFramework() *framework.Framework
	GetTestReporter() Reporter
	GetState() *state.State
	GetTemplateMappingCopy() map[string]interface{}
	GetTemplateProvider() *config.TemplateProvider
	GetFactory() tuningset.Factory
	GetManager() measurement.Manager
	GetChaosMonkey() *chaos.Monkey
	GetTestScenario() *api.TestScenario
	GetTestConfig() *api.Config
	SetTestConfig(*api.Config)
}

Context is an interface for test context. Test context provides framework client and cluster state.

func CreateTestContext

func CreateTestContext(
	clusterFramework *framework.Framework,
	prometheusFramework *framework.Framework,
	clusterLoaderConfig *config.ClusterLoaderConfig,
	testReporter Reporter,
	testScenario *api.TestScenario,
) (Context, *errors.ErrorList)

CreateTestContext creates the test context.

type CreatContextFunc

type CreatContextFunc func(c *config.ClusterLoaderConfig, f *framework.Framework, s *state.State) Context

CreatContextFunc a type for function that creates Context based on given framework client and state.

type Executor

type Executor interface {
	ExecuteTest(ctx Context, conf *api.Config) *errors.ErrorList
	ExecuteStep(ctx Context, step *api.Step) *errors.ErrorList
	ExecutePhase(ctx Context, phase *api.Phase) *errors.ErrorList
	ExecuteObject(ctx Context, object *api.Object, namespace string, replicaIndex int32, operation OperationType) *errors.ErrorList
}

Executor is an interface for test executing object.

type OperationType

type OperationType int

OperationType is a type of operation to be performed on an object.

type Reporter

type Reporter interface {
	SetTestName(name string)
	GetNumberOfFailedTestItems() int
	BeginTestSuite()
	EndTestSuite()
	ReportTestStepFinish(duration time.Duration, stepName string, errList *errors.ErrorList)
	ReportTestStep(result *StepResult)
	ReportTestFinish(duration time.Duration, testConfigPath string, errList *errors.ErrorList)
}

Reporter is an interface for reporting tests results.

func CreateSimpleReporter

func CreateSimpleReporter(reportFilename, testSuiteDescription string) Reporter

type StepResult

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

func NewStepResult

func NewStepResult(stepName string) *StepResult

func (*StepResult) AddStepError

func (s *StepResult) AddStepError(errs *errors.ErrorList)

func (*StepResult) AddSubStepResult

func (s *StepResult) AddSubStepResult(name string, id int, err *errors.ErrorList)

func (*StepResult) GetAllErrors

func (s *StepResult) GetAllErrors() *errors.ErrorList

Jump to

Keyboard shortcuts

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