suite

package
v1.3.1-0...-b027968 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Suite

type Suite struct {
	TestCases []runtime.TestCase
	Config    runtime.GlobalTestConfig
	Nodes     []runtime.Node
}

Suite represents the current tests, nodes and configs. It is used by the runtime to execute all tests and is an abstraction for the given source. In example it could be possible to add more formats like XML or a custom DSL implementation.

func ParseYAML

func ParseYAML(content []byte, fileName string) Suite

ParseYAML parses the Suite from a yaml byte slice

func (Suite) AddTest

func (s Suite) AddTest(t runtime.TestCase)

AddTest pushes a new test to the suite if the test was already added it will panic

func (Suite) FindTests

func (s Suite) FindTests(pattern string) ([]runtime.TestCase, error)

GetTestByTitle returns a test by title, if the test was not found an error is returned

func (Suite) GetGlobalConfig

func (s Suite) GetGlobalConfig() runtime.GlobalTestConfig

GetGlobalConfig returns the global configuration which applies to the complete suite

func (Suite) GetNodeByName

func (s Suite) GetNodeByName(name string) (runtime.Node, error)

GetNodeByName returns a node by the given name

func (Suite) GetNodes

func (s Suite) GetNodes() []runtime.Node

GetNodes returns all nodes defined in the suite

func (Suite) GetTestByTitle

func (s Suite) GetTestByTitle(title string) (runtime.TestCase, error)

GetTestByTitle returns a test by title, if the test was not found an error is returned

func (Suite) GetTests

func (s Suite) GetTests() []runtime.TestCase

GetTests returns all tests of the test suite

type YAMLNodeConf

type YAMLNodeConf struct {
	Name           string `yaml:"-"`
	Type           string `yaml:"type"`
	User           string `yaml:"user,omitempty"`
	Pass           string `yaml:"pass,omitempty"`
	Addr           string `yaml:"addr,omitempty"`
	Image          string `yaml:"image,omitempty"`
	IdentityFile   string `yaml:"identity-file,omitempty"`
	Privileged     bool   `yaml:"privileged,omitempty"`
	DockerExecUser string `yaml:"docker-exec-user,omitempty"`
}

type YAMLSuiteConf

type YAMLSuiteConf struct {
	Tests  map[string]YAMLTest     `yaml:"tests"`
	Config YAMLTestConfigConf      `yaml:"config,omitempty"`
	Nodes  map[string]YAMLNodeConf `yaml:"nodes,omitempty"`
}

YAMLSuiteConf will be used for unmarshalling the yaml test suite

func (YAMLSuiteConf) MarshalYAML

func (y YAMLSuiteConf) MarshalYAML() (interface{}, error)

MarshalYAML adds custom logic to the struct to yaml conversion

func (*YAMLSuiteConf) UnmarshalYAML

func (y *YAMLSuiteConf) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals the yaml

type YAMLTest

type YAMLTest struct {
	Title    string             `yaml:"-"`
	Command  string             `yaml:"command,omitempty"`
	ExitCode int                `yaml:"exit-code"`
	Stdout   interface{}        `yaml:"stdout,omitempty"`
	Stderr   interface{}        `yaml:"stderr,omitempty"`
	Config   YAMLTestConfigConf `yaml:"config,omitempty"`
	Skip     bool               `yaml:"skip,omitempty"`
}

YAMLTest represents a test in the yaml test suite

type YAMLTestConfigConf

type YAMLTestConfigConf struct {
	InheritEnv bool              `yaml:"inherit-env,omitempty"`
	Env        map[string]string `yaml:"env,omitempty"`
	Dir        string            `yaml:"dir,omitempty"`
	Timeout    string            `yaml:"timeout,omitempty"`
	Retries    int               `yaml:"retries,omitempty"`
	Interval   string            `yaml:"interval,omitempty"`
	Nodes      []string          `yaml:"nodes,omitempty"`
}

YAMLTestConfigConf is a struct to represent the test config

Jump to

Keyboard shortcuts

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