1
0
Fork 0
mirror of https://github.com/benbusby/farside.git synced 2025-04-20 10:58:42 +00:00

Update throttle test to reflect new behavior

The "throttling" performed by Farside now redirects to the same instance
as before, rather than outright blocking the connection.
This commit is contained in:
Ben Busby 2022-03-18 13:59:35 -06:00
parent 22e9135e0c
commit 1be19a8a29
No known key found for this signature in database
GPG key ID: B9B7231E01D924A1
2 changed files with 9 additions and 6 deletions

View file

@ -46,8 +46,6 @@ defmodule Farside.Router do
true -> true ->
Farside.pick_instance(service) Farside.pick_instance(service)
end end
IO.inspect(get_req_header(conn, "throttle"))
IO.inspect(instance)
params = params =
cond do cond do

View file

@ -17,17 +17,22 @@ defmodule FarsideTest do
end end
test "throttle" do test "throttle" do
:get first_conn =
|> conn("/", "") :get
|> Router.call(@opts) |> conn("/", "")
|> Router.call(@opts)
first_redirect = elem(List.last(first_conn.resp_headers), 1)
throttled_conn = throttled_conn =
:get :get
|> conn("/", "") |> conn("/", "")
|> Router.call(@opts) |> Router.call(@opts)
throttled_redirect = elem(List.last(first_conn.resp_headers), 1)
assert throttled_conn.state == :sent assert throttled_conn.state == :sent
assert throttled_conn.status == 403 assert throttled_redirect == first_redirect
end end
test "/" do test "/" do