summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/tests/integration/loopback_test.go
diff options
context:
space:
mode:
authorAyush Ranjan <ayushranjan@google.com>2021-02-17 12:53:05 -0800
committergVisor bot <gvisor-bot@google.com>2021-02-17 12:54:55 -0800
commitd8590f6337525416783ee859b6e59ecf17f94066 (patch)
tree9a9849ecc79e5c70ab052e976978d04bae299f71 /pkg/tcpip/tests/integration/loopback_test.go
parent2f35fa14abe546b58c72312fbd23ad3f0b7a193f (diff)
[infra] Split tcpip/integration test targets to aid investigation.
tcpip integration tests have been flaky lately. They usually run in 20 seconds and have a 60 seconds timeout. Sometimes they timeout which could be due to a bug or deadlock. To further investigate it might be helpful to split the targets and see which test is causing the flake. Added a new tcpip/tests/utils package to hold all common utilities across all tests. PiperOrigin-RevId: 358012936
Diffstat (limited to 'pkg/tcpip/tests/integration/loopback_test.go')
-rw-r--r--pkg/tcpip/tests/integration/loopback_test.go35
1 files changed, 18 insertions, 17 deletions
diff --git a/pkg/tcpip/tests/integration/loopback_test.go b/pkg/tcpip/tests/integration/loopback_test.go
index ab67762ef..c56155ea2 100644
--- a/pkg/tcpip/tests/integration/loopback_test.go
+++ b/pkg/tcpip/tests/integration/loopback_test.go
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package integration_test
+package loopback_test
import (
"bytes"
@@ -28,6 +28,7 @@ import (
"gvisor.dev/gvisor/pkg/tcpip/network/ipv4"
"gvisor.dev/gvisor/pkg/tcpip/network/ipv6"
"gvisor.dev/gvisor/pkg/tcpip/stack"
+ "gvisor.dev/gvisor/pkg/tcpip/tests/utils"
"gvisor.dev/gvisor/pkg/tcpip/transport/tcp"
"gvisor.dev/gvisor/pkg/tcpip/transport/udp"
"gvisor.dev/gvisor/pkg/waiter"
@@ -109,7 +110,7 @@ func TestLoopbackAcceptAllInSubnetUDP(t *testing.T) {
ipv4ProtocolAddress := tcpip.ProtocolAddress{
Protocol: header.IPv4ProtocolNumber,
- AddressWithPrefix: ipv4Addr,
+ AddressWithPrefix: utils.Ipv4Addr,
}
ipv4Bytes := []byte(ipv4ProtocolAddress.AddressWithPrefix.Address)
ipv4Bytes[len(ipv4Bytes)-1]++
@@ -117,9 +118,9 @@ func TestLoopbackAcceptAllInSubnetUDP(t *testing.T) {
ipv6ProtocolAddress := tcpip.ProtocolAddress{
Protocol: header.IPv6ProtocolNumber,
- AddressWithPrefix: ipv6Addr,
+ AddressWithPrefix: utils.Ipv6Addr,
}
- ipv6Bytes := []byte(ipv6Addr.Address)
+ ipv6Bytes := []byte(utils.Ipv6Addr.Address)
ipv6Bytes[len(ipv6Bytes)-1]++
otherIPv6Address := tcpip.Address(ipv6Bytes)
@@ -145,7 +146,7 @@ func TestLoopbackAcceptAllInSubnetUDP(t *testing.T) {
{
name: "IPv4 bind to wildcard send to other address",
addAddress: ipv4ProtocolAddress,
- dstAddr: remoteIPv4Addr,
+ dstAddr: utils.RemoteIPv4Addr,
expectRx: false,
},
{
@@ -173,8 +174,8 @@ func TestLoopbackAcceptAllInSubnetUDP(t *testing.T) {
{
name: "IPv6 bind and send to assigned address",
addAddress: ipv6ProtocolAddress,
- bindAddr: ipv6Addr.Address,
- dstAddr: ipv6Addr.Address,
+ bindAddr: utils.Ipv6Addr.Address,
+ dstAddr: utils.Ipv6Addr.Address,
expectRx: true,
},
{
@@ -277,9 +278,9 @@ func TestLoopbackSubnetLifetimeBoundToAddr(t *testing.T) {
protoAddr := tcpip.ProtocolAddress{
Protocol: ipv4.ProtocolNumber,
- AddressWithPrefix: ipv4Addr,
+ AddressWithPrefix: utils.Ipv4Addr,
}
- addrBytes := []byte(ipv4Addr.Address)
+ addrBytes := []byte(utils.Ipv4Addr.Address)
addrBytes[len(addrBytes)-1]++
otherAddr := tcpip.Address(addrBytes)
@@ -299,9 +300,9 @@ func TestLoopbackSubnetLifetimeBoundToAddr(t *testing.T) {
},
})
- r, err := s.FindRoute(nicID, otherAddr, remoteIPv4Addr, ipv4.ProtocolNumber, false /* multicastLoop */)
+ r, err := s.FindRoute(nicID, otherAddr, utils.RemoteIPv4Addr, ipv4.ProtocolNumber, false /* multicastLoop */)
if err != nil {
- t.Fatalf("s.FindRoute(%d, %s, %s, %d, false): %s", nicID, otherAddr, remoteIPv4Addr, ipv4.ProtocolNumber, err)
+ t.Fatalf("s.FindRoute(%d, %s, %s, %d, false): %s", nicID, otherAddr, utils.RemoteIPv4Addr, ipv4.ProtocolNumber, err)
}
defer r.Release()
@@ -344,7 +345,7 @@ func TestLoopbackAcceptAllInSubnetTCP(t *testing.T) {
ipv4ProtocolAddress := tcpip.ProtocolAddress{
Protocol: header.IPv4ProtocolNumber,
- AddressWithPrefix: ipv4Addr,
+ AddressWithPrefix: utils.Ipv4Addr,
}
ipv4ProtocolAddress.AddressWithPrefix.PrefixLen = 8
ipv4Bytes := []byte(ipv4ProtocolAddress.AddressWithPrefix.Address)
@@ -353,9 +354,9 @@ func TestLoopbackAcceptAllInSubnetTCP(t *testing.T) {
ipv6ProtocolAddress := tcpip.ProtocolAddress{
Protocol: header.IPv6ProtocolNumber,
- AddressWithPrefix: ipv6Addr,
+ AddressWithPrefix: utils.Ipv6Addr,
}
- ipv6Bytes := []byte(ipv6Addr.Address)
+ ipv6Bytes := []byte(utils.Ipv6Addr.Address)
ipv6Bytes[len(ipv6Bytes)-1]++
otherIPv6Address := tcpip.Address(ipv6Bytes)
@@ -381,7 +382,7 @@ func TestLoopbackAcceptAllInSubnetTCP(t *testing.T) {
{
name: "IPv4 bind to wildcard send to other address",
addAddress: ipv4ProtocolAddress,
- dstAddr: remoteIPv4Addr,
+ dstAddr: utils.RemoteIPv4Addr,
expectAccept: false,
},
{
@@ -409,8 +410,8 @@ func TestLoopbackAcceptAllInSubnetTCP(t *testing.T) {
{
name: "IPv6 bind and send to assigned address",
addAddress: ipv6ProtocolAddress,
- bindAddr: ipv6Addr.Address,
- dstAddr: ipv6Addr.Address,
+ bindAddr: utils.Ipv6Addr.Address,
+ dstAddr: utils.Ipv6Addr.Address,
expectAccept: true,
},
{