Skip to content

Commit

Permalink
add protocols for stream tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Mar 6, 2024
1 parent 89593d4 commit 6da9942
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 1 addition & 3 deletions kong/router/transform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,7 @@ local function get_priority(route)

-- stream expression

if not is_empty_field(srcs) or
not is_empty_field(dsts)
then
if is_stream_route(route) then
return stream_get_priority(snis, srcs, dsts)
end

Expand Down
15 changes: 15 additions & 0 deletions spec/01-unit/08-router_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4307,6 +4307,7 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8101",
protocols = { "tcp", },
sources = {
{ ip = "127.0.0.1" },
{ ip = "127.0.0.2" },
Expand All @@ -4317,6 +4318,7 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8102",
protocols = { "tcp", },
sources = {
{ port = 65001 },
{ port = 65002 },
Expand All @@ -4328,6 +4330,7 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8103",
protocols = { "tcp", },
sources = {
{ ip = "127.168.0.0/8" },
}
Expand All @@ -4338,6 +4341,7 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8104",
protocols = { "tcp", },
sources = {
{ ip = "127.0.0.1", port = 65001 },
}
Expand All @@ -4347,6 +4351,7 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8105",
protocols = { "tcp", },
sources = {
{ ip = "127.0.0.2", port = 65300 },
{ ip = "127.168.0.0/16", port = 65301 },
Expand Down Expand Up @@ -4416,6 +4421,7 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8101",
protocols = { "tcp", },
destinations = {
{ ip = "127.0.0.1" },
{ ip = "127.0.0.2" },
Expand All @@ -4426,6 +4432,7 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8102",
protocols = { "tcp", },
destinations = {
{ port = 65001 },
{ port = 65002 },
Expand All @@ -4437,6 +4444,7 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8103",
protocols = { "tcp", },
destinations = {
{ ip = "127.168.0.0/8" },
}
Expand All @@ -4447,6 +4455,7 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8104",
protocols = { "tcp", },
destinations = {
{ ip = "127.0.0.1", port = 65001 },
}
Expand All @@ -4456,6 +4465,7 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8105",
protocols = { "tcp", },
destinations = {
{ ip = "127.0.0.2", port = 65300 },
{ ip = "127.168.0.0/16", port = 65301 },
Expand Down Expand Up @@ -4613,13 +4623,15 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8101",
protocols = { "tls", },
snis = { "www.example.org" },
}
},
{
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8102",
protocols = { "tls", },
sources = {
{ ip = "127.0.0.1" },
}
Expand All @@ -4629,6 +4641,7 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8103",
protocols = { "tls", },
destinations = {
{ ip = "172.168.0.1" },
}
Expand All @@ -4655,13 +4668,15 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8101",
protocols = { "tls", },
snis = { "www.example.org" },
}
},
{
service = service,
route = {
id = "e8fb37f1-102d-461e-9c51-6608a6bb8102",
protocols = { "tls", },
sources = {
{ ip = "127.0.0.1" },
},
Expand Down

0 comments on commit 6da9942

Please sign in to comment.