Fix tests with bad file names.
Either catch the {error, bad_arg} tuple or modify the file name to conform to the machi conventions of prefix^uuid^seqno.
This commit is contained in:
parent
fe71b72494
commit
ec9682520a
4 changed files with 13 additions and 27 deletions
|
@ -146,7 +146,7 @@ smoke_test2() ->
|
|||
File1, FooOff2, Size2)} || X <- [0,1,2] ],
|
||||
|
||||
%% Misc API smoke & minor regression checks
|
||||
{error, not_written} = machi_cr_client:read_chunk(C1, <<"no">>,
|
||||
{error, bad_arg} = machi_cr_client:read_chunk(C1, <<"no">>,
|
||||
999999999, 1),
|
||||
{error, not_written} = machi_cr_client:read_chunk(C1, File1,
|
||||
Off1, 88888888),
|
||||
|
@ -154,16 +154,9 @@ smoke_test2() ->
|
|||
{ok, KludgeBin} = machi_cr_client:checksum_list(C1, File1),
|
||||
true = is_binary(KludgeBin),
|
||||
|
||||
{error, no_such_file} = machi_cr_client:checksum_list(C1, <<"!!!!">>),
|
||||
{error, bad_arg} = machi_cr_client:checksum_list(C1, <<"!!!!">>),
|
||||
%% Exactly one file right now
|
||||
{ok, [_]} = machi_cr_client:list_files(C1),
|
||||
%% TODO MARK: The read_chunk() call on line 149 appears to be
|
||||
%% creating a zero-length file? Thus the length=1 pattern
|
||||
%% match above fails. While not a critical error, I don't
|
||||
%% believe it's behavior that we want. The error message is:
|
||||
%% in function machi_cr_client_test:smoke_test2/0 (test/machi_cr_client_test.erl, line 159)
|
||||
%% **error:{badmatch,{ok,[{0,<<"no">>},
|
||||
%% {2098202,<<"pre^e77dea39-ab3b-4f3f-aef7-1c7b85f0765d^0">>}]}}
|
||||
|
||||
%% Go back and test append_chunk_extra() and write_chunk()
|
||||
Chunk10 = <<"It's a different chunk!">>,
|
||||
|
@ -198,7 +191,11 @@ smoke_test2() ->
|
|||
witness_smoke_test_() -> {timeout, 1*60, fun() -> witness_smoke_test2() end}.
|
||||
|
||||
witness_smoke_test2() ->
|
||||
{ok, SupPid} = machi_flu_sup:start_link(),
|
||||
SupPid = case machi_flu_sup:start_link() of
|
||||
{ok, P} -> P;
|
||||
{error, {already_started, P1}} -> P1;
|
||||
Other -> error(Other)
|
||||
end,
|
||||
error_logger:tty(false),
|
||||
try
|
||||
Prefix = <<"pre">>,
|
||||
|
|
|
@ -84,7 +84,7 @@ flu_smoke_test() ->
|
|||
try
|
||||
Msg = "Hello, world!",
|
||||
Msg = ?FLU_C:echo(Host, TcpPort, Msg),
|
||||
{error, no_such_file} = ?FLU_C:checksum_list(Host, TcpPort,
|
||||
{error, bad_arg} = ?FLU_C:checksum_list(Host, TcpPort,
|
||||
?DUMMY_PV1_EPOCH,
|
||||
"does-not-exist"),
|
||||
{error, bad_arg} = ?FLU_C:checksum_list(Host, TcpPort,
|
||||
|
@ -146,14 +146,14 @@ flu_smoke_test() ->
|
|||
Chunk2 = <<"yo yo">>,
|
||||
Len2 = byte_size(Chunk2),
|
||||
Off2 = ?MINIMUM_OFFSET + 77,
|
||||
File2 = "smoke-whole-file",
|
||||
File2 = "smoke-whole-file^1^1",
|
||||
ok = ?FLU_C:write_chunk(Host, TcpPort, ?DUMMY_PV1_EPOCH,
|
||||
File2, Off2, Chunk2),
|
||||
{error, bad_arg} = ?FLU_C:write_chunk(Host, TcpPort, ?DUMMY_PV1_EPOCH,
|
||||
BadFile, Off2, Chunk2),
|
||||
{ok, Chunk2} = ?FLU_C:read_chunk(Host, TcpPort, ?DUMMY_PV1_EPOCH,
|
||||
File2, Off2, Len2),
|
||||
{error, not_written} = ?FLU_C:read_chunk(Host, TcpPort,
|
||||
{error, bad_arg} = ?FLU_C:read_chunk(Host, TcpPort,
|
||||
?DUMMY_PV1_EPOCH,
|
||||
"no!!", Off2, Len2),
|
||||
{error, bad_arg} = ?FLU_C:read_chunk(Host, TcpPort,
|
||||
|
|
|
@ -159,17 +159,6 @@ partial_stop_restart2() ->
|
|||
true = (Epoch_n > Epoch_m),
|
||||
{ok, {false, EpochID3}} = WedgeStatus(hd(Ps)),
|
||||
%% The file we're assigned should be different with the epoch change.
|
||||
%%
|
||||
%% TODO MARK: Yes, in AP mode especially (and perhaps CP, I
|
||||
%% haven't thought about it enough), if the epoch changes,
|
||||
%% file assignments for all requests that are received after
|
||||
%% the epoch change must be different.
|
||||
%%
|
||||
%% XXX FIXME: We need to validate this is a requirement. So far, the
|
||||
%% filename manager has been EpochId agnostic. It always returns the
|
||||
%% "current" filename assigned to a prefix unless the file is near
|
||||
%% the pre-set maximum file size.
|
||||
%%
|
||||
{ok, {_,_,File3}} = Append(hd(Ps), EpochID3),
|
||||
true = (File1 /= File3),
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ api_smoke_test() ->
|
|||
Host = "localhost",
|
||||
TcpPort = 57124,
|
||||
DataDir = "./data.api_smoke_flu",
|
||||
W_props = [{initial_wedged, false}],
|
||||
W_props = [{active_mode, false},{initial_wedged, false}],
|
||||
Prefix = <<"prefix">>,
|
||||
|
||||
machi_flu1_test:start_flu_package(RegName, TcpPort, DataDir, W_props),
|
||||
|
@ -70,7 +70,7 @@ api_smoke_test() ->
|
|||
{error, bad_checksum} = ?MUT:append_chunk(Prox1, FakeEpoch,
|
||||
Prefix, MyChunk_badcs),
|
||||
{error, bad_checksum} = ?MUT:write_chunk(Prox1, FakeEpoch,
|
||||
<<"foo-file">>, 99832,
|
||||
<<"foo-file^1^1">>, 99832,
|
||||
MyChunk_badcs),
|
||||
|
||||
%% Put kick_projection_reaction() in the middle of the test so
|
||||
|
@ -80,7 +80,7 @@ api_smoke_test() ->
|
|||
|
||||
%% Alright, now for the rest of the API, whee
|
||||
BadFile = <<"no-such-file">>,
|
||||
{error, no_such_file} = ?MUT:checksum_list(Prox1, FakeEpoch, BadFile),
|
||||
{error, bad_arg} = ?MUT:checksum_list(Prox1, FakeEpoch, BadFile),
|
||||
{ok, [_|_]} = ?MUT:list_files(Prox1, FakeEpoch),
|
||||
{ok, {false, _}} = ?MUT:wedge_status(Prox1),
|
||||
%% Per Scott, comment this out until he can take a look
|
||||
|
|
Loading…
Reference in a new issue