validator

package
v0.0.0-...-196de0d Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RawLogCounter        int
	ProcessedLogCounter  int
	FlushLogCounter      int
	FlushLogGroupCounter int
)
View Source
var AlarmLogs = make(map[string]map[string]map[string]int)

AlarmLogs spec: map[project_{project}:logstore:{logstore}][{alarm_type}][{alarm_message}][{alarm_count}]

Functions

func ClearCounter

func ClearCounter()

func CloseCounter

func CloseCounter()

func GetAlarmLogChan

func GetAlarmLogChan() chan<- *protocol.LogGroup

func GetContainerLogChan

func GetContainerLogChan() chan<- *protocol.LogGroup

func GetCounterChan

func GetCounterChan() chan<- *protocol.LogGroup

func InitCounter

func InitCounter()

func RegisterLogValidatorCreator

func RegisterLogValidatorCreator(name string, creator LogValidatorCreator)

RegisterLogValidatorCreator register a new log validator creator to the factory .

func RegisterSystemValidatorCreator

func RegisterSystemValidatorCreator(name string, creator SystemValidatorCreator)

RegisterSystemValidatorCreator register a new system validator creator to the factory.

func RegisterTagValidatorCreator

func RegisterTagValidatorCreator(name string, creator TagValidatorCreator)

RegisterTagValidatorCreator register a new tag validator creator to the factory .

Types

type LogValidator

type LogValidator interface {
	doc.Doc
	// Valid the given log group and returns the reports when valid failed.
	Valid(group *protocol.LogGroup) (reports []*Report)
	// Name of LogValidator.
	Name() string
}

LogValidator check each loggroup and returns Report slice when having illegal logs.

func NewLogValidator

func NewLogValidator(name string, cfg map[string]interface{}) (LogValidator, error)

NewLogValidator create a new log validator from the factory.

type LogValidatorCreator

type LogValidatorCreator func(spec map[string]interface{}) (LogValidator, error)

type Report

type Report struct {
	Success   bool // used to judge the final status.
	Validator string
	Name      string
	Want      string
	Got       string
	NotFound  string
}

func (*Report) String

func (a *Report) String() string

type SystemValidator

type SystemValidator interface {
	doc.Doc
	// Start the SystemValidator.
	Start() error
	// Valid the given group.
	Valid(group *protocol.LogGroup)
	// FetchResult return reports when find failure in the whole testing.
	FetchResult() (reports []*Report)
	// Name of SystemValidator
	Name() string
}

SystemValidator verify the total status of the system from the testing start to the end, such as compare logs count.

func NewSystemValidator

func NewSystemValidator(name string, cfg map[string]interface{}) (SystemValidator, error)

NewSystemValidator create a new system validator from the factory.

type SystemValidatorCreator

type SystemValidatorCreator func(spec map[string]interface{}) (SystemValidator, error)

type TagValidator

type TagValidator interface {
	doc.Doc
	// Valid the given group and returns the reports when valid failed.
	Valid(group *protocol.LogGroup) (reports []*Report)
	// Name of LogValidator.
	Name() string
}

TagValidator check each tag and returns Report slice when having illegal tag.

func NewTagValidators

func NewTagValidators(name string, cfg map[string]interface{}) (TagValidator, error)

NewTagValidators reate a new tag validator from the factory.

type TagValidatorCreator

type TagValidatorCreator func(spec map[string]interface{}) (TagValidator, error)

Jump to

Keyboard shortcuts

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