mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Drop the now-unused assertIPTablesRulesNotEqual
Previously this was used to assert "something changed since the last sync", but we already have packet flow tests in all of those cases now to assert that the *specific* something we care about changed.
This commit is contained in:
parent
4438f5e436
commit
0ab0e404b8
@ -1312,34 +1312,6 @@ func assertIPTablesRulesEqual(t *testing.T, line int, checkConsistency bool, exp
|
||||
}
|
||||
}
|
||||
|
||||
// assertIPTablesRulesNotEqual asserts that the generated rules in result DON'T match the
|
||||
// rules in expected, ignoring irrelevant ordering differences.
|
||||
func assertIPTablesRulesNotEqual(t *testing.T, line int, expected, result string) {
|
||||
expected = strings.TrimLeft(expected, " \t\n")
|
||||
|
||||
result, err := sortIPTablesRules(strings.TrimLeft(result, " \t\n"))
|
||||
if err != nil {
|
||||
t.Fatalf("%s", err)
|
||||
}
|
||||
|
||||
lineStr := ""
|
||||
if line != 0 {
|
||||
lineStr = fmt.Sprintf(" (from line %d)", line)
|
||||
}
|
||||
if cmp.Equal(expected, result) {
|
||||
t.Errorf("rules do not differ%s:\nfull result:\n```\n%s```", lineStr, result)
|
||||
}
|
||||
|
||||
err = checkIPTablesRuleJumps(expected)
|
||||
if err != nil {
|
||||
t.Fatalf("%s", err)
|
||||
}
|
||||
err = checkIPTablesRuleJumps(result)
|
||||
if err != nil {
|
||||
t.Fatalf("%s", err)
|
||||
}
|
||||
}
|
||||
|
||||
// addressMatches helps test whether an iptables rule such as "! -s 192.168.0.0/16" matches
|
||||
// ipStr. address.Value is either an IP address ("1.2.3.4") or a CIDR string
|
||||
// ("1.2.3.0/24").
|
||||
|
Loading…
Reference in New Issue
Block a user