Skip to content

x/net/{ipv4,ipv6}: multicastlistener_test.go assumes a specific port is available #20558

Closed
@bcmills

Description

@bcmills

There are two tests in this file that assume that IPv6 port 1024 is available:

https://github.com/golang/net/blob/master/ipv6/multicastlistener_test.go#L73:

c1, err := net.ListenPacket("udp6", "[ff02::]:1024") // wildcard address with reusable port
if err != nil {
	t.Fatal(err)
}
defer c1.Close()

c2, err := net.ListenPacket("udp6", "[ff02::]:1024") // wildcard address with reusable port
if err != nil {
	t.Fatal(err)
}
defer c2.Close()

https://github.com/golang/net/blob/master/ipv6/multicastlistener_test.go#L140

c, err := net.ListenPacket("udp6", fmt.Sprintf("[%s%%%s]:1024", ip.String(), ifi.Name)) // unicast address with non-reusable port
if err != nil {
	t.Fatal(err)
}

That makes the test excessively fragile when run on a machine that may have open IPv6 connections.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions