Documentation ¶
Overview ¶
Package packet_test contains some utility functions for creating feature tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FeatureLine ¶
type FeatureLine struct { // When is the point in time this was exported When flows.DateTimeNanoseconds // Features is a list of feature results Features []FeatureResult }
FeatureLine holds one record (i.e. Feature results + point in time)
type FeatureResult ¶
type FeatureResult struct { // Name of the feature Name string // Value of the feature Value interface{} }
FeatureResult holds the result for the named feature
type TestTable ¶
type TestTable struct {
// contains filtered or unexported fields
}
TestTable is flow table implementation which can be used for testing
func MakeFeatureTest ¶
func MakeFeatureTest(t *testing.T, features []string, ft flows.FeatureType, opt flows.FlowOptions) (ret TestTable)
MakeFeatureTest creates a flow table for testing purposes with the given features, wanted return type, and flow options
func MakeFlowFeatureTest ¶
MakeFlowFeatureTest returns a flow table for testing a single flow feature
func MakePacketFeatureTest ¶
MakePacketFeatureTest returns a flow table for testing a single packet feature
func (*TestTable) AssertFeatureList ¶
func (t *TestTable) AssertFeatureList(result []FeatureLine)
AssertFeatureList fails the test if the table did not export the given resultset
func (*TestTable) AssertFeatureValue ¶
AssertFeatureValue fails the test if the named feature did not return the expected value
func (*TestTable) EventLayers ¶
func (t *TestTable) EventLayers(when flows.DateTimeNanoseconds, layerList ...packet.SerializableLayerType)
EventLayers simulates a packet arriving at the given point in time with the given layers populated
func (*TestTable) Finish ¶
func (t *TestTable) Finish(when flows.DateTimeNanoseconds)
Finish finalizes all the flows in the table