Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(requirements): bump atc-router to v1.6.0 #12405

Merged
merged 4 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .requirements
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LUA_KONG_NGINX_MODULE=4fbc3ddc7dcbc706ed286b95344f3cb6da17e637 # 0.8.0
LUA_RESTY_LMDB=19a6da0616db43baf8197dace59e64244430b3c4 # 1.4.1
LUA_RESTY_EVENTS=8448a92cec36ac04ea522e78f6496ba03c9b1fd8 # 0.2.0
LUA_RESTY_WEBSOCKET=60eafc3d7153bceb16e6327074e0afc3d94b1316 # 0.4.0
ATC_ROUTER=ee6bb38f9c71becb750041f605bfe0fffc2c70fe # 1.5.1
ATC_ROUTER=1abb9286947b70b4e302d8df953961c1280a0289 # 1.6.0

KONG_MANAGER=nightly
NGX_WASM_MODULE=a7087a37f0d423707366a694630f1e09f4c21728
Expand Down
3 changes: 3 additions & 0 deletions changelog/unreleased/expressions_not_operator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: The expressions route now supports the `!` (not) operator, which allows creating routes like `!(http.path =^)` and `!(http.path == "/a" || http.path == "/b")`
type: "feature"
scope: "Core"
2 changes: 1 addition & 1 deletion changelog/unreleased/kong/bump-atc-router.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
message: Bumped atc-router from 1.2.0 to 1.5.1
message: Bumped atc-router from 1.2.0 to 1.6.0
type: dependency
scope: Core
19 changes: 19 additions & 0 deletions spec/01-unit/01-db/01-schema/06-routes_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,25 @@ describe("routes schema (flavor = expressions)", function()
reload_flavor("expressions")
setup_global_env()

it("validates a 'not' expression", function()
local route = {
id = a_valid_uuid,
name = "my_route",
protocols = { "http" },
expression = [[!(http.method == "GET") && !(http.host == "example.com") && !(http.path ^= "/foo")]],
priority = 100,
strip_path = false,
preserve_host = true,
service = { id = another_uuid },
}
route = Routes:process_auto_fields(route, "insert")
assert.truthy(route.created_at)
assert.truthy(route.updated_at)
assert.same(route.created_at, route.updated_at)
assert.truthy(Routes:validate(route))
assert.falsy(route.strip_path)
end)

it("validates a valid http route", function()
local route = {
id = a_valid_uuid,
Expand Down
30 changes: 30 additions & 0 deletions spec/01-unit/08-router_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5601,5 +5601,35 @@ do
assert.same(ctx.route_match_cached, "pos")
end)
end)

describe("Router (flavor = " .. flavor .. ") [http]", function()
reload_router(flavor)

it("select() should match not expression", function()
local use_case = {
{
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8101",
expression = [[!(http.path ^= r#"/foo"#)]],
priority = 100,
},
},
}

local router = assert(new_router(use_case))

local match_t = router:select("GET", "/123/foo/bar")
assert.truthy(match_t)
assert.same(use_case[1].route, match_t.route)

local match_t = router:select("GET", "/xyz/hello-world/bar")
assert.truthy(match_t)
assert.same(use_case[1].route, match_t.route)

local match_t = router:select("GET", "/foo/bar")
assert.falsy(match_t)
end)
end)
end -- local flavor = "expressions"

Loading