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 ->
Farside.pick_instance(service)
end
IO.inspect(get_req_header(conn, "throttle"))
IO.inspect(instance)
params =
cond do

View file

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