mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 04:27:54 +00:00
Merge pull request #118433 from testwill/ipvs
chore: should use buf.String() instead of string(buf.Bytes())
This commit is contained in:
commit
eca1f9d2d5
@ -1698,7 +1698,7 @@ func TestMasqueradeRule(t *testing.T) {
|
|||||||
|
|
||||||
buf := bytes.NewBuffer(nil)
|
buf := bytes.NewBuffer(nil)
|
||||||
_ = ipt.SaveInto(utiliptables.TableNAT, buf)
|
_ = ipt.SaveInto(utiliptables.TableNAT, buf)
|
||||||
natRules := strings.Split(string(buf.Bytes()), "\n")
|
natRules := strings.Split(buf.String(), "\n")
|
||||||
var hasMasqueradeJump, hasMasqRandomFully bool
|
var hasMasqueradeJump, hasMasqRandomFully bool
|
||||||
for _, line := range natRules {
|
for _, line := range natRules {
|
||||||
rule, _ := iptablestest.ParseRule(line, false)
|
rule, _ := iptablestest.ParseRule(line, false)
|
||||||
@ -3890,7 +3890,7 @@ func getRules(ipt *iptablestest.FakeIPTables, chain utiliptables.Chain) []*iptab
|
|||||||
buf := bytes.NewBuffer(nil)
|
buf := bytes.NewBuffer(nil)
|
||||||
_ = ipt.SaveInto(utiliptables.TableNAT, buf)
|
_ = ipt.SaveInto(utiliptables.TableNAT, buf)
|
||||||
_ = ipt.SaveInto(utiliptables.TableFilter, buf)
|
_ = ipt.SaveInto(utiliptables.TableFilter, buf)
|
||||||
lines := strings.Split(string(buf.Bytes()), "\n")
|
lines := strings.Split(buf.String(), "\n")
|
||||||
for _, l := range lines {
|
for _, l := range lines {
|
||||||
if !strings.HasPrefix(l, "-A ") {
|
if !strings.HasPrefix(l, "-A ") {
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user