testing

package
v3.3.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MasterLabel is node label of master
	MasterLabel = "master"
	// MasterID is node ID of master
	MasterID = uint32(1)
	// WorkerLabel is node label of worker
	WorkerLabel = "worker"
	// WorkerID is node ID of worker
	WorkerID = uint32(2)

	// Namespace1 is first testing namespace
	Namespace1 = "default"
	// Namespace2 is second testing namespace
	Namespace2 = "another-ns"

	// MainVrfID is id of main vrf table
	MainVrfID = 1
	// PodVrfID is id of pod vrf table
	PodVrfID = 2
)

Variables

View Source
var (
	// Pod1 is first testing pod
	Pod1 = podmodel.ID{Name: "pod1", Namespace: Namespace1}
	// Pod2 is second testing pod
	Pod2 = podmodel.ID{Name: "pod2", Namespace: Namespace1}
	// Pod3 is third testing pod
	Pod3 = podmodel.ID{Name: "pod3", Namespace: Namespace2}

	// Pod1If is name of interface leading to pod 1
	Pod1If = "master-tap1"
	// Pod2If is name of interface leading to pod 2
	Pod2If = "master-tap2"
)

Functions

func IPNet

func IPNet(address string) (combined *net.IPNet, addrOnly net.IP, network *net.IPNet)

IPNet is helper function for parsing IP network address string into IP adddress, IP network and their combination

Types

type Fixture

type Fixture struct {
	Logger       logging.Logger
	Datasync     *MockDataSync
	ServiceLabel *MockServiceLabel
	NodeSync     *MockNodeSync
	ContivConf   *contivconf.ContivConf
	IPAM         *ipam.IPAM
	PodManager   *MockPodManager
	IPNet        *MockIPNet
	SVCProcessor *svc_processor.ServiceProcessor
	Txn          *Txn
}

Fixture contain everything what is needed (plugins/configs/etc...) to test any kind of k8s service renderer (it doesn't contain the renderer plugin itself and plugins depending on it)

func NewFixture

func NewFixture(testName string, config *config.Config, ipNet *MockIPNet, nodeIPAddr net.IP, nodeIPNet *net.IPNet,
	mgmtIP net.IP, withoutMasterIPs ...bool) *Fixture

NewFixture inits and composes together plugins needed for proper rendering unit testing

type Txn

type Txn struct {
	// contains filtered or unexported fields
}

Txn is mock of ongoing transaction

func (*Txn) Commit

func (t *Txn) Commit() error

Commit is mock commit function for ongoing mock transaction

func (*Txn) ResyncFactory

func (t *Txn) ResyncFactory(txnTracker *localclient.TxnTracker) func() controller.ResyncOperations

ResyncFactory creates factory for mock transaction resync operations

func (*Txn) UpdateFactory

func (t *Txn) UpdateFactory(txnTracker *localclient.TxnTracker) func(change string) controller.UpdateOperations

UpdateFactory creates factory for mock transaction update operations

Jump to

Keyboard shortcuts

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