kube-proxy: minor cleanup
Get rid of overlapping helper functions.
This commit is contained in:
@@ -1183,44 +1183,6 @@ func TestWriteLine(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriteRuleLine(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
chainName string
|
||||
words []string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "write no line due to no words",
|
||||
chainName: "KUBE-SVC-FOO",
|
||||
words: []string{},
|
||||
expected: "",
|
||||
},
|
||||
{
|
||||
name: "write one line",
|
||||
chainName: "KUBE-XLB-FOO",
|
||||
words: []string{"test1"},
|
||||
expected: "-A KUBE-XLB-FOO test1\n",
|
||||
},
|
||||
{
|
||||
name: "write multi word line",
|
||||
chainName: "lolChain",
|
||||
words: []string{"test1", "test2", "test3"},
|
||||
expected: "-A lolChain test1 test2 test3\n",
|
||||
},
|
||||
}
|
||||
testBuffer := bytes.NewBuffer(nil)
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
testBuffer.Reset()
|
||||
WriteRuleLine(testBuffer, testCase.chainName, testCase.words...)
|
||||
if !strings.EqualFold(testBuffer.String(), testCase.expected) {
|
||||
t.Fatalf("write word is %v\n expected: %s, got: %s", testCase.words, testCase.expected, testBuffer.String())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriteBytesLine(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
|
Reference in New Issue
Block a user