connectivity

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PassedPercentage added in v0.5.1

func PassedPercentage(p *passFailRow) float64

func PrintJUnitResults added in v0.4.6

func PrintJUnitResults(filename string, results []*Result, ignoreLoopback bool) error

func PrintNetworkPolicy added in v0.1.0

func PrintNetworkPolicy(p *networkingv1.NetworkPolicy) string

func ResultsToJUnit added in v0.4.6

func ResultsToJUnit(results []*JUnitTestResult) junit.JUnitTestSuite

func RunTestCaseStateTests added in v0.4.2

func RunTestCaseStateTests()

Types

type Comparison added in v0.2.0

type Comparison string
const (
	SameComparison      Comparison = "same"
	DifferentComparison Comparison = "different"
	IgnoredComparison   Comparison = "ignored"
)

func (Comparison) ShortString added in v0.2.0

func (c Comparison) ShortString() string

type ComparisonTable added in v0.2.0

type ComparisonTable struct {
	Wrapped *probe.TruthTable
}

func NewComparisonTable added in v0.2.0

func NewComparisonTable(items []string) *ComparisonTable

func NewComparisonTableFrom added in v0.2.0

func NewComparisonTableFrom(kubeProbe *probe.Table, simulatedProbe *probe.Table) *ComparisonTable

func (*ComparisonTable) Get added in v0.2.0

func (c *ComparisonTable) Get(from string, to string) *Item

func (*ComparisonTable) RenderSuccessTable added in v0.2.4

func (c *ComparisonTable) RenderSuccessTable() string

func (*ComparisonTable) ResultsByProtocol added in v0.2.4

func (c *ComparisonTable) ResultsByProtocol() map[bool]map[v1.Protocol]int

func (*ComparisonTable) Set added in v0.2.0

func (c *ComparisonTable) Set(from string, to string, value *Item)

func (*ComparisonTable) ValueCounts added in v0.2.0

func (c *ComparisonTable) ValueCounts(ignoreLoopback bool) map[Comparison]int

func (*ComparisonTable) ValueCountsByProtocol added in v0.2.4

func (c *ComparisonTable) ValueCountsByProtocol(ignoreLoopback bool) map[v1.Protocol]map[Comparison]int

type Interpreter added in v0.1.0

type Interpreter struct {
	Config *InterpreterConfig
	// contains filtered or unexported fields
}

func NewInterpreter added in v0.1.0

func NewInterpreter(kubernetes kube.IKubernetes, resources *probe.Resources, config *InterpreterConfig) *Interpreter

func (*Interpreter) ExecuteTestCase added in v0.1.0

func (t *Interpreter) ExecuteTestCase(testCase *generator.TestCase) *Result

type InterpreterConfig added in v0.3.1

type InterpreterConfig struct {
	ResetClusterBeforeTestCase       bool
	KubeProbeRetries                 int
	PerturbationWaitSeconds          int
	VerifyClusterStateBeforeTestCase bool
	BatchJobs                        bool
	IgnoreLoopback                   bool
	JobTimeoutSeconds                int
	FailFast                         bool
}

func (*InterpreterConfig) PerturbationWaitDuration added in v0.4.4

func (i *InterpreterConfig) PerturbationWaitDuration() time.Duration

type Item added in v0.2.4

type Item struct {
	Kube      *probe.Item
	Simulated *probe.Item
}

func (*Item) IsSuccess added in v0.2.4

func (i *Item) IsSuccess() bool

func (*Item) ResultsByProtocol added in v0.2.4

func (i *Item) ResultsByProtocol() map[bool]map[v1.Protocol]int

type JUnitTestResult added in v0.4.6

type JUnitTestResult struct {
	Passed bool
	Name   string
}

type LabelsDiff added in v0.4.2

type LabelsDiff struct {
	Same      []string
	Different []string
	Extra     []string
	Missing   []string
}

func NewLabelsDiff added in v0.4.2

func NewLabelsDiff(actual map[string]string, expected map[string]string) *LabelsDiff

func (*LabelsDiff) AreAllExpectedLabelsPresent added in v0.4.2

func (ld *LabelsDiff) AreAllExpectedLabelsPresent() bool

func (*LabelsDiff) AreLabelsEqual added in v0.4.2

func (ld *LabelsDiff) AreLabelsEqual() bool

type Printer added in v0.1.0

type Printer struct {
	Noisy            bool
	IgnoreLoopback   bool
	JunitResultsFile string
	Results          []*Result
}

func (*Printer) PrintStep added in v0.1.0

func (t *Printer) PrintStep(i int, step *generator.TestStep, stepResult *StepResult)

func (*Printer) PrintSummary added in v0.1.0

func (t *Printer) PrintSummary()

func (*Printer) PrintTestCaseResult added in v0.1.0

func (t *Printer) PrintTestCaseResult(result *Result)

type Result added in v0.1.0

type Result struct {
	// TODO should resources be captured per-step for tests that modify them?
	InitialResources *probe.Resources
	TestCase         *generator.TestCase
	Steps            []*StepResult
	Err              error
}

func (*Result) Features added in v0.2.4

func (r *Result) Features() map[string][]string

func (*Result) Passed added in v0.4.6

func (r *Result) Passed(ignoreLoopback bool) bool

func (*Result) ResultsByProtocol added in v0.2.4

func (r *Result) ResultsByProtocol() map[bool]map[v1.Protocol]int

type StepResult added in v0.1.0

type StepResult struct {
	SimulatedProbe *probe.Table
	KubeProbes     []*probe.Table
	Policy         *matcher.Policy
	KubePolicies   []*networkingv1.NetworkPolicy
	// contains filtered or unexported fields
}

func NewStepResult added in v0.2.4

func NewStepResult(simulated *probe.Table, policy *matcher.Policy, kubePolicies []*networkingv1.NetworkPolicy) *StepResult

func (*StepResult) AddKubeProbe added in v0.2.4

func (s *StepResult) AddKubeProbe(kubeProbe *probe.Table)

func (*StepResult) Comparison added in v0.2.4

func (s *StepResult) Comparison(i int) *ComparisonTable

func (*StepResult) LastComparison added in v0.2.4

func (s *StepResult) LastComparison() *ComparisonTable

func (*StepResult) LastKubeProbe added in v0.2.0

func (s *StepResult) LastKubeProbe() *probe.Table

func (*StepResult) Passed added in v0.5.2

func (s *StepResult) Passed(ignoreLoopback bool) bool

type SummaryTable added in v0.4.6

type SummaryTable struct {
	Tests                [][]string
	Passed               int
	Failed               int
	ProtocolCounts       map[v1.Protocol]map[Comparison]int
	TagCounts            map[string]map[string]map[bool]int
	TagPrimaryCounts     map[string]map[bool]int
	FeatureCounts        map[string]map[string]map[bool]int
	FeaturePrimaryCounts map[string]map[bool]int
}

func NewSummaryTableFromResults added in v0.4.6

func NewSummaryTableFromResults(ignoreLoopback bool, results []*Result) *SummaryTable

type TestCaseState added in v0.1.0

type TestCaseState struct {
	Kubernetes kube.IKubernetes
	Resources  *probe.Resources
	Policies   []*networkingv1.NetworkPolicy
}

func (*TestCaseState) CreateNamespace added in v0.2.4

func (t *TestCaseState) CreateNamespace(ns string, labels map[string]string) error

func (*TestCaseState) CreatePod added in v0.2.4

func (t *TestCaseState) CreatePod(ns string, pod string, labels map[string]string) error

func (*TestCaseState) CreatePolicy added in v0.1.0

func (t *TestCaseState) CreatePolicy(policy *networkingv1.NetworkPolicy) error

func (*TestCaseState) DeleteNamespace added in v0.2.4

func (t *TestCaseState) DeleteNamespace(ns string) error

func (*TestCaseState) DeletePod added in v0.2.4

func (t *TestCaseState) DeletePod(ns string, pod string) error

func (*TestCaseState) DeletePolicy added in v0.1.0

func (t *TestCaseState) DeletePolicy(ns string, name string) error

func (*TestCaseState) ReadPolicies added in v0.1.0

func (t *TestCaseState) ReadPolicies(namespaces []string) error

func (*TestCaseState) ResetClusterState added in v0.3.0

func (t *TestCaseState) ResetClusterState() error

func (*TestCaseState) SetNamespaceLabels added in v0.1.0

func (t *TestCaseState) SetNamespaceLabels(ns string, labels map[string]string) error

func (*TestCaseState) SetPodLabels added in v0.1.0

func (t *TestCaseState) SetPodLabels(ns string, pod string, labels map[string]string) error

func (*TestCaseState) UpdatePolicy added in v0.1.0

func (t *TestCaseState) UpdatePolicy(policy *networkingv1.NetworkPolicy) error

func (*TestCaseState) VerifyClusterState added in v0.3.0

func (t *TestCaseState) VerifyClusterState() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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