summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2020-07-03 10:37:52 +0700
committerMichael Klishin <michael@clojurewerkz.org>2020-07-03 10:37:52 +0700
commitdc53b23824f611541ae42ad0f6977929308e7e20 (patch)
tree8c01df657dc73d4dba8c86c4399b51a0d589fcbf /test
parentdd6915ad86bc11d02bc1ebec5dd681c2da7d19ca (diff)
downloadrabbitmq-server-git-dc53b23824f611541ae42ad0f6977929308e7e20.tar.gz
rabbit_definitions: format exchange, queue and binding arguments the same way HTTP API would
this makes them JSON serialisation-safe without any post-processing of the returned data structure.
Diffstat (limited to 'test')
-rw-r--r--test/definition_import_SUITE.erl41
1 files changed, 33 insertions, 8 deletions
diff --git a/test/definition_import_SUITE.erl b/test/definition_import_SUITE.erl
index 063b1de46a..e319c6d588 100644
--- a/test/definition_import_SUITE.erl
+++ b/test/definition_import_SUITE.erl
@@ -26,7 +26,8 @@
all() ->
[
{group, import_on_a_running_node},
- {group, import_on_a_booting_node}
+ {group, import_on_a_booting_node},
+ {group, roundtrip}
].
groups() ->
@@ -51,6 +52,10 @@ groups() ->
]},
{import_on_a_booting_node, [], [
import_on_boot_case1
+ ]},
+
+ {roundtrip, [], [
+ export_import_round_trip_case1
]}
].
@@ -61,23 +66,23 @@ groups() ->
init_per_suite(Config) ->
rabbit_ct_helpers:log_environment(),
inets:start(),
+ Config.
+end_per_suite(Config) ->
+ Config.
+
+init_per_group(_, Config) ->
Config1 = rabbit_ct_helpers:set_config(Config, [
{rmq_nodename_suffix, ?MODULE}
]),
rabbit_ct_helpers:run_setup_steps(Config1,
rabbit_ct_broker_helpers:setup_steps() ++
rabbit_ct_client_helpers:setup_steps()).
-end_per_suite(Config) ->
+
+end_per_group(_, Config) ->
rabbit_ct_helpers:run_teardown_steps(Config,
rabbit_ct_client_helpers:teardown_steps() ++
rabbit_ct_broker_helpers:teardown_steps()).
-init_per_group(_, Config) ->
- Config.
-
-end_per_group(_, Config) ->
- Config.
-
init_per_testcase(import_on_boot_case1 = Testcase, Config) ->
CasePath = filename:join(?config(data_dir, Config), "case5.json"),
Config1 = rabbit_ct_helpers:set_config(Config, [
@@ -126,6 +131,12 @@ import_case5(Config) ->
import_case11(Config) -> import_file_case(Config, "case11").
import_case12(Config) -> import_invalid_file_case(Config, "failing_case12").
+export_import_round_trip_case1(Config) ->
+ %% case 6 has runtime parameters that do not depend on any plugins
+ import_file_case(Config, "case6"),
+ Defs = export(Config),
+ import_raw(Config, rabbit_json:encode(Defs)).
+
import_on_boot_case1(Config) ->
%% see case5.json
VHost = <<"vhost2">>,
@@ -163,6 +174,20 @@ import_from_directory_case_expect(Config, CaseName, Expected) ->
[CasePath, Expected]),
ok.
+import_raw(Config, Body) ->
+ case rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_definitions, import_raw, [Body]) of
+ ok -> ok;
+ {error, E} ->
+ ct:pal("Import of definitions ~p failed: ~p~n", [Body, E]),
+ ct:fail({failure, Body, E})
+ end.
+
+export(Config) ->
+ rabbit_ct_broker_helpers:rpc(Config, 0, ?MODULE, run_export, []).
+
+run_export() ->
+ rabbit_definitions:all_definitions().
+
run_directory_import_case(Path, Expected) ->
ct:pal("Will load definitions from files under ~p~n", [Path]),
Result = rabbit_definitions:maybe_load_definitions_from(true, Path),