netconfig_test: reset DefaultCounter to catch preservation issues

This commit is contained in:
Michael Stapelberg 2018-06-28 20:07:40 +02:00
parent c1de25f18b
commit 8615c40fac

View File

@ -128,7 +128,6 @@ func TestNetconfig(t *testing.T) {
} }
netconfig.DefaultCounter = expr.Counter{Packets: 23, Bytes: 42} netconfig.DefaultCounter = expr.Counter{Packets: 23, Bytes: 42}
if err := netconfig.Apply(tmp, filepath.Join(tmp, "root")); err != nil { if err := netconfig.Apply(tmp, filepath.Join(tmp, "root")); err != nil {
t.Fatalf("netconfig.Apply: %v", err) t.Fatalf("netconfig.Apply: %v", err)
} }
@ -136,6 +135,7 @@ func TestNetconfig(t *testing.T) {
// Apply twice to ensure the absence of errors when dealing with // Apply twice to ensure the absence of errors when dealing with
// already-configured interfaces, addresses, routes, … (and ensure // already-configured interfaces, addresses, routes, … (and ensure
// nftables rules are replaced, not appendend to). // nftables rules are replaced, not appendend to).
netconfig.DefaultCounter = expr.Counter{Packets: 0, Bytes: 0}
if err := netconfig.Apply(tmp, filepath.Join(tmp, "root")); err != nil { if err := netconfig.Apply(tmp, filepath.Join(tmp, "root")); err != nil {
t.Fatalf("netconfig.Apply: %v", err) t.Fatalf("netconfig.Apply: %v", err)
} }