Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultNormalizePacket ¶
DefaultNormalizePacket zeroes-out all the fields in the packet that can't generally be predicted by the test, both in received and in expected packet and thus makes them equal even if the field value varies among test runs.
Types ¶
type Case ¶
type Case struct { Name string WriteTo, ReadFrom string Input, Want []byte StoreDir string IgnoreNonMatching bool // NormalizePacket is a function that will be called both on actual and // expected packet. It can modify the packet fields so that unpredictable // values are zeroed out and the packets match. NormalizePacket NormalizePacketFn }
Case represents a border router test case.
type ExpectedPacket ¶
type ExpectedPacket struct { Storer packetStorer DevName string Timeout time.Duration IgnoreNonMatching bool Pkt gopacket.Packet }
ExpectedPacket fully describes a packet to be expected. To expect an empty packet a nil Pkt value can be used.
type NormalizePacketFn ¶
type RunConfig ¶
type RunConfig struct {
// contains filtered or unexported fields
}
RunConfig contains handles to all devices used in the acceptance test and should be used to read/write from devices.
func NewRunConfig ¶
NewRunConfig creates a new run configuration. After usage Close should be called and the object should be GC'ed before it is safe to use again.
func (*RunConfig) ExpectPacket ¶
func (c *RunConfig) ExpectPacket(pkt ExpectedPacket, normalizeFn NormalizePacketFn) error
ExpectPacket expects packet pkt on the device devName. It stores all received packets using the storer. If the received packet in the device is matching the expected packet and no other packet is received nil is returned. Otherwise details of what went wrong are returned in the error.