Skip to content

Commit 21b432a

Browse files
author
Brett Hazen
committed
Change the interface to riak_shell:loop_TEST/2
1 parent 60a0510 commit 21b432a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

tests/riak_shell_test_util.erl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,16 @@ build_cluster() ->
6464
run_commands([], _State, _ShouldIncrement) ->
6565
pass;
6666
run_commands([{drain, discard} | T], State, ShouldIncrement) ->
67-
{_, Cmd} = riak_shell:make_cmd_TEST(),
68-
{_Error, Response, NewState, NewShdIncr} = riak_shell:loop_TEST(Cmd, State, ShouldIncrement),
67+
{_, Cmd} = riak_shell:make_cmd_TEST(ShouldIncrement),
68+
{_Error, Response, NewState} = riak_shell:loop_TEST(Cmd, State),
6969
lager:info("Message drained and discared unchecked ~p", [lists:flatten(Response)]),
70-
run_commands(T, NewState, NewShdIncr);
70+
run_commands(T, NewState, ShouldIncrement);
7171
run_commands([{drain, Expected} | T], State, ShouldIncrement) ->
72-
{_, Cmd} = riak_shell:make_cmd_TEST(),
73-
{_Error, Response, NewState, NewShdIncr} = riak_shell:loop_TEST(Cmd, State, ShouldIncrement),
72+
{_, Cmd} = riak_shell:make_cmd_TEST(ShouldIncrement),
73+
{_Error, Response, NewState} = riak_shell:loop_TEST(Cmd, State),
7474
case lists:flatten(Response) of
7575
Expected -> lager:info("Message drained successfully ~p", [Expected]),
76-
run_commands(T, NewState, NewShdIncr);
76+
run_commands(T, NewState, ShouldIncrement);
7777
Got -> print_error("Message Expected", "", Expected, Got),
7878
fail
7979
end;
@@ -89,36 +89,36 @@ run_commands([sleep | T], State, ShouldIncrement) ->
8989
timer:sleep(1000),
9090
run_commands(T, State, ShouldIncrement);
9191
run_commands([{{match, Expected}, Cmd} | T], State, ShouldIncrement) ->
92-
{_Error, Response, NewState, NewShdIncr} = run_cmd(Cmd, State, ShouldIncrement),
92+
{_Error, Response, NewState} = run_cmd(Cmd, State, ShouldIncrement),
9393
%% when you start getting off-by-1 weirdness you will WANT to uncomment this
9494
%% Trim off the newlines to aid in string comparison
9595
ExpectedTrimmed = cleanup_output(Expected),
9696
ResultTrimmed = cleanup_output(Response),
9797
case ResultTrimmed of
9898
ExpectedTrimmed -> lager:info("Successful match of ~p from ~p", [Expected, Cmd]),
99-
run_commands(T, NewState, NewShdIncr);
99+
run_commands(T, NewState, ShouldIncrement);
100100
_ -> print_error("Ran ~p:", Cmd, Expected, Response),
101101
fail
102102
end;
103103
run_commands([{run, Cmd} | T], State, ShouldIncrement) ->
104104
lager:info("Run command: ~p", [Cmd]),
105-
{_Error, Result, NewState, NewShdIncr} = run_cmd(Cmd, State, ShouldIncrement),
105+
{_Error, Result, NewState} = run_cmd(Cmd, State, ShouldIncrement),
106106
lists:map(fun(X) -> lager:info("~s~n", [X]) end, re:split(Result, "\n", [trim])),
107-
run_commands(T, NewState, NewShdIncr).
107+
run_commands(T, NewState, ShouldIncrement).
108108

109109
cleanup_output(In) ->
110110
re:replace(lists:flatten(In), "[\r\n]", "", [global,{return,list}]).
111111

112-
run_cmd(Cmd, State, ShouldIncrement) ->
112+
run_cmd(Command, State, ShouldIncrement) ->
113113
%% the riak-shell works by spawning a process that has captured
114114
%% standard input and then dropping into a receive that the spawned
115115
%% process sends a message to
116116
%% we have to emulate that here as we are the shell
117117
%% we are going to send a message at some time in the future
118118
%% and then go into a loop waiting for it
119-
{Toks, CmdRecord} = riak_shell:make_cmd_TEST(Cmd),
119+
{Toks, Cmd} = riak_shell:make_cmd_TEST(Command, ShouldIncrement),
120120
timer:apply_after(500, riak_shell, send_to_shell, [self(), {command, Toks}]),
121-
riak_shell:loop_TEST(CmdRecord, State, ShouldIncrement).
121+
riak_shell:loop_TEST(Cmd, State).
122122

123123
print_error(Format, Cmd, Expected, Got) ->
124124
lager:info(?PREFIX ++ "Match Failure"),

0 commit comments

Comments
 (0)