Skip to content

Commit

Permalink
Make roles header test work regardless of order.
Browse files Browse the repository at this point in the history
Something appears to have changed in the OpenResty v1.11.2.3 upgrade
that internally changed the order of the tables we use for keeping track
of the user's roles. However, we should have never been relying on the
table order, so fix the test so it works regardless of output order.
  • Loading branch information
GUI committed Apr 23, 2017
1 parent 27bf988 commit f638531
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/proxy/request_rewriting/test_adds_roles_header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ def test_comma_delimits_multiple_roles
}))
assert_response_code(200, response)
data = MultiJson.load(response.body)
assert_equal("private,foo,bar", data["headers"]["x-api-roles"])
assert(data["headers"]["x-api-roles"])
assert_equal([
"bar",
"foo",
"private",
].sort, data["headers"]["x-api-roles"].split(",").sort)
end

def test_strips_forged_values
Expand Down

0 comments on commit f638531

Please sign in to comment.