summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/tests
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@google.com>2021-01-15 15:47:13 -0800
committergVisor bot <gvisor-bot@google.com>2021-01-15 15:49:15 -0800
commit12d9790833cc2f6a9b197066a5ecbeb434f74164 (patch)
treee9eec8e4c755c33c5a30c1912422b28380ed1f53 /pkg/tcpip/tests
parentf37ace6661dfed8acae7e22ed0eb9ad78bdeab34 (diff)
Remove count argument from tcpip.Endpoint.Read
The same intent can be specified via the io.Writer. PiperOrigin-RevId: 352098747
Diffstat (limited to 'pkg/tcpip/tests')
-rw-r--r--pkg/tcpip/tests/integration/forward_test.go2
-rw-r--r--pkg/tcpip/tests/integration/link_resolution_test.go2
-rw-r--r--pkg/tcpip/tests/integration/loopback_test.go4
-rw-r--r--pkg/tcpip/tests/integration/multicast_broadcast_test.go10
-rw-r--r--pkg/tcpip/tests/integration/route_test.go9
5 files changed, 13 insertions, 14 deletions
diff --git a/pkg/tcpip/tests/integration/forward_test.go b/pkg/tcpip/tests/integration/forward_test.go
index 49acd504e..ac9670f9a 100644
--- a/pkg/tcpip/tests/integration/forward_test.go
+++ b/pkg/tcpip/tests/integration/forward_test.go
@@ -457,7 +457,7 @@ func TestForwarding(t *testing.T) {
<-ch
var buf bytes.Buffer
opts := tcpip.ReadOptions{NeedRemoteAddr: subTest.needRemoteAddr}
- res, err := ep.Read(&buf, len(data), opts)
+ res, err := ep.Read(&buf, opts)
if err != nil {
t.Fatalf("ep.Read(_, %d, %#v): %s", len(data), opts, err)
}
diff --git a/pkg/tcpip/tests/integration/link_resolution_test.go b/pkg/tcpip/tests/integration/link_resolution_test.go
index ed00c90d4..3f06c2145 100644
--- a/pkg/tcpip/tests/integration/link_resolution_test.go
+++ b/pkg/tcpip/tests/integration/link_resolution_test.go
@@ -218,7 +218,7 @@ func TestPing(t *testing.T) {
var buf bytes.Buffer
opts := tcpip.ReadOptions{NeedRemoteAddr: true}
- res, err := ep.Read(&buf, len(icmpBuf), opts)
+ res, err := ep.Read(&buf, opts)
if err != nil {
t.Fatalf("ep.Read(_, %d, %#v): %s", len(icmpBuf), opts, err)
}
diff --git a/pkg/tcpip/tests/integration/loopback_test.go b/pkg/tcpip/tests/integration/loopback_test.go
index a59f25cc3..3b13ba04d 100644
--- a/pkg/tcpip/tests/integration/loopback_test.go
+++ b/pkg/tcpip/tests/integration/loopback_test.go
@@ -242,9 +242,9 @@ func TestLoopbackAcceptAllInSubnetUDP(t *testing.T) {
var buf bytes.Buffer
opts := tcpip.ReadOptions{NeedRemoteAddr: true}
- if res, err := rep.Read(&buf, len(data), opts); test.expectRx {
+ if res, err := rep.Read(&buf, opts); test.expectRx {
if err != nil {
- t.Fatalf("rep.Read(_, %d, %#v): %s", len(data), opts, err)
+ t.Fatalf("rep.Read(_, %#v): %s", opts, err)
}
if diff := cmp.Diff(tcpip.ReadResult{
Count: buf.Len(),
diff --git a/pkg/tcpip/tests/integration/multicast_broadcast_test.go b/pkg/tcpip/tests/integration/multicast_broadcast_test.go
index eabc87938..ce7c16bd1 100644
--- a/pkg/tcpip/tests/integration/multicast_broadcast_test.go
+++ b/pkg/tcpip/tests/integration/multicast_broadcast_test.go
@@ -466,9 +466,9 @@ func TestIncomingMulticastAndBroadcast(t *testing.T) {
test.rxUDP(e, test.remoteAddr, test.dstAddr, data)
var buf bytes.Buffer
var opts tcpip.ReadOptions
- if res, err := ep.Read(&buf, len(data), opts); test.expectRx {
+ if res, err := ep.Read(&buf, opts); test.expectRx {
if err != nil {
- t.Fatalf("ep.Read(_, %d, %#v): %s", len(data), opts, err)
+ t.Fatalf("ep.Read(_, %#v): %s", opts, err)
}
if diff := cmp.Diff(tcpip.ReadResult{
Count: buf.Len(),
@@ -598,7 +598,7 @@ func TestReuseAddrAndBroadcast(t *testing.T) {
<-rep.ch
var buf bytes.Buffer
- result, err := rep.ep.Read(&buf, len(data), tcpip.ReadOptions{})
+ result, err := rep.ep.Read(&buf, tcpip.ReadOptions{})
if err != nil {
t.Errorf("(eps[%d] write) eps[%d].Read: %s", i, j, err)
continue
@@ -738,7 +738,7 @@ func TestUDPAddRemoveMembershipSocketOption(t *testing.T) {
}
test.rxUDP(e, test.remoteAddr, test.multicastAddr, data)
var buf bytes.Buffer
- result, err := ep.Read(&buf, len(data), tcpip.ReadOptions{})
+ result, err := ep.Read(&buf, tcpip.ReadOptions{})
if err != nil {
t.Fatalf("ep.Read: %s", err)
} else {
@@ -759,7 +759,7 @@ func TestUDPAddRemoveMembershipSocketOption(t *testing.T) {
if err := ep.SetSockOpt(&removeOpt); err != nil {
t.Fatalf("ep.SetSockOpt(&%#v): %s", removeOpt, err)
}
- if _, err := ep.Read(&buf, 1, tcpip.ReadOptions{}); err != tcpip.ErrWouldBlock {
+ if _, err := ep.Read(&buf, tcpip.ReadOptions{}); err != tcpip.ErrWouldBlock {
t.Fatalf("got ep.Read = (_, %s), want = (_, %s)", err, tcpip.ErrWouldBlock)
}
})
diff --git a/pkg/tcpip/tests/integration/route_test.go b/pkg/tcpip/tests/integration/route_test.go
index 76f7f54c6..b222d2b05 100644
--- a/pkg/tcpip/tests/integration/route_test.go
+++ b/pkg/tcpip/tests/integration/route_test.go
@@ -16,7 +16,6 @@ package integration_test
import (
"bytes"
- "math"
"testing"
"github.com/google/go-cmp/cmp"
@@ -208,9 +207,9 @@ func TestLocalPing(t *testing.T) {
var buf bytes.Buffer
opts := tcpip.ReadOptions{NeedRemoteAddr: true}
- res, err := ep.Read(&buf, math.MaxUint16, opts)
+ res, err := ep.Read(&buf, opts)
if err != nil {
- t.Fatalf("ep.Read(_, %d, %#v): %s", math.MaxUint16, opts, err)
+ t.Fatalf("ep.Read(_, %#v): %s", opts, err)
}
if diff := cmp.Diff(tcpip.ReadResult{
Count: buf.Len(),
@@ -351,7 +350,7 @@ func TestLocalUDP(t *testing.T) {
var clientAddr tcpip.FullAddress
var readBuf bytes.Buffer
- if read, err := server.Read(&readBuf, math.MaxUint16, tcpip.ReadOptions{NeedRemoteAddr: true}); err != nil {
+ if read, err := server.Read(&readBuf, tcpip.ReadOptions{NeedRemoteAddr: true}); err != nil {
t.Fatalf("server.Read(_): %s", err)
} else {
clientAddr = read.RemoteAddr
@@ -393,7 +392,7 @@ func TestLocalUDP(t *testing.T) {
<-clientCH
readBuf.Reset()
- if read, err := client.Read(&readBuf, math.MaxUint16, tcpip.ReadOptions{NeedRemoteAddr: true}); err != nil {
+ if read, err := client.Read(&readBuf, tcpip.ReadOptions{NeedRemoteAddr: true}); err != nil {
t.Fatalf("client.Read(_): %s", err)
} else {
if diff := cmp.Diff(tcpip.ReadResult{