Skip to content

Commit

Permalink
adding host_types file parsing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
DenysGonchar committed Mar 8, 2021
1 parent 9958848 commit f991ee2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/config_parser_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ groups() ->
miscellaneous,
s2s,
modules,
outgoing_pools]},
outgoing_pools,
host_types_file]},
{general, [parallel], [loglevel,
hosts,
host_types,
Expand Down Expand Up @@ -252,6 +253,12 @@ modules(Config) ->
outgoing_pools(Config) ->
test_config_file(Config, "outgoing_pools").

host_types_file(Config) ->
Modules = [dummy_module, another_dummy_module],
[meck:new(M, [non_strict]) || M <- Modules],
test_config_file(Config, "host_types"),
[meck:unload(M) || M <- Modules].

%% tests: general
loglevel(_Config) ->
?eq([#local_config{key = loglevel, value = debug}],
Expand Down
7 changes: 7 additions & 0 deletions test/config_parser_SUITE_data/host_types.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{config,host_types,
[<<"this is host type">>,<<"some host type">>,<<"another host type">>,
<<"yet another host type">>]}.
{local_config,{modules,<<"another host type">>},[{another_dummy_module,[]}]}.
{local_config,{modules,<<"some host type">>},[]}.
{local_config,{modules,<<"this is host type">>},[]}.
{local_config,{modules,<<"yet another host type">>},[{dummy_module,[]}]}.
25 changes: 25 additions & 0 deletions test/config_parser_SUITE_data/host_types.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[general]
host_types = [
"this is host type",
"some host type",
"another host type",
"yet another host type"
]

[modules.dummy_module]

[[host_config]]
host_type = "this is host type"
## this resets the modules for this host
modules ={}

[[host_config]]
## host is just synonym for host_type now
host = "some host type"
## another syntax for reseting the modules for this host type
[host_config.modules]

[[host_config]]
host_type = "another host type"
## reseting the modules for this host type
[host_config.modules.another_dummy_module]

0 comments on commit f991ee2

Please sign in to comment.