beacondbtest

package
v0.4.0 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: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Info1 = []IfInfo{
		{
			IA:     ia311,
			Egress: 10,
		},
	}

	Info2 = []IfInfo{
		{
			IA:     ia330,
			Egress: 4,
		},
		{
			IA:      ia331,
			Ingress: 1,
			Egress:  4,
			Peers:   []PeerEntry{{IA: ia311, Ingress: 4}},
		},
	}

	Info3 = []IfInfo{
		{
			IA:     ia330,
			Egress: 5,
		},
		{
			IA:      ia331,
			Ingress: 2,
			Egress:  3,
			Peers:   []PeerEntry{{IA: ia311, Ingress: 6}},
		},
		{
			IA:      ia332,
			Ingress: 1,
			Egress:  7,
		},
	}
)

Functions

func AllocBeacon

func AllocBeacon(t *testing.T, ctrl *gomock.Controller, ases []IfInfo, inIfId common.IFIDType,
	infoTS uint32) (beacon.Beacon, common.RawBytes)

func CheckEmpty

func CheckEmpty(t *testing.T, name string, results <-chan beacon.BeaconOrErr, err error)

CheckEmpty checks that no beacon is in the result channel.

func CheckEmptyRevs

func CheckEmptyRevs(t *testing.T, results <-chan beacon.RevocationOrErr, err error)

func CheckResult

func CheckResult(t *testing.T, results <-chan beacon.BeaconOrErr, expected beacon.Beacon)

CheckResult checks that the expected beacon is returned in results, and that it is the only returned beacon

func CheckResults

func CheckResults(t *testing.T, results <-chan beacon.BeaconOrErr,
	expectedBeacons []beacon.Beacon)

func CheckRevs

func CheckRevs(t *testing.T, results <-chan beacon.RevocationOrErr,
	expectedRevs []*path_mgmt.SignedRevInfo)

func InsertBeacon

func InsertBeacon(t *testing.T, ctrl *gomock.Controller, db beacon.DBReadWrite, ases []IfInfo,
	inIfId common.IFIDType, infoTS uint32, allowed beacon.Usage) beacon.Beacon

func InsertRevocation

func InsertRevocation(t *testing.T, db beacon.DBReadWrite, sRev *path_mgmt.SignedRevInfo)

func Test

func Test(t *testing.T, db Testable)

Test should be used to test any implementation of the BeaconDB interface. An implementation of the BeaconDB interface should at least have one test method that calls this test-suite.

Types

type IfInfo

type IfInfo struct {
	IA      addr.IA
	Ingress common.IFIDType
	Egress  common.IFIDType
	Peers   []PeerEntry
}

type PeerEntry

type PeerEntry struct {
	IA      addr.IA
	Ingress common.IFIDType
}

type Testable

type Testable interface {
	beacon.DB
	// Prepare should reset the internal state so that the DB is empty and is
	// ready to be tested.
	Prepare(t *testing.T, ctx context.Context)
}

Testable extends the beacon db interface with methods that are needed for testing.

Jump to

Keyboard shortcuts

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