<commit_before>%%%-------------------------------------------------------------------
%%% @author <NAME>
%%% @copyright (C) 2017 ACK CYFRONET AGH
%%% This software is released under the MIT license cited in 'LICENSE.txt'.
%%% @end
%%%-------------------------------------------------------------------
%%% @doc
%%% This file contains DBSync tests.
%%% @end
%%%-------------------------------------------------------------------
-module(dbsync2_test_SUITE).
-author("<NAME>").

-include("proto/oneprovider/dbsync_messages2.hrl").
-include_lib("ctool/include/test/test_utils.hrl").
-include_lib("ctool/include/test/assertions.hrl").
-include_lib("ctool/include/test/performance.hrl").
-include_lib("cluster_worker/include/modules/datastore/datastore_models_def.hrl").
-include_lib("cluster_worker/include/modules/datastore/datastore_common_internal.hrl").

%% export for ct
-export([all/0, init_per_testcase/2, end_per_testcase/2]).

%% tests
-export([
    stream_should_be_started_on_init/1,
    stream_should_be_stared_for_new_space/1,
    stream_should_be_restarted_after_crash/1,
    status_should_be_broadcast_periodically/1,
    local_changes_should_be_broadcast/1,
    remote_changes_should_not_be_broadcast/1,
    remote_changes_should_be_applied/1,
    resent_changes_should_be_applied/1,
    remote_changes_duplicates_should_be_ignored/1,
    remote_changes_should_be_forwarded/1,
    missing_changes_should_be_requested/1,
    future_changes_should_be_stashed/1,
    changes_request_should_be_handled/1
]).

all() ->
    ?ALL([
        stream_should_be_started_on_init,
        stream_should_be_stared_for_new_space,
        stream_should_be_restarted_after_crash,
        status_should_be_broadcast_periodically,
        local_changes_should_be_broadcast,
        remote_changes_should_not_be_broadcast,
        remote_changes_should_be_applied,
        resent_changes_should_be_applied,
        remote_changes_duplicates_should_be_ignored,
        remote_changes_should_be_forwarded,
        missing_changes_should_be_requested,
        future_changes_should_be_stashed,
        changes_request_should_be_handled
    ]).

-define(DOC(Mutator, Seq), #document{
    mutator = [Mutator],
    seq = Seq,
    value = crypto:strong_rand_bytes(16)
}).
-define(TIMEOUT, timer:seconds(30)).
-define(ATTEMPTS, 30).

-define(call(Worker, ProviderId, Request), worker_proxy:cast(
    {dbsync_worker2, Worker},
    {dbsync_message, get_provider_session(ProviderId), Request}<commit_msg>VFS-3511 Use sync call in dbsync tests<commit_after>%%%-------------------------------------------------------------------
%%% @author <NAME>
%%% @copyright (C) 2017 ACK CYFRONET AGH
%%% This software is released under the MIT license cited in 'LICENSE.txt'.
%%% @end
%%%-------------------------------------------------------------------
%%% @doc
%%% This file contains DBSync tests.
%%% @end
%%%-------------------------------------------------------------------
-module(dbsync2_test_SUITE).
-author("<NAME>").

-include("proto/oneprovider/dbsync_messages2.hrl").
-include_lib("ctool/include/test/test_utils.hrl").
-include_lib("ctool/include/test/assertions.hrl").
-include_lib("ctool/include/test/performance.hrl").
-include_lib("cluster_worker/include/modules/datastore/datastore_models_def.hrl").
-include_lib("cluster_worker/include/modules/datastore/datastore_common_internal.hrl").

%% export for ct
-export([all/0, init_per_testcase/2, end_per_testcase/2]).

%% tests
-export([
    stream_should_be_started_on_init/1,
    stream_should_be_stared_for_new_space/1,
    stream_should_be_restarted_after_crash/1,
    status_should_be_broadcast_periodically/1,
    local_changes_should_be_broadcast/1,
    remote_changes_should_not_be_broadcast/1,
    remote_changes_should_be_applied/1,
    resent_changes_should_be_applied/1,
    remote_changes_duplicates_should_be_ignored/1,
    remote_changes_should_be_forwarded/1,
    missing_changes_should_be_requested/1,
    future_changes_should_be_stashed/1,
    changes_request_should_be_handled/1
]).

all() ->
    ?ALL([
        stream_should_be_started_on_init,
        stream_should_be_stared_for_new_space,
        stream_should_be_restarted_after_crash,
        status_should_be_broadcast_periodically,
        local_changes_should_be_broadcast,
        remote_changes_should_not_be_broadcast,
        remote_changes_should_be_applied,
        resent_changes_should_be_applied,
        remote_changes_duplicates_should_be_ignored,
        remote_changes_should_be_forwarded,
        missing_changes_should_be_requested,
        future_changes_should_be_stashed,
        changes_request_should_be_handled
    ]).

-define(DOC(Mutator, Seq), #document{
    mutator = [Mutator],
    seq = Seq,
    value = crypto:strong_rand_bytes(16)
}).
-define(TIMEOUT, timer:seconds(30)).
-define(ATTEMPTS, 30).

-define(call(Worker, ProviderId, Request), worker_proxy:call(
    {dbsync_worker2, Worker},
    {dbsync_message, get_provider_session(ProviderId), Request}
{'fraction_non_alphanumeric': 0.1772481474063689, 'fraction_numerical': 0.012417384338073302, 'mean_word_length': 3.312607944732297, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5437037', 'n_tokens_mistral': 1679, 'n_tokens_neox': 1631, 'n_words': 193}