mirror of
https://github.com/valitydev/riak_test.git
synced 2024-11-06 16:45:29 +00:00
Persuade rtdev harness to set advanced.config variables
In the case that no advanced.config file exists (everycase!) rt would not add any advanced config settings to the conf. This PR teaches rtdev to create an advanced.comfig file if none exists so that tests may set advanced config. In this case we set ring_size and also the `crdt_mixed_versions` app env
This commit is contained in:
parent
fd086aa5bc
commit
d22fbfbdc7
@ -178,9 +178,32 @@ set_advanced_conf(Node, NameValuePairs) when is_atom(Node) ->
|
||||
append_to_conf_file(get_advanced_riak_conf(Node), NameValuePairs),
|
||||
ok;
|
||||
set_advanced_conf(DevPath, NameValuePairs) ->
|
||||
[update_app_config_file(RiakConf, NameValuePairs) || RiakConf <- all_the_files(DevPath, "etc/advanced.config")],
|
||||
AdvancedConfs = case all_the_files(DevPath, "etc/advanced.config") of
|
||||
[] ->
|
||||
%% no advanced conf? But we _need_ them, so make 'em
|
||||
make_advanced_confs(DevPath);
|
||||
Confs ->
|
||||
Confs
|
||||
end,
|
||||
[update_app_config_file(RiakConf, NameValuePairs) || RiakConf <- AdvancedConfs],
|
||||
ok.
|
||||
|
||||
make_advanced_confs(DevPath) ->
|
||||
case filelib:is_dir(DevPath) of
|
||||
false ->
|
||||
lager:debug("Failed generating advanced.conf ~p is not a directory.", [DevPath]);
|
||||
true ->
|
||||
Wildcard = io_lib:format("~s/dev/dev*/etc", [DevPath]),
|
||||
ConfDirs = filelib:wildcard(Wildcard),
|
||||
[
|
||||
begin
|
||||
AC = filename:join(Path, "advanced.config"),
|
||||
lager:debug("writing advanced.conf to ~p", [AC]),
|
||||
file:write_file(AC, io_lib:fwrite("~p.\n",[[]])),
|
||||
AC
|
||||
end || Path <- ConfDirs]
|
||||
end.
|
||||
|
||||
get_riak_conf(Node) ->
|
||||
N = node_id(Node),
|
||||
Path = relpath(node_version(N)),
|
||||
|
@ -46,6 +46,8 @@ confirm() ->
|
||||
|
||||
CurrentVer = rt:get_version(),
|
||||
|
||||
lager:info("crdt_mixed_versions? ~p", [rpc:multicall(Nodes, application, get_env, [riak_kv, crdt_mixed_versions])]),
|
||||
|
||||
%% Create PB connection.
|
||||
Pid = rt:pbc(Node1),
|
||||
riakc_pb_socket:set_options(Pid, [queue_if_disconnected]),
|
||||
@ -216,10 +218,15 @@ confirm() ->
|
||||
?assert(map_contents_are_lists(Robj1)),
|
||||
|
||||
{ok, Robj2} = riakc_pb_socket:get(Pid4, ?BUCKET, ?KEY2),
|
||||
|
||||
lager:info("crdt_mixed_versions? ~p", [rpc:multicall(Nodes, application, get_env, [riak_kv, crdt_mixed_versions])]),
|
||||
|
||||
?assert(map_contents_are_lists(Robj2)),
|
||||
%% unset env var
|
||||
rpc:multicall(Nodes, application, set_env, [riak_kv, crdt_mixed_versions, false]),
|
||||
|
||||
lager:info("crdt_mixed_versions? ~p", [rpc:multicall(Nodes, application, get_env, [riak_kv, crdt_mixed_versions])]),
|
||||
|
||||
%% read and write maps
|
||||
{ok, Up1N1} = riakc_pb_socket:fetch_type(Pid4, ?BUCKET, ?KEY),
|
||||
{ok, Up1N2} = riakc_pb_socket:fetch_type(Pid3, ?BUCKET, ?KEY),
|
||||
@ -309,7 +316,7 @@ nested_are_dicts(Entries) ->
|
||||
end, true, CRDTs);
|
||||
(_) ->
|
||||
true
|
||||
end, Entries).
|
||||
end, dict:to_list(Entries)).
|
||||
|
||||
set_is_dict({_Clock, Entries, Deferred}) ->
|
||||
is_dict(Entries) andalso is_dict(Deferred).
|
||||
|
Loading…
Reference in New Issue
Block a user