From 14b7f03f599dc256c765e4089b69997bf5c9796c Mon Sep 17 00:00:00 2001 From: dirkmc Date: Fri, 15 Oct 2021 16:50:01 +0200 Subject: [PATCH] fix: flaky TestAutoRestartAfterBouncingInitiator (sleep before starting new initiator) (#275) --- impl/integration_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/impl/integration_test.go b/impl/integration_test.go index ecf22314..6557cc38 100644 --- a/impl/integration_test.go +++ b/impl/integration_test.go @@ -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() @@ -1008,6 +1008,8 @@ 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 @@ -1015,6 +1017,9 @@ func TestAutoRestartAfterBouncingInitiator(t *testing.T) { 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)