Documentation ¶
Overview ¶
Package graphtest provides test utilities for asserting properties of event graphs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertGraph ¶
func AssertGraph(t *testing.T, bufs [][]byte, numNodes int, asserterMap AsserterMap)
AssertGraph builds a graph from encoded events and asserts properties and edges about each node in asserterMap.
Types ¶
type AssertNodeKVMap ¶
type AssertNodeKVMap map[MatchNodeKV]NodeAsserter
An AssertNodeKVMap describes a list of nodes by {Layer, Label, K, V} and assertions about them.
func (AssertNodeKVMap) AssertMissing ¶
func (m AssertNodeKVMap) AssertMissing(t *testing.T)
AssertMissing ensures each node is seen.
func (AssertNodeKVMap) AssertSeen ¶
func (m AssertNodeKVMap) AssertSeen(t *testing.T, n Node)
AssertSeen ensures each node is seen at most once.
func (AssertNodeKVMap) Match ¶
func (m AssertNodeKVMap) Match(n Node) (ret NodeAsserter, ok bool)
Match a node by KV pair, returning an asserter.
func (AssertNodeKVMap) Size ¶
func (m AssertNodeKVMap) Size() (ret int)
Size returns the number of nodes in the asserted graph.
type AssertNodeMap ¶
type AssertNodeMap map[MatchNode]NodeAsserter
An AssertNodeMap describes a list of nodes by {Layer, Label} and assertions about them.
func (AssertNodeMap) AssertMissing ¶
func (m AssertNodeMap) AssertMissing(t *testing.T)
AssertMissing ensures each node is seen.
func (AssertNodeMap) AssertSeen ¶
func (m AssertNodeMap) AssertSeen(t *testing.T, n Node)
AssertSeen ensures each node is seen at most once.
func (AssertNodeMap) Match ¶
func (m AssertNodeMap) Match(n Node) (NodeAsserter, bool)
Match a node, returning an asserter.
func (AssertNodeMap) Size ¶
func (m AssertNodeMap) Size() (ret int)
Size returns the number of nodes in the asserted graph.
type AsserterMap ¶
type AsserterMap interface { Match(n Node) (NodeAsserter, bool) Size() int AssertSeen(t *testing.T, n Node) AssertMissing(t *testing.T) }
An AsserterMap looks up NodeAsserters for Nodes in a graph, keeping track of which have been seen.
type MatchNode ¶
type MatchNode struct{ Layer, Label string }
MatchNode describes a node by its Layer and Label, used to match for assertions about a node and when listing its outedges.
type MatchNodeKV ¶
type MatchNodeKV struct{ Layer, Label, K, V string }
MatchNodeKV allows a test to assert properties of a node by specifying its Layer, Label and a KV pair.