MCPcopy Create free account
hub / github.com/google/nftables / TestCreateListFlowtable

Function TestCreateListFlowtable

nftables_test.go:4146–4177  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

4144}
4145
4146func TestCreateListFlowtable(t *testing.T) {
4147 c, newNS := nftest.OpenSystemConn(t, *enableSysTests)
4148 defer nftest.CleanupSystemConn(t, newNS)
4149 c.FlushRuleset()
4150 defer c.FlushRuleset()
4151
4152 filter := &nftables.Table{
4153 Family: nftables.TableFamilyIPv4,
4154 Name: "filter",
4155 }
4156
4157 flowtable := &nftables.Flowtable{
4158 Table: filter,
4159 Name: "flowtable_test",
4160 }
4161
4162 c.AddTable(filter)
4163 c.AddFlowtable(flowtable)
4164
4165 if err := c.Flush(); err != nil {
4166 t.Fatalf("c.Flush() failed: %v", err)
4167 }
4168
4169 flowtables, err := c.ListFlowtables(filter)
4170 if err != nil {
4171 t.Fatalf("c.ListFlowtables() failed: %v", err)
4172 }
4173
4174 if got, want := len(flowtables), 1; got != want {
4175 t.Fatalf("flowtable entry length mismatch: got %d, want %d", got, want)
4176 }
4177}
4178
4179func TestCreateListFlowtableWithDevices(t *testing.T) {
4180 c, newNS := nftest.OpenSystemConn(t, *enableSysTests)

Callers

nothing calls this directly

Calls 7

OpenSystemConnFunction · 0.92
CleanupSystemConnFunction · 0.92
FlushRulesetMethod · 0.80
AddTableMethod · 0.80
AddFlowtableMethod · 0.80
FlushMethod · 0.80
ListFlowtablesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…