Skip to content

Commit

Permalink
Merge pull request #3200 from esl/deps/remove-ibrowse
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides authored Jul 30, 2021
2 parents 554cd09 + e9e15d4 commit 6ce018f
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 15 deletions.
2 changes: 1 addition & 1 deletion big_tests/rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
{erlsh, {git, "https://github.com/proger/erlsh.git", {ref, "4e8a107"}}},
{jiffy, "1.0.8"},
{proper, "1.4.0"},
{gun, "1.3.2"},
{escalus, {git, "https://github.com/esl/escalus.git", {branch, "master"}}},
{gen_fsm_compat, "0.3.0"},
{cowboy, "2.9.0"},
{csv, "3.0.3", {pkg, csve}},
{shotgun, "0.4.1"},
{amqp_client, "3.8.14"},
{esip, "1.0.33"},
{ibrowse, "4.4.1"},
{jid, "1.0.0", {pkg, mongoose_jid}}
]}.

Expand Down
5 changes: 1 addition & 4 deletions big_tests/rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
1},
{<<"gen_fsm_compat">>,{pkg,<<"gen_fsm_compat">>,<<"0.3.0">>},0},
{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1},
{<<"gun">>,{pkg,<<"gun">>,<<"1.3.2">>},1},
{<<"ibrowse">>,{pkg,<<"ibrowse">>,<<"4.4.1">>},0},
{<<"gun">>,{pkg,<<"gun">>,<<"1.3.2">>},0},
{<<"jid">>,{pkg,<<"mongoose_jid">>,<<"1.0.0">>},0},
{<<"jiffy">>,{pkg,<<"jiffy">>,<<"1.0.8">>},0},
{<<"jsx">>,{pkg,<<"jsx">>,<<"2.9.0">>},2},
Expand Down Expand Up @@ -64,7 +63,6 @@
{<<"gen_fsm_compat">>, <<"5903549F67D595F58A7101154CBE0FDD46955FBFBE40813F1E53C23A970FF5F4">>},
{<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>},
{<<"gun">>, <<"542064CBB9F613650B8A8100B3A927505F364FBE198B7A5A112868FF43F3E477">>},
{<<"ibrowse">>, <<"2B7D0637B0F8B9B4182DE4BD0F2E826A4DA2C9B04898B6E15659BA921A8D6EC2">>},
{<<"jid">>, <<"B6D8F9E3015CCB36868D5DB1E847C6176C4F7513360F11CA07B8B95DDC42421E">>},
{<<"jiffy">>, <<"60E36F00BE35E5AC6E6CF2D4CAF3BDF3103D4460AFF385F543A8D7DF2D6D9613">>},
{<<"jsx">>, <<"D2F6E5F069C00266CAD52FB15D87C428579EA4D7D73A33669E12679E203329DD">>},
Expand Down Expand Up @@ -94,7 +92,6 @@
{<<"gen_fsm_compat">>, <<"7153D11BAD328933D4B24E663D8CEC52874E14176C7FB392FA1FF768B17460D9">>},
{<<"goldrush">>, <<"99CB4128CFFCB3227581E5D4D803D5413FA643F4EB96523F77D9E6937D994CEB">>},
{<<"gun">>, <<"BA323F0A5FD8ABAC379A3E1FE6D8CE570C4A12C7FD1C68F4994B53447918E462">>},
{<<"ibrowse">>, <<"1E86C591DBC6D270632625534986BECA30813AF7CE784E742E5FC38E342C29B3">>},
{<<"jid">>, <<"D96C1223660E54549305252A3492500980505652AEB80950E201A3C446C4C9D2">>},
{<<"jiffy">>, <<"F9AE986BA5A0854EB48CF6A76192D9367086DA86C20197DA430630BE7C087A4E">>},
{<<"jsx">>, <<"8EE1DB1CABAFDD578A2776A6AAAE87C2A8CE54B47B59E9EC7DAB5D7EB71CD8DC">>},
Expand Down
3 changes: 2 additions & 1 deletion big_tests/src/ejabberd_tests.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
stdlib,
cowboy,
gen_fsm_compat,
jid
jid,
gun
]},
{env, []}
]}.
49 changes: 42 additions & 7 deletions big_tests/tests/mod_http_upload_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,9 @@ suite() ->
%%--------------------------------------------------------------------

init_per_suite(Config) ->
ibrowse:start(),
escalus:init_per_suite(Config).

end_per_suite(Config) ->
ibrowse:stop(),
escalus:end_per_suite(Config).

init_per_group(unset_size, Config) ->
Expand Down Expand Up @@ -278,12 +276,49 @@ test_minio_upload(Config, ContentType) ->
GetUrl = binary_to_list(extract_url(Result, <<"get">>)),
PutUrl = binary_to_list(extract_url(Result, <<"put">>)),
Header = generate_header(Config, ContentType),
PutRetValue = ibrowse:send_req(PutUrl, Header, put, ?MINIO_TEST_DATA),
?assertMatch({ok, "200", _, []}, PutRetValue),
GetRetValue = ibrowse:send_req(GetUrl, [], get),
?assertMatch({ok, "200", _, ?MINIO_TEST_DATA}, GetRetValue)
PutRetValue = request(put, PutUrl, Header, ?MINIO_TEST_DATA),
?assertMatch({200, _}, PutRetValue),
GetRetValue = request(get, GetUrl, [], []),
?assertMatch({200, ?MINIO_TEST_DATA}, GetRetValue)
end).

request(Method, PutUrl, Header, Data) ->
PURL = #{host := Host, port := Port, path := Path} = uri_string:parse(PutUrl),
{ok, ConnPid} = gun:open(Host, Port),
{ok, _} = gun:await_up(ConnPid),
FullPath =
case PURL of
#{query := Query} ->
Path ++ "?" ++ Query;
_ ->
Path
end,
StreamRef =
case Method of
put ->
gun:put(ConnPid, FullPath, Header, Data);
get ->
gun:get(ConnPid, FullPath)
end,
RespOpts = #{pid => ConnPid, stream_ref => StreamRef, acc => <<>>},
#{status := Status, acc := Acc} = get_reponse(RespOpts),
ok = gun:close(ConnPid),
{Status, binary_to_list(Acc)}.

get_reponse(#{pid := Pid, stream_ref := StreamRef, acc := Acc} = Opts) ->
case gun:await(Pid, StreamRef) of
{response, fin, Status, _} ->
Opts#{status => Status, acc => Acc};
{response, nofin, Status, _} ->
get_reponse(Opts#{status => Status});
{data, nofin, Data} ->
get_reponse(Opts#{acc => <<Acc/binary, Data/binary>>});
{data, fin, Data} ->
Opts#{acc => <<Acc/binary, Data/binary>>};
Error ->
Error
end.

generate_header(Config, undefined) ->
case proplists:get_value(with_acl, Config, false) of
true ->
Expand All @@ -292,7 +327,7 @@ generate_header(Config, undefined) ->
[]
end;
generate_header(Config, ContentType) ->
[{<<"Content-Type">>, ContentType} | generate_header(Config, undefined)].
[{<<"content-type">>, ContentType} | generate_header(Config, undefined)].

rejects_empty_filename(Config) ->
escalus:story(
Expand Down
3 changes: 1 addition & 2 deletions tools/setup_riak.escript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
-ifdef(OTP_RELEASE).
-define(STACKTRACE(C, R, S), C:R:S ->).
-else.
%% This script runs inside michalwski/docker-riak, which still uses OTP 20.3
-define(STACKTRACE(C, R, S), C:R -> S = erlang:get_stacktrace(),).
-endif.

Expand All @@ -23,8 +24,6 @@ main(_) ->
io:format("Riak node ~p~n", [RiakNode]),
try setup_riak_node(RiakNode)
catch ?STACKTRACE(Class, Reason, Stacktrace)
%% This script runs inside michalwski/docker-riak, which still uses OTP 20.3
%Stacktrace = erlang:get_stacktrace(),
io:format("Failed ~p:~p~n~p~n", [Class, Reason, Stacktrace]),
init:stop(1)
end,
Expand Down

0 comments on commit 6ce018f

Please sign in to comment.