From b4f9bb45fcb68b568e261850763df9e99c93fd16 Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Tue, 14 Feb 2023 14:36:46 +0100 Subject: [PATCH] tests: Allow multiple operations with same mod revisions, but forbid those operations to be spread between multiple responses Signed-off-by: Marek Siarkowicz --- tests/linearizability/watch.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/linearizability/watch.go b/tests/linearizability/watch.go index 4466a4c3a..6d63020f6 100644 --- a/tests/linearizability/watch.go +++ b/tests/linearizability/watch.go @@ -99,10 +99,13 @@ func validateMemberWatchResponses(t *testing.T, responses []watchResponse, expec if resp.Header.Revision == lastHeadRevision && len(resp.Events) != 0 { t.Errorf("Got two non-empty responses about same revision") } + if len(resp.Events) > 0 && resp.Events[0].Kv.ModRevision <= lastEventModRevision { + t.Errorf("Events with same revision should not be split between multiple responses, lastResponseModRevision: %d, firstEventModRevision: %d", lastEventModRevision, resp.Events[0].Kv.ModRevision) + } for _, event := range resp.Events { - if event.Kv.ModRevision != lastEventModRevision+1 { - t.Errorf("Expect event revision to grow by 1, last: %d, mod: %d", lastEventModRevision, event.Kv.ModRevision) + if event.Kv.ModRevision != lastEventModRevision && event.Kv.ModRevision != lastEventModRevision+1 { + t.Errorf("Event mod revision should stay the same or increment by one, last: %d, current: %d", lastEventModRevision, event.Kv.ModRevision) } lastEventModRevision = event.Kv.ModRevision }