Documentation ¶
Overview ¶
Package nftest contains utility functions for nftables testing.
Index ¶
- func CleanupSystemConn(t *testing.T, newNS netns.NsHandle)
- func Diff(got []netlink.Message, want [][]byte) string
- func MatchRulesetBytes(t *testing.T, fillRuleset func(c *nftables.Conn), want [][]byte)
- func OpenSystemConn(t *testing.T, enableSysTests bool) (*nftables.Conn, netns.NsHandle)
- type Recorder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diff ¶
Diff returns the first difference between the specified netlink messages and the expected netlink message payloads.
func MatchRulesetBytes ¶
MatchRulesetBytes is a test helper that ensures the fillRuleset modifications correspond to the provided want netlink message payloads
func OpenSystemConn ¶
OpenSystemConn returns a netlink connection that tests against the running kernel in a separate network namespace. nftest.CleanupSystemConn() must be called from a defer to cleanup created network namespace.
Types ¶
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder provides an nftables connection that does not send to the Linux kernel but instead records netlink messages into the recorder. The recorded requests can later be obtained using Requests and compared using Diff.