Skip to content

Commit

Permalink
fix: flaky TestAutoRestartAfterBouncingInitiator (sleep before starti…
Browse files Browse the repository at this point in the history
…ng new initiator) (#275)
  • Loading branch information
dirkmc committed Oct 15, 2021
1 parent 83ec063 commit 14b7f03
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion impl/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ func TestAutoRestart(t *testing.T) {
// 5. The connection is broken when the first block is received
// 6. The connection is automatically re-established and the transfer completes
func TestAutoRestartAfterBouncingInitiator(t *testing.T) {
//SetDTLogLevelDebug()
SetDTLogLevelDebug()

runTest := func(t *testing.T, isPush bool) {
ctx := context.Background()
Expand Down Expand Up @@ -1008,13 +1008,18 @@ func TestAutoRestartAfterBouncingInitiator(t *testing.T) {
require.NoError(t, gsData.Mn.UnlinkPeers(initiatorHost.ID(), responderHost.ID()))
require.NoError(t, gsData.Mn.DisconnectPeers(initiatorHost.ID(), responderHost.ID()))

time.Sleep(100 * time.Millisecond)

// We want to simulate shutting down and restarting the initiator of
// the data transfer:
// 1. Shut down the initiator of the data transfer
t.Logf("Stopping initiator")
err = initiator.Stop(ctx)
require.NoError(t, err)

t.Logf("Sleep for a moment")
time.Sleep(500 * time.Millisecond)

// 2. Create a new initiator
initiator2GSTspt := gsData.SetupGSTransportHost1()
initiator2, err := NewDataTransfer(gsData.DtDs1, gsData.TempDir1, gsData.DtNet1, initiator2GSTspt, restartConf)
Expand Down

0 comments on commit 14b7f03

Please sign in to comment.