anchor.diff:  %% Test stream with finite until value
   finite_stream_test(Config) ->
       [W | _] = ?config(cluster_worker_nodes, Config),
  -    FirstSeq = ?getFirstSeq(W, Config),
       Pid = self(),
   
       BaseVal = #test_record_1{field1 = 1, field2 = 2, field3 = 3},
       BaseMod = test_record_1,
   
  -    lists:map(
  -        fun(Key) ->
  -            Doc = #document{key = Key, value = BaseVal},
  -            ?assertEqual({ok, Key}, rpc:call(W, BaseMod, save, [Doc])),
  -            {Key, BaseVal, BaseMod}
  -        end,
  -        lists:seq(1, 10)
  -    ),
  -
  -    Received = receive_all(finite_stream_test, []),
  -    LastSeq = element(1, lists:last(Received)),
  +    save_docs(W, BaseVal, BaseMod, 1, 10),
  +    receive_all(finite_stream_test, []),
  +
  +    save_docs(W, BaseVal, BaseMod, 11, 20),
  +    ReceivedFromInfinite = receive_all(finite_stream_test, []),
  +    Since = element(1, lists:nth(1, ReceivedFromInfinite)) - 1,
  +    Until = element(1, lists:last(ReceivedFromInfinite)),
  +
  +    save_docs(W, BaseVal, BaseMod, 21, 30),
  +    receive_all(finite_stream_test, []),
   
       {_, DriverPid} = ?assertMatch(
           {ok, _},
  
positive.code: %%% Internal functions
  %%%===================================================================
  
  %% Receive all messages with given prefix
  receive_all(Prefix, Received) ->
      receive
          {Prefix, Data} ->
              receive_all(Prefix, [Data | Received])
      after
  
negative.code:                 fun(Seq, Doc, Mod) ->
                      Pid ! {finite, {Seq, Doc, Mod}}
                  end,
                  Since,
                  Until
              ]
          )
      ),
      ReceivedFromFinite = receive_all(finite, []),
      ?assertEqual(ReceivedFromInfinite, ReceivedFromFinite),
  
      ?assertEqual(ok, rpc:call(W, gen_changes, stop, [DriverPid])),
      ok.
  