itests: Deflake TestNetBlockIPAddr
This commit is contained in:
parent
b412d8c179
commit
825564a994
@ -5,6 +5,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/libp2p/go-libp2p/core/network"
|
"github.com/libp2p/go-libp2p/core/network"
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"github.com/libp2p/go-libp2p/core/peer"
|
||||||
@ -263,9 +264,12 @@ func TestNetBlockIPAddr(t *testing.T) {
|
|||||||
|
|
||||||
// a QUIC connection might still succeed when gated, but will be killed right after the handshake
|
// a QUIC connection might still succeed when gated, but will be killed right after the handshake
|
||||||
_ = secondNode.NetConnect(ctx, firstAddrInfo)
|
_ = secondNode.NetConnect(ctx, firstAddrInfo)
|
||||||
|
|
||||||
|
require.Eventually(t, func() bool {
|
||||||
connectedness, err = secondNode.NetConnectedness(ctx, firstAddrInfo.ID)
|
connectedness, err = secondNode.NetConnectedness(ctx, firstAddrInfo.ID)
|
||||||
require.NoError(t, err, "failed to determine connectedness")
|
require.NoError(t, err, "failed to determine connectedness")
|
||||||
require.NotEqual(t, connectedness, network.Connected)
|
return connectedness != network.Connected
|
||||||
|
}, time.Second*5, time.Millisecond*10)
|
||||||
|
|
||||||
// stm: @NETWORK_COMMON_BLOCK_REMOVE_001
|
// stm: @NETWORK_COMMON_BLOCK_REMOVE_001
|
||||||
err = firstNode.NetBlockRemove(ctx, api.NetBlockList{IPAddrs: secondNodeIPs})
|
err = firstNode.NetBlockRemove(ctx, api.NetBlockList{IPAddrs: secondNodeIPs})
|
||||||
|
Loading…
Reference in New Issue
Block a user