mirror of
https://github.com/valitydev/dominant.git
synced 2024-11-06 02:25:17 +00:00
DC-120: Update exception mapping (#127)
* Bump to rbkmoney/dmt_core@9a7a3779 Update error mapping accordingly. * Bump to rbkmoney/image-service-erlang@37c294de * Bump to rbkmoney/image-build@07d3946f * Bump to rbkmoney/build_utils@39115931 * Bump to rbkmoney/genlib@54920e76 * Bump to rbkmoney/woody_erlang@dd5eaa73 * Bump to rbkmoney/erlang-health@406fdd36 * Bump to rbkmoney/scoper@8e3499b1 * Bump to rbkmoney/logger_logstash_formatter@6fc1957b * Bump to rbkmoney/machinegun_proto@7def31fa * Bump to recon 2.5.1 + observer-cli 1.5.4 * Bump to rbkmoney/damsel@8c94c46b
This commit is contained in:
parent
2b6ee3d990
commit
d7f07634b5
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -36,7 +36,7 @@ build('dominant', 'docker-host', finalHook) {
|
||||
sh 'make wc_xref'
|
||||
}
|
||||
runStage('dialyze') {
|
||||
withWsCache("_build/default/rebar3_22.2.6_plt") {
|
||||
withWsCache("_build/default/rebar3_23.0.1_plt") {
|
||||
sh 'make wc_dialyze'
|
||||
}
|
||||
}
|
||||
|
4
Makefile
4
Makefile
@ -14,10 +14,10 @@ SERVICE_IMAGE_PUSH_TAG ?= $(SERVICE_IMAGE_TAG)
|
||||
|
||||
# Base image for the service
|
||||
BASE_IMAGE_NAME := service-erlang
|
||||
BASE_IMAGE_TAG := da0ab769f01b650b389d18fc85e7418e727cbe96
|
||||
BASE_IMAGE_TAG := 37c294de80c2ff7cd732f9b367914532fd662539
|
||||
|
||||
# Build image tag to be used
|
||||
BUILD_IMAGE_TAG := e7eb72b7721443d88a948546da815528a96c6de9
|
||||
BUILD_IMAGE_TAG := 07d3946f8f005782697de20270ac58cdcd18b011
|
||||
|
||||
CALL_ANYWHERE := all submodules compile xref lint dialyze start devrel release clean distclean
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 4e6aae0f31885d3c56d09c72de7ef8d432149dbf
|
||||
Subproject commit 39115931c6559011bf2f2ed353087976e6a7a5e7
|
@ -15,7 +15,7 @@ services:
|
||||
condition: service_healthy
|
||||
|
||||
machinegun:
|
||||
image: dr2.rbkmoney.com/rbkmoney/machinegun:bc41864a0db9a4a8340642cf765a9df7fa6890ff
|
||||
image: dr2.rbkmoney.com/rbkmoney/machinegun:0f68aa7e5f90eb97f6be66b667a853614fa62636
|
||||
command: /opt/machinegun/bin/machinegun foreground
|
||||
volumes:
|
||||
- ./test/machinegun/config.yaml:/opt/machinegun/etc/config.yaml
|
||||
|
@ -87,8 +87,8 @@
|
||||
{prod, [
|
||||
{deps, [
|
||||
% for introspection on production
|
||||
{recon , "2.3.2"},
|
||||
{observer_cli , "1.4.1"}
|
||||
{recon , "2.5.1"},
|
||||
{observer_cli , "1.5.4"}
|
||||
]},
|
||||
{relx, [
|
||||
{release, {dominant, "0.1"}, [
|
||||
|
32
rebar.lock
32
rebar.lock
@ -6,11 +6,11 @@
|
||||
{git,"https://github.com/rbkmoney/cg_mon.git",
|
||||
{ref,"5a87a37694e42b6592d3b4164ae54e0e87e24e18"}},
|
||||
1},
|
||||
{<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.5.0">>},1},
|
||||
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.6.0">>},2},
|
||||
{<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.7.0">>},1},
|
||||
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.8.0">>},2},
|
||||
{<<"damsel">>,
|
||||
{git,"git@github.com:rbkmoney/damsel.git",
|
||||
{ref,"a6c9401d85b856df783ed715f70304e7e104f052"}},
|
||||
{ref,"eff9e69bb25efe442c438697c1a17d9e6e66ee63"}},
|
||||
0},
|
||||
{<<"dmt_client">>,
|
||||
{git,"git@github.com:rbkmoney/dmt_client.git",
|
||||
@ -18,11 +18,11 @@
|
||||
0},
|
||||
{<<"dmt_core">>,
|
||||
{git,"git@github.com:rbkmoney/dmt_core.git",
|
||||
{ref,"8ac78cb1c94abdcdda6675dd7519893626567573"}},
|
||||
{ref,"9a7a37795272629748606cd3b1c8716c9bd693d3"}},
|
||||
0},
|
||||
{<<"erl_health">>,
|
||||
{git,"https://github.com/rbkmoney/erlang-health.git",
|
||||
{ref,"3a80bb43a93eb0e7a940d19912d9e35c2cbe91f9"}},
|
||||
{ref,"406fdd367bc085eec48e2337dad63a86ef81acd3"}},
|
||||
0},
|
||||
{<<"folsom">>,
|
||||
{git,"https://github.com/folsom-project/folsom.git",
|
||||
@ -30,7 +30,7 @@
|
||||
2},
|
||||
{<<"genlib">>,
|
||||
{git,"https://github.com/rbkmoney/genlib.git",
|
||||
{ref,"941b8c8d4dc544b740a2429ea8381c3873e5fe75"}},
|
||||
{ref,"54920e768a71f121304a5eda547ee60295398f3c"}},
|
||||
0},
|
||||
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.8.0">>},1},
|
||||
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.15.2">>},1},
|
||||
@ -42,24 +42,23 @@
|
||||
{<<"jsx">>,{pkg,<<"jsx">>,<<"2.8.0">>},1},
|
||||
{<<"logger_logstash_formatter">>,
|
||||
{git,"https://github.com/rbkmoney/logger_logstash_formatter.git",
|
||||
{ref,"288287980a972d363359fcc2f935a99385a32b93"}},
|
||||
{ref,"6fc1957b58bdd0f9eabc1773e5e6a1944d9f4d48"}},
|
||||
0},
|
||||
{<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2},
|
||||
{<<"mg_proto">>,
|
||||
{git,"https://github.com/rbkmoney/machinegun_proto.git",
|
||||
{ref,"3916141f3d60598c4fd6d93e28d3fb3acfc62b25"}},
|
||||
{ref,"7def31fad4c7a49f7dcf46545ee99cd7186ba1fc"}},
|
||||
0},
|
||||
{<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},2},
|
||||
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},3},
|
||||
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.6.2">>},2},
|
||||
{<<"rfc3339">>,{pkg,<<"rfc3339">>,<<"0.2.2">>},1},
|
||||
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.7.1">>},2},
|
||||
{<<"scoper">>,
|
||||
{git,"https://github.com/rbkmoney/scoper.git",
|
||||
{ref,"f2ac9c0b4e98a49a569631c3763c0585ec76abe5"}},
|
||||
{ref,"8e3499b17a0a34eeb32f92ad192e6cc5bd76e77b"}},
|
||||
0},
|
||||
{<<"snowflake">>,
|
||||
{git,"https://github.com/rbkmoney/snowflake.git",
|
||||
{ref,"0a598108f6582affe3b4ae550fc5b9f2062e318a"}},
|
||||
{ref,"563d8ef9543c1e4424aefa9ec7b41aa68885f0ad"}},
|
||||
1},
|
||||
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.5">>},2},
|
||||
{<<"thrift">>,
|
||||
@ -69,15 +68,15 @@
|
||||
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.4.1">>},3},
|
||||
{<<"woody">>,
|
||||
{git,"https://github.com/rbkmoney/woody_erlang.git",
|
||||
{ref,"e46a3b6303721d3c096d3cb65359f9b8b7652506"}},
|
||||
{ref,"dd5eaa73ce56a85ddc45d4d3c632627ee99e16c1"}},
|
||||
0}]}.
|
||||
[
|
||||
{pkg_hash,[
|
||||
{<<"bear">>, <<"16264309AE5D005D03718A5C82641FCC259C9E8F09ADEB6FD79CA4271168656F">>},
|
||||
{<<"cache">>, <<"3C11DBF4CD8FCD5787C95A5FB2A04038E3729CFCA0386016EEA8C953AB48A5AB">>},
|
||||
{<<"certifi">>, <<"867CE347F7C7D78563450A18A6A28A8090331E77FA02380B4A21962A65D36EE5">>},
|
||||
{<<"cowboy">>, <<"4EF3AE066EE10FE01EA3272EDC8F024347A0D3EB95F6FBB9AED556DACBFC1337">>},
|
||||
{<<"cowlib">>, <<"8AA629F81A0FC189F261DC98A42243FA842625FEEA3C7EC56C48F4CCDB55490F">>},
|
||||
{<<"cowboy">>, <<"91ED100138A764355F43316B1D23D7FF6BDB0DE4EA618CB5D8677C93A7A2F115">>},
|
||||
{<<"cowlib">>, <<"FD0FF1787DB84AC415B8211573E9A30A3EBE71B5CBFF7F720089972B2319C8A4">>},
|
||||
{<<"gproc">>, <<"CEA02C578589C61E5341FCE149EA36CCEF236CC2ECAC8691FBA408E7EA77EC2F">>},
|
||||
{<<"hackney">>, <<"07E33C794F8F8964EE86CEBEC1A8ED88DB5070E52E904B8F12209773C1036085">>},
|
||||
{<<"idna">>, <<"689C46CBCDF3524C44D5F3DDE8001F364CD7608A99556D8FBD8239A5798D4C10">>},
|
||||
@ -85,8 +84,7 @@
|
||||
{<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>},
|
||||
{<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>},
|
||||
{<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>},
|
||||
{<<"ranch">>, <<"6DB93C78F411EE033DBB18BA8234C5574883ACB9A75AF0FB90A9B82EA46AFA00">>},
|
||||
{<<"rfc3339">>, <<"1552DF616ACA368D982E9F085A0E933B6688A3F4938A671798978EC2C0C58730">>},
|
||||
{<<"ranch">>, <<"6B1FAB51B49196860B733A49C07604465A47BDB78AA10C1C16A3D199F7F8C881">>},
|
||||
{<<"ssl_verify_fun">>, <<"6EAF7AD16CB568BB01753DBBD7A95FF8B91C7979482B95F38443FE2C8852A79B">>},
|
||||
{<<"unicode_util_compat">>, <<"D869E4C68901DD9531385BB0C8C40444EBF624E60B6962D95952775CAC5E90CD">>}]}
|
||||
].
|
||||
|
@ -14,7 +14,6 @@
|
||||
-export_type([snapshot/0]).
|
||||
-export_type([commit/0]).
|
||||
-export_type([history/0]).
|
||||
-export_type([operation_conflict/0]).
|
||||
|
||||
-type version() :: dmsl_domain_config_thrift:'Version'().
|
||||
-type limit() :: dmsl_domain_config_thrift:'Limit'() | undefined.
|
||||
@ -27,11 +26,7 @@
|
||||
-type repository() :: module().
|
||||
-type context() :: woody_context:ctx().
|
||||
|
||||
-type operation_conflict() ::
|
||||
{object_already_exists, object_ref()} |
|
||||
{object_not_found, object_ref()} |
|
||||
{object_reference_mismatch, object_ref()} |
|
||||
{objects_not_exist, [{object_ref(), [object_ref()]}]}.
|
||||
-type operation_error() :: dmt_domain:operation_error().
|
||||
|
||||
-callback checkout(ref(), context()) ->
|
||||
% TODO this was made due to dialyzer warning, can't find the way to fix it
|
||||
@ -42,7 +37,7 @@
|
||||
{error, version_not_found}.
|
||||
-callback commit(version(), commit(), context()) ->
|
||||
{ok, snapshot()} |
|
||||
{error, version_not_found | migration_in_progress | {operation_conflict, operation_conflict()}}.
|
||||
{error, version_not_found | migration_in_progress | {operation_error, operation_error()}}.
|
||||
|
||||
%%
|
||||
|
||||
@ -89,7 +84,7 @@ pull(Version, Limit, Repository, Context) ->
|
||||
|
||||
-spec commit(version(), commit(), repository(), context()) ->
|
||||
{ok, version()} |
|
||||
{error, version_not_found | head_mismatch | migration_in_progress | {operation_conflict, operation_conflict()}}.
|
||||
{error, version_not_found | head_mismatch | migration_in_progress | {operation_error, operation_error()}}.
|
||||
|
||||
commit(Version, Commit, Repository, Context) ->
|
||||
case Repository:commit(Version, Commit, Context) of
|
||||
|
@ -41,10 +41,8 @@ do_handle_function('Commit', [Version, Commit], Context, Options) ->
|
||||
case dmt_api_repository:commit(Version, Commit, repository(Options), Context) of
|
||||
{ok, VersionNext} ->
|
||||
{ok, VersionNext};
|
||||
{error, {operation_conflict, Conflict}} ->
|
||||
woody_error:raise(business, #'OperationConflict'{
|
||||
conflict = handle_operation_conflict(Conflict)
|
||||
});
|
||||
{error, {operation_error, Error}} ->
|
||||
woody_error:raise(business, handle_operation_error(Error));
|
||||
{error, version_not_found} ->
|
||||
woody_error:raise(business, #'VersionNotFound'{});
|
||||
{error, head_mismatch} ->
|
||||
@ -76,6 +74,15 @@ do_handle_function('Pull', [Version], Context, Options) ->
|
||||
end.
|
||||
|
||||
%%
|
||||
handle_operation_error({conflict, Conflict}) ->
|
||||
#'OperationConflict'{
|
||||
conflict = handle_operation_conflict(Conflict)
|
||||
};
|
||||
handle_operation_error({invalid, Invalid}) ->
|
||||
#'OperationInvalid'{
|
||||
errors = handle_operation_invalid(Invalid)
|
||||
}.
|
||||
|
||||
handle_operation_conflict(Conflict) ->
|
||||
case Conflict of
|
||||
{object_already_exists, Ref} ->
|
||||
@ -83,15 +90,24 @@ handle_operation_conflict(Conflict) ->
|
||||
{object_not_found, Ref} ->
|
||||
{object_not_found, #'ObjectNotFoundConflict'{object_ref = Ref}};
|
||||
{object_reference_mismatch, Ref} ->
|
||||
{object_reference_mismatch, #'ObjectReferenceMismatchConflict'{object_ref = Ref}};
|
||||
{object_reference_mismatch, #'ObjectReferenceMismatchConflict'{object_ref = Ref}}
|
||||
end.
|
||||
|
||||
handle_operation_invalid(Invalid) ->
|
||||
case Invalid of
|
||||
{objects_not_exist, Refs} ->
|
||||
ObjectRefs = lists:map(
|
||||
fun({Ref, ReferencedBy}) ->
|
||||
#'NonexistantObject'{object_ref = Ref, referenced_by = ReferencedBy}
|
||||
end,
|
||||
Refs
|
||||
),
|
||||
{objects_not_exist, #'ObjectsNotExistConflict'{object_refs = ObjectRefs}}
|
||||
[
|
||||
{object_not_exists, #'NonexistantObject'{
|
||||
object_ref = Ref,
|
||||
referenced_by = ReferencedBy
|
||||
}} ||
|
||||
{Ref, ReferencedBy} <- Refs
|
||||
];
|
||||
{object_reference_cycles, Cycles} ->
|
||||
[
|
||||
{object_reference_cycle, #'ObjectReferenceCycle'{cycle = Cycle}} ||
|
||||
Cycle <- Cycles
|
||||
]
|
||||
end.
|
||||
|
||||
-spec repository(options()) ->
|
||||
|
@ -68,7 +68,7 @@ pull(Version, Limit, Context) ->
|
||||
|
||||
-spec commit(dmt_api_repository:version(), commit(), context()) ->
|
||||
{ok, snapshot()} |
|
||||
{error, version_not_found | migration_in_progress | {operation_conflict, dmt_api_repository:operation_conflict()}}.
|
||||
{error, version_not_found | migration_in_progress | {operation_error, dmt_domain:operation_error()}}.
|
||||
|
||||
commit(Version, Commit, Context) ->
|
||||
case is_migration_finished(Context) of
|
||||
|
@ -95,7 +95,7 @@ pull(Version, Limit, Context) ->
|
||||
|
||||
-spec commit(dmt_api_repository:version(), commit(), context()) ->
|
||||
{ok, snapshot()} |
|
||||
{error, version_not_found | {operation_conflict, dmt_api_repository:operation_conflict()}}.
|
||||
{error, version_not_found | {operation_error, dmt_domain:operation_error()}}.
|
||||
|
||||
commit(Version, Commit, Context) ->
|
||||
BaseID = get_event_id(get_base_version(Version)),
|
||||
@ -159,7 +159,7 @@ apply_commit(#'Snapshot'{version = VersionWas, domain = DomainWas}, #'Commit'{op
|
||||
Snapshot = #'Snapshot'{version = VersionWas + 1, domain = Domain},
|
||||
{{ok, Snapshot}, [make_event(Snapshot, Commit)]};
|
||||
{error, Reason} ->
|
||||
{{error, {operation_conflict, Reason}}, []}
|
||||
{{error, {operation_error, Reason}}, []}
|
||||
end.
|
||||
|
||||
%%
|
||||
|
@ -96,7 +96,7 @@ pull(Version, Limit, Context) ->
|
||||
|
||||
-spec commit(dmt_api_repository:version(), commit(), context()) ->
|
||||
{ok, snapshot()} |
|
||||
{error, version_not_found | {operation_conflict, dmt_api_repository:operation_conflict()}}.
|
||||
{error, version_not_found | {operation_error, dmt_domain:operation_error()}}.
|
||||
|
||||
commit(Version, Commit, Context) ->
|
||||
BaseID = get_event_id(get_base_version(Version)),
|
||||
@ -163,7 +163,7 @@ apply_commit(#'Snapshot'{version = VersionWas, domain = DomainWas}, #'Commit'{op
|
||||
Snapshot = #'Snapshot'{version = VersionWas + 1, domain = Domain},
|
||||
{{ok, Snapshot}, [make_event(Snapshot, Commit)]};
|
||||
{error, Reason} ->
|
||||
{{error, {operation_conflict, Reason}}, []}
|
||||
{{error, {operation_error, Reason}}, []}
|
||||
end.
|
||||
|
||||
check_commit(Version, Commit, #st{snapshot = BaseSnapshot, history = History}) ->
|
||||
|
@ -1,5 +1,6 @@
|
||||
-module(dmt_api_tests_SUITE).
|
||||
-include_lib("common_test/include/ct.hrl").
|
||||
-include_lib("stdlib/include/assert.hrl").
|
||||
|
||||
-export([all/0]).
|
||||
-export([groups/0]).
|
||||
@ -16,6 +17,9 @@
|
||||
-export([update/1]).
|
||||
-export([delete/1]).
|
||||
-export([migration_success/1]).
|
||||
-export([conflict/1]).
|
||||
-export([nonexistent/1]).
|
||||
-export([reference_cycles/1]).
|
||||
|
||||
-include_lib("damsel/include/dmsl_domain_config_thrift.hrl").
|
||||
|
||||
@ -34,7 +38,8 @@ all() ->
|
||||
[
|
||||
{group, basic_lifecycle_v3},
|
||||
{group, migration_to_v4},
|
||||
{group, basic_lifecycle_v4}
|
||||
{group, basic_lifecycle_v4},
|
||||
{group, error_mapping}
|
||||
].
|
||||
|
||||
-spec groups() -> [{group_name(), list(), [test_case_name()]}].
|
||||
@ -56,6 +61,11 @@ groups() ->
|
||||
]},
|
||||
{migration_to_v4, [sequence], [
|
||||
migration_success
|
||||
]},
|
||||
{error_mapping, [parallel], [
|
||||
conflict,
|
||||
nonexistent,
|
||||
reference_cycles
|
||||
]}
|
||||
].
|
||||
|
||||
@ -104,6 +114,8 @@ init_per_group(migration_to_v4, C) ->
|
||||
}},
|
||||
{max_cache_size, 2048} % 2Kb
|
||||
])} | C];
|
||||
init_per_group(error_mapping, C) ->
|
||||
[{group_apps, start_with_repository(dmt_api_repository_v4)} | C];
|
||||
init_per_group(_, C) ->
|
||||
C.
|
||||
|
||||
@ -122,6 +134,7 @@ start_with_repository(Repository) ->
|
||||
end_per_group(Group, C) when
|
||||
Group =:= basic_lifecycle_v3 orelse
|
||||
Group =:= basic_lifecycle_v4 orelse
|
||||
Group =:= error_mapping orelse
|
||||
Group =:= migration_to_v4
|
||||
->
|
||||
genlib_app:stop_unload_applications(?config(group_apps, C));
|
||||
@ -233,6 +246,62 @@ wait_for_migration(V, TriesLeft, SleepInterval) when TriesLeft > 0 ->
|
||||
wait_for_migration(_, _, _) ->
|
||||
error(wait_for_migration_failed).
|
||||
|
||||
-spec conflict(term()) -> term().
|
||||
conflict(_C) ->
|
||||
#'Snapshot'{version = Version1} = dmt_client:checkout({head, #'Head'{}}),
|
||||
_ = ?assertThrow(
|
||||
#'OperationConflict'{conflict =
|
||||
{object_not_found, #'ObjectNotFoundConflict'{
|
||||
object_ref = {criterion, #domain_CriterionRef{id = 42}}
|
||||
}}
|
||||
},
|
||||
dmt_client:commit(Version1, #'Commit'{ops = [
|
||||
{update, #'UpdateOp'{
|
||||
old_object = criterion_w_refs(42, []),
|
||||
new_object = criterion_w_refs(42, [43, 44, 45])
|
||||
}}
|
||||
]})
|
||||
).
|
||||
|
||||
-spec nonexistent(term()) -> term().
|
||||
nonexistent(_C) ->
|
||||
#'Snapshot'{version = Version1} = dmt_client:checkout({head, #'Head'{}}),
|
||||
_ = ?assertThrow(
|
||||
#'OperationInvalid'{errors = [
|
||||
{object_not_exists, #'NonexistantObject'{
|
||||
object_ref = {criterion, #domain_CriterionRef{}},
|
||||
referenced_by = [{criterion, #domain_CriterionRef{id = 42}}]
|
||||
}} | _
|
||||
]},
|
||||
dmt_client:commit(Version1, #'Commit'{ops = [
|
||||
{insert, #'InsertOp'{object = criterion_w_refs(42, [43, 44, 45])}}
|
||||
]})
|
||||
).
|
||||
|
||||
-spec reference_cycles(term()) -> term().
|
||||
reference_cycles(_C) ->
|
||||
#'Snapshot'{version = Version1} = dmt_client:checkout({head, #'Head'{}}),
|
||||
_ = ?assertThrow(
|
||||
#'OperationInvalid'{errors = [
|
||||
%% we expect 3 cycles to be found
|
||||
{object_reference_cycle, #'ObjectReferenceCycle'{
|
||||
cycle = [{criterion, #domain_CriterionRef{}} | _]
|
||||
}},
|
||||
{object_reference_cycle, #'ObjectReferenceCycle'{
|
||||
cycle = [{criterion, #domain_CriterionRef{}} | _]
|
||||
}},
|
||||
{object_reference_cycle, #'ObjectReferenceCycle'{
|
||||
cycle = [{criterion, #domain_CriterionRef{}} | _]
|
||||
}}
|
||||
]},
|
||||
dmt_client:commit(Version1, #'Commit'{ops = [
|
||||
{insert, #'InsertOp'{object = criterion_w_refs(1, [2])}},
|
||||
{insert, #'InsertOp'{object = criterion_w_refs(2, [3])}},
|
||||
{insert, #'InsertOp'{object = criterion_w_refs(3, [4, 1])}},
|
||||
{insert, #'InsertOp'{object = criterion_w_refs(4, [1, 2])}}
|
||||
]})
|
||||
).
|
||||
|
||||
next_id() ->
|
||||
erlang:system_time(micro_seconds) band 16#7FFFFFFF.
|
||||
|
||||
@ -244,3 +313,14 @@ fixture_domain_object(Ref, Data) ->
|
||||
|
||||
fixture_object_ref(Ref) ->
|
||||
{category, #domain_CategoryRef{id = Ref}}.
|
||||
|
||||
criterion_w_refs(ID, Refs) ->
|
||||
{criterion, #domain_CriterionObject{
|
||||
ref = #domain_CriterionRef{id = ID},
|
||||
data = #domain_Criterion{
|
||||
name = genlib:format(ID),
|
||||
predicate = {any_of,
|
||||
ordsets:from_list([{criterion, #domain_CriterionRef{id = Ref}} || Ref <- Refs])
|
||||
}
|
||||
}
|
||||
}}.
|
||||
|
Loading…
Reference in New Issue
Block a user