Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swarm: remove parallel tests from swarm tests #2130

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 3 additions & 19 deletions p2p/net/swarm/dial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ func closeSwarms(swarms []*swarm.Swarm) {
}

func TestBasicDialPeer(t *testing.T) {
t.Parallel()

swarms := makeSwarms(t, 2)
defer closeSwarms(swarms)
s1 := swarms[0]
Expand All @@ -47,8 +45,6 @@ func TestBasicDialPeer(t *testing.T) {
}

func TestBasicDialPeerWithResolver(t *testing.T) {
t.Parallel()

mockResolver := madns.MockResolver{IP: make(map[string][]net.IPAddr)}
ipaddr, err := net.ResolveIPAddr("ip4", "127.0.0.1")
require.NoError(t, err)
Expand Down Expand Up @@ -85,8 +81,6 @@ func TestBasicDialPeerWithResolver(t *testing.T) {
}

func TestDialWithNoListeners(t *testing.T) {
t.Parallel()

s1 := makeDialOnlySwarm(t)
swarms := makeSwarms(t, 1)
defer closeSwarms(swarms)
Expand Down Expand Up @@ -119,8 +113,6 @@ func acceptAndHang(l net.Listener) {
}

func TestSimultDials(t *testing.T) {
t.Parallel()

ctx := context.Background()
swarms := makeSwarms(t, 2, swarmt.OptDisableReuseport)
defer closeSwarms(swarms)
Expand Down Expand Up @@ -194,7 +186,7 @@ func newSilentPeer(t *testing.T) (peer.ID, ma.Multiaddr, net.Listener) {
}

func TestDialWait(t *testing.T) {
const dialTimeout = 250 * time.Millisecond
const dialTimeout = 5 * time.Second

swarms := makeSwarms(t, 1, swarmt.WithSwarmOpts(swarm.WithDialTimeout(dialTimeout)))
s1 := swarms[0]
Expand Down Expand Up @@ -231,8 +223,6 @@ func TestDialBackoff(t *testing.T) {
if ci.IsRunning() {
t.Skip("travis will never have fun with this test")
}
t.Parallel()

const dialTimeout = 100 * time.Millisecond

ctx := context.Background()
Expand Down Expand Up @@ -436,9 +426,7 @@ func TestDialBackoff(t *testing.T) {
}

func TestDialBackoffClears(t *testing.T) {
t.Parallel()

const dialTimeout = 250 * time.Millisecond
const dialTimeout = 3 * time.Second
swarms := makeSwarms(t, 2, swarmt.WithSwarmOpts(swarm.WithDialTimeout(dialTimeout)))
defer closeSwarms(swarms)
s1 := swarms[0]
Expand Down Expand Up @@ -478,8 +466,6 @@ func TestDialBackoffClears(t *testing.T) {
}

func TestDialPeerFailed(t *testing.T) {
t.Parallel()

swarms := makeSwarms(t, 2, swarmt.WithSwarmOpts(swarm.WithDialTimeout(100*time.Millisecond)))
defer closeSwarms(swarms)
testedSwarm, targetSwarm := swarms[0], swarms[1]
Expand Down Expand Up @@ -552,7 +538,7 @@ func newSilentListener(t *testing.T) ([]ma.Multiaddr, net.Listener) {
}

func TestDialSimultaneousJoin(t *testing.T) {
const dialTimeout = 250 * time.Millisecond
const dialTimeout = 3 * time.Second
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? This one test now takes 3s.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I'm pretty sure I saw this test flake here because of the dialTimeout. 1s might be okay as well but 3s definitely is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine for now, but long term, we'll need to find a faster solution for this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's much much lower hanging fruit than this.

  1. We can use a build cache
  2. We can split the 32bit tests/race tests into a separate job so they can run in parallel. With a build cache, these won't waste too much time in duplicated efforts.


swarms := makeSwarms(t, 2, swarmt.WithSwarmOpts(swarm.WithDialTimeout(dialTimeout)))
defer closeSwarms(swarms)
Expand Down Expand Up @@ -649,8 +635,6 @@ func TestDialSimultaneousJoin(t *testing.T) {
}

func TestDialSelf(t *testing.T) {
t.Parallel()

swarms := makeSwarms(t, 2)
defer closeSwarms(swarms)
s1 := swarms[0]
Expand Down