Skip to content

Commit 14b7f03

Browse files
authored
fix: flaky TestAutoRestartAfterBouncingInitiator (sleep before starting new initiator) (#275)
1 parent 83ec063 commit 14b7f03

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

impl/integration_test.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ func TestAutoRestart(t *testing.T) {
897897
// 5. The connection is broken when the first block is received
898898
// 6. The connection is automatically re-established and the transfer completes
899899
func TestAutoRestartAfterBouncingInitiator(t *testing.T) {
900-
//SetDTLogLevelDebug()
900+
SetDTLogLevelDebug()
901901

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

1011+
time.Sleep(100 * time.Millisecond)
1012+
10111013
// We want to simulate shutting down and restarting the initiator of
10121014
// the data transfer:
10131015
// 1. Shut down the initiator of the data transfer
10141016
t.Logf("Stopping initiator")
10151017
err = initiator.Stop(ctx)
10161018
require.NoError(t, err)
10171019

1020+
t.Logf("Sleep for a moment")
1021+
time.Sleep(500 * time.Millisecond)
1022+
10181023
// 2. Create a new initiator
10191024
initiator2GSTspt := gsData.SetupGSTransportHost1()
10201025
initiator2, err := NewDataTransfer(gsData.DtDs1, gsData.TempDir1, gsData.DtNet1, initiator2GSTspt, restartConf)

0 commit comments

Comments
 (0)