proxy/iptables: Misc improvements to unit test

The original tests here were very shy about looking at the iptables
output, and just relied on checks like "make sure there's a jump to
table X that also includes string Y somewhere in it" and stuff like
that. Whereas the newer tests were just like, "eh, here's a wall of
text, make sure the iptables output is exactly that". Although the
latter looks messier in the code, it's more precise, and it's easier
to update correctly when you change the rules. So just make all of the
tests do a check on the full iptables output.

(Note that I didn't double-check any of the output; I'm just assuming
that the output of the current iptables proxy code is actually
correct...)

Also, don't hardcode the expected number of rules in the metrics
tests, so that there's one less thing to adjust when rules change.

Also, use t.Run() in one place to get more precise errors on failure.
This commit is contained in:
Dan Winship 2021-10-25 18:09:38 -04:00
parent a1a12ca1da
commit 9403bfb178

File diff suppressed because it is too large Load Diff