pkg/util/iptables: use buf.String() instead of string(buf.Bytes())

Signed-off-by: TommyStarK <thomasmilox@gmail.com>
This commit is contained in:
TommyStarK
2023-06-04 15:52:44 +02:00
parent eca1f9d2d5
commit 1fcfd1d509
4 changed files with 14 additions and 9 deletions

View File

@@ -962,7 +962,7 @@ func TestLineBufferWrite(t *testing.T) {
t.Run(testCase.name, func(t *testing.T) {
testBuffer.Reset()
testBuffer.Write(testCase.input...)
if want, got := testCase.expected, string(testBuffer.Bytes()); !strings.EqualFold(want, got) {
if want, got := testCase.expected, testBuffer.String(); !strings.EqualFold(want, got) {
t.Fatalf("write word is %v\n expected: %q, got: %q", testCase.input, want, got)
}
if testBuffer.Lines() != 1 {
@@ -1005,7 +1005,7 @@ func TestLineBufferWriteBytes(t *testing.T) {
t.Run(testCase.name, func(t *testing.T) {
testBuffer.Reset()
testBuffer.WriteBytes(testCase.bytes)
if want, got := testCase.expected, string(testBuffer.Bytes()); !strings.EqualFold(want, got) {
if want, got := testCase.expected, testBuffer.String(); !strings.EqualFold(want, got) {
t.Fatalf("write bytes is %v\n expected: %s, got: %s", testCase.bytes, want, got)
}
})