From 1cb7d052852e9fa3f392102ce05229eeef154cdb Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Fri, 16 Feb 2024 00:02:29 -0500 Subject: [PATCH] Unit test WaitCommitIndex --- store/store_multi_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/store/store_multi_test.go b/store/store_multi_test.go index 1b5f03af..76336cc1 100644 --- a/store/store_multi_test.go +++ b/store/store_multi_test.go @@ -76,6 +76,10 @@ func Test_MultiNodeSimple(t *testing.T) { t.Fatalf("wrong leader commit index, got: %d, exp: %d", got, exp) } + if err := s0.WaitCommitIndex(time.Second); err != nil { + t.Fatalf("failed to wait for commit index: %s", err.Error()) + } + // Now, do a NONE consistency query on each node, to actually confirm the data // has been replicated. testFn1 := func(t *testing.T, s *Store) { @@ -108,6 +112,10 @@ func Test_MultiNodeSimple(t *testing.T) { t.Fatalf("wrong leader commit index, got: %d, exp: %d", got, exp) } + if err := s1.WaitCommitIndex(time.Second); err != nil { + t.Fatalf("failed to wait for commit index: %s", err.Error()) + } + // Write another row using Request rr := executeQueryRequestFromString("INSERT INTO foo(id, name) VALUES(2, 'fiona')", proto.QueryRequest_QUERY_REQUEST_LEVEL_STRONG, false, false) _, err = s0.Request(rr)