|
|
@ -34,6 +34,7 @@ |
|
|
|
test_preserve_status_line/0, |
|
|
|
test_binary_headers/0, |
|
|
|
test_binary_headers/1, |
|
|
|
test_dead_lb_pid/0, |
|
|
|
test_generate_body_0/0, |
|
|
|
test_retry_of_requests/0, |
|
|
|
test_retry_of_requests/1, |
|
|
@ -61,6 +62,7 @@ |
|
|
|
{local_test_fun, test_303_response_with_a_body, []}, |
|
|
|
{local_test_fun, test_303_response_with_no_body, []}, |
|
|
|
{local_test_fun, test_binary_headers, []}, |
|
|
|
{local_test_fun, test_dead_lb_pid, []}, |
|
|
|
{local_test_fun, test_retry_of_requests, []}, |
|
|
|
{local_test_fun, verify_chunked_streaming, []}, |
|
|
|
{local_test_fun, test_chunked_streaming_once, []}, |
|
|
@ -877,6 +879,23 @@ test_generate_body_0() -> |
|
|
|
ets:delete(Tid) |
|
|
|
end. |
|
|
|
|
|
|
|
%%------------------------------------------------------------------------------ |
|
|
|
%% Test that when an lb process dies, its entry is removed from the ibrowse_lb |
|
|
|
%% table by the next requestor and replaced with a new process |
|
|
|
%%------------------------------------------------------------------------------ |
|
|
|
test_dead_lb_pid() -> |
|
|
|
{Host, Port} = {"localhost", 8181}, |
|
|
|
Url = "http://" ++ Host ++ ":" ++ integer_to_list(Port), |
|
|
|
{ok, "200", _, _} = ibrowse:send_req(Url, [], get), |
|
|
|
[{lb_pid, {Host, Port}, Pid, _}] = ets:lookup(ibrowse_lb, {Host, Port}), |
|
|
|
true = exit(Pid, kill), |
|
|
|
false = is_process_alive(Pid), |
|
|
|
{ok, "200", _, _} = ibrowse:send_req(Url, [], get), |
|
|
|
[{lb_pid, {Host, Port}, NewPid, _}] = ets:lookup(ibrowse_lb, {Host, Port}), |
|
|
|
true = NewPid /= Pid, |
|
|
|
true = is_process_alive(NewPid), |
|
|
|
success. |
|
|
|
|
|
|
|
do_trace(Fmt, Args) -> |
|
|
|
do_trace(get(my_trace_flag), Fmt, Args). |
|
|
|
|
|
|
|