From 887e0d9fa97b1cdb27f868cf655a1470a671d67a Mon Sep 17 00:00:00 2001 From: Fedor Partanskiy Date: Sun, 26 Nov 2023 23:48:10 +0300 Subject: [PATCH] Sometimes there isn't enough time to wait for an event. Increased the time. Fixed working with break operator Signed-off-by: Fedor Partanskiy --- test/basic_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/basic_test.go b/test/basic_test.go index 46995d52..c21f9da1 100644 --- a/test/basic_test.go +++ b/test/basic_test.go @@ -2663,7 +2663,7 @@ func TestViewChangeAfterTryingToFork(t *testing.T) { nodes[4].Connect() // Waiting for a real change of leader and view - fail = time.After(1 * time.Minute) + fail = time.After(90 * time.Second) for i := 0; i < 7; i++ { select { case <-realViewChangeCh: @@ -2675,12 +2675,14 @@ func TestViewChangeAfterTryingToFork(t *testing.T) { data := make([]*AppRecord, 0, 7) storeI := -1 fail = time.After(1 * time.Minute) +ExternalLoop: for i := 0; i < numberOfNodes; i++ { select { case d := <-nodes[i].Delivered: data = append(data, d) case <-fail: storeI = i + break ExternalLoop } } @@ -2961,7 +2963,7 @@ func TestLeaderStopSendHeartbeat(t *testing.T) { nodes[2].Connect() nodes[3].Connect() - fail = time.After(1 * time.Minute) + fail = time.After(90 * time.Second) for i := 0; i < 4; i++ { select { case <-realViewChangeCh: @@ -3228,7 +3230,7 @@ func TestTryCommittedSequenceTwice(t *testing.T) { nodes[4].Connect() // Waiting for a real change of leader and view - fail = time.After(1 * time.Minute) + fail = time.After(90 * time.Second) for i := 0; i < 7; i++ { select { case <-realViewChangeCh: @@ -3240,12 +3242,14 @@ func TestTryCommittedSequenceTwice(t *testing.T) { data := make([]*AppRecord, 0, 7) storeI := -1 fail = time.After(1 * time.Minute) +ExternalLoop: for i := 0; i < numberOfNodes; i++ { select { case d := <-nodes[i].Delivered: data = append(data, d) case <-fail: storeI = i + break ExternalLoop } }