data

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestTypes = map[TestType]bool{
	K8sTest: true,
}

TestTypes - holds a map of valid NetAsserTestTypes

ValidK8sResourceKinds - holds a map of valid K8sResourceKind

Functions

This section is empty.

Types

type Dst

type Dst struct {
	K8sResource *K8sResource `yaml:"k8sResource,omitempty"`
	Host        *Host        `yaml:"host,omitempty"`
}

Dst holds the destination or the target resource of the test

type Host

type Host struct {
	Name string `yaml:"name"`
}

Host represents a host that can be used as Dst in a K8s test

type K8sResource

type K8sResource struct {
	Kind      K8sResourceKind `yaml:"kind"`
	Name      string          `yaml:"name"`
	Namespace string          `yaml:"namespace"`
}

K8sResource - Resource hold a Kubernetes Resource

type K8sResourceKind

type K8sResourceKind string

K8sResourceKind represents the Kind of K8sResource

const (
	KindDeployment  K8sResourceKind = "deployment"
	KindStatefulSet K8sResourceKind = "statefulset"
	KindDaemonSet   K8sResourceKind = "daemonset"
	KindPod         K8sResourceKind = "pod"
)

type Protocol

type Protocol string

Protocol - represents the Layer 4 protocol

const (
	// ProtocolTCP - represents the TCP protocol
	ProtocolTCP Protocol = "tcp"

	// ProtocolUDP - represents the UDP protocol
	ProtocolUDP Protocol = "udp"
)

type Src

type Src struct {
	K8sResource *K8sResource `yaml:"k8sResource"`
}

Src represents a source in the K8s test

type Test

type Test struct {
	Name           string   `yaml:"name"`
	Type           TestType `yaml:"type"`
	Protocol       Protocol `yaml:"protocol"`
	TargetPort     int      `yaml:"targetPort"`
	TimeoutSeconds int      `yaml:"timeoutSeconds"`
	Attempts       int      `yaml:"attempts"`
	ExitCode       int      `yaml:"exitCode"`
	Src            *Src     `yaml:"src"`
	Dst            *Dst     `yaml:"dst"`
	Pass           bool     `yaml:"pass"`
	FailureReason  string   `yaml:"failureReason"`
}

Test holds a single netAssert test

func (*Test) UnmarshalYAML

func (te *Test) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML - decodes and validate Test type

type TestType

type TestType string

TestType - represents a K8s test type, right now we only support k8s type

const (
	K8sTest TestType = "k8s"
)

type Tests

type Tests []*Test

Tests - holds a slice of NetAssertTests

func NewFromReader

func NewFromReader(r io.Reader) (Tests, error)

NewFromReader - creates a new Test from an io.Reader

func ReadTestsFromDir

func ReadTestsFromDir(path string) (Tests, error)

ReadTestsFromDir - Reads tests cases from .yaml and .yml file present in a directory does not recursively read files

func ReadTestsFromFile

func ReadTestsFromFile(fileName string) (Tests, error)

ReadTestsFromFile - reads tests from a file containing a list of Test

func (*Tests) TAPResult

func (ts *Tests) TAPResult(w io.Writer) error

TAPResult - outputs result of tests into a TAP format

func (*Tests) UnmarshalYAML

func (ts *Tests) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML - decodes Tests type

func (*Tests) Validate

func (ts *Tests) Validate() error

Validate - validates the Tests type

Jump to

Keyboard shortcuts

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