From 0ab0e404b83862819b4507b83ff654b9dded1ca7 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 22 Sep 2023 11:12:33 -0400 Subject: [PATCH] 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. --- pkg/proxy/iptables/proxier_test.go | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/pkg/proxy/iptables/proxier_test.go b/pkg/proxy/iptables/proxier_test.go index 5af5159d3b2..7e3d1519818 100644 --- a/pkg/proxy/iptables/proxier_test.go +++ b/pkg/proxy/iptables/proxier_test.go @@ -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").