Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TestTypes = map[TestType]bool{ K8sTest: true, }
TestTypes - holds a map of valid NetAsserTestTypes
var ValidK8sResourceKinds = map[K8sResourceKind]bool{ KindDeployment: true, KindStatefulSet: true, KindDaemonSet: true, KindPod: true, }
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 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 ¶
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 ¶
NewFromReader - creates a new Test from an io.Reader
func ReadTestsFromDir ¶
ReadTestsFromDir - Reads tests cases from .yaml and .yml file present in a directory does not recursively read files
func ReadTestsFromFile ¶
ReadTestsFromFile - reads tests from a file containing a list of Test
func (*Tests) UnmarshalYAML ¶
UnmarshalYAML - decodes Tests type