anchor.diff:      % Test status change after local write that does not change replication status
       ?assertEqual({ok, 3}, lfm_proxy:write(Worker1, Worker1Handle, 6, <<"xxx">>)),
       ?assertEqual(ok, lfm_proxy:fsync(Worker1, Worker1Handle)),
  -    ?assertEqual({ok, undefined}, receive_replication_status()),
  +    receive_events_and_check({receive_replication_changed, undefined}, FileGuid),
   
       % Change status to verify read operations
       ?assertMatch({ok, #file_attr{size = 9}}, lfm_proxy:stat(Worker2, SessionIdWorker2, {guid, FileGuid}), 30),
       ?assertEqual({ok, 3}, lfm_proxy:write(Worker2, Worker2Handle, 0, <<"xxx">>)),
       ?assertEqual(ok, lfm_proxy:fsync(Worker2, Worker2Handle)),
  -    case receive_replication_status() of
  -        % There is possible events emmision before flush
  -        {ok, undefined} -> ?assertEqual({ok, false}, receive_replication_status());
  -        {ok, false} -> ok
  -    end,
  +    receive_events_and_check({receive_replication_changed, false}, FileGuid),
   
       % Test status change after local read that does not change replication status
       ?assertEqual({ok, <<"x">>}, lfm_proxy:read(Worker1, Worker1Handle, 5, 1)),
       ?assertEqual(ok, lfm_proxy:fsync(Worker1, Worker1Handle)),
  -    ?assertEqual({ok, undefined}, receive_replication_status()),
  +    receive_events_and_check({receive_replication_changed, undefined}, FileGuid),
   
       % Test status change after local read that changes replication status
       ?assertEqual({ok, <<"xxx">>}, lfm_proxy:read(Worker1, Worker1Handle, 0, 3)),
       ?assertEqual(ok, lfm_proxy:fsync(Worker1, Worker1Handle)),
  -    ?assertEqual({ok, true}, receive_replication_status()),
  +    receive_events_and_check({receive_replication_changed, true}, FileGuid),
   
       % Release handles
       ?assertEqual(ok, lfm_proxy:close(Worker1, Worker1Handle)),
       ?assertEqual(ok, lfm_proxy:close(Worker2, Worker2Handle)),
  -
  -
       ok.
   
   %%%===================================================================
  
positive.code:         rpc:call(Worker1, subscription_manager, get_attr_event_subscribers, [FileGuid, undefined, false]), 10),
      rpc:call(Worker1, fslogic_event_emitter, emit_file_attr_changed_with_replication_status,
          [file_ctx:new_by_guid(FileGuid), true, []]),
      ?assertEqual({ok, undefined}, receive_replication_status()),
  
      % Check if event is not produced on subscription without replication status if size is not changed
      rpc:call(Worker1, fslogic_event_emitter, emit_file_attr_changed_with_replication_status,
          [file_ctx:new_by_guid(FileGuid), false, []]),
      ?assertEqual({error, timeout}, receive_replication_status()),
  
      % Cleanup subscription
      ?assertEqual(ok, ssl:send(Sock,
  
negative.code:     test_utils:mock_expect(Workers, file_meta, get_all_links, fun
          (Uuid, Name) when Name =:= ?CONFLICTING_FILE_NAME orelse Name =:= ?CONFLICTING_FILE_AFTER_RENAME ->
              case meck:passthrough([Uuid, Name]) of
                  {ok, List} -> {ok, [#link{name = Name, target = Uuid, tree_id = ?TEST_TREE_ID} | List]};
                  {error, not_found} -> {ok, [#link{name = Name, target = Uuid, tree_id = ?TEST_TREE_ID}]}
              end;
          (Uuid, Name) ->
              meck:passthrough([Uuid, Name])
  