profile

package
v3.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Profiles = map[string]Profile{}

Profiles is a map of registered profiles used by test runners

Functions

This section is empty.

Types

type ExpectedInterruption

type ExpectedInterruption struct {
	RuleID int    `yaml:"rule_id,omitempty"`
	Action string `yaml:"action,omitempty"`
	Status int    `yaml:"status,omitempty"`
	Data   string `yaml:"data,omitempty"`
}

ExpectedInterruption contains the expected interruption results for a test

type ExpectedOutput

type ExpectedOutput struct {
	Headers           map[string]string     `yaml:"headers,omitempty"`
	Data              interface{}           `yaml:"data,omitempty"` // Accepts array or string
	LogContains       string                `yaml:"log_contains,omitempty"`
	NoLogContains     string                `yaml:"no_log_contains,omitempty"`
	ExpectError       bool                  `yaml:"expect_error,omitempty"`
	TriggeredRules    []int                 `yaml:"triggered_rules,omitempty"`
	NonTriggeredRules []int                 `yaml:"non_triggered_rules,omitempty"`
	Status            interface{}           `yaml:"status,omitempty"`
	Interruption      *ExpectedInterruption `yaml:"interruption,omitempty"`
}

ExpectedOutput contains the expected output results for a test

type Meta

type Meta struct {
	Author      string `yaml:"author,omitempty"`
	Description string `yaml:"description,omitempty"`
	Enabled     bool   `yaml:"enabled,omitempty"`
	Name        string `yaml:"name,omitempty"`
}

Meta contains the test metadata

type Profile

type Profile struct {
	Rules string `yaml:"rules,omitempty"`
	Pass  bool   `yaml:"pass,omitempty"`
	Meta  Meta   `yaml:"meta,omitempty"`
	Tests []Test `yaml:"tests,omitempty"`
}

Profile represents a test profile It contains metadata and instructions for a test It requires more documentation

func RegisterProfile

func RegisterProfile(p Profile) Profile

RegisterProfile registers a profile for running from tests

type Stage

type Stage struct {
	Stage SubStage `yaml:"stage,omitempty"`
}

Stage is a yaml container for the stage key it contains ProfileSubStages

type StageInput

type StageInput struct {
	DestAddr       string            `yaml:"dest_addr,omitempty"`
	Port           int               `yaml:"port,omitempty"`
	Method         string            `yaml:"method,omitempty"`
	URI            string            `yaml:"uri,omitempty"`
	Version        string            `yaml:"version,omitempty"`
	Data           string            `yaml:"data,omitempty"` // Accepts array or string
	Headers        map[string]string `yaml:"headers,omitempty"`
	RawRequest     []byte            `yaml:"raw_request,omitempty"`
	EncodedRequest string            `yaml:"encoded_request,omitempty"`
	StopMagic      bool              `yaml:"stop_magic,omitempty"`
}

StageInput contains the input data for tests

type SubStage

type SubStage struct {
	Input  StageInput     `yaml:"input,omitempty"`
	Output ExpectedOutput `yaml:"output,omitempty"`
}

SubStage contains the input data and expected output for tests

type Test

type Test struct {
	Title       string  `yaml:"test_title,omitempty"`
	Description string  `yaml:"desc,omitempty"`
	Stages      []Stage `yaml:"stages,omitempty"`
}

Test contains the title and test stages

Jump to

Keyboard shortcuts

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