-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: update Kong Lua tree to 3.0.0-alpha.3 #27
Conversation
{ sources = typedefs.sources }, | ||
{ destinations = typedefs.destinations }, | ||
{ hosts = typedefs.hosts }, | ||
{ paths = typedefs.paths }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the commit message or PR description for what was altered.
However, part of those changes was removing the typedefs.paths
typedef, as it was removed from Kong. In the event users were to use this typedef on plugin schemas, it would cause issues (however they could easily replicate it with the existing typedefs.path
typedef).
Are we okay with this removal? We can easily add it back, but should we? This PR is held from merging for this reason. @mikefero stated that he'll look into this a bit further, but figured to get this PR up anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't completely get rid off typedefs.path. It is most certainly being used by some plugins.
If we are certain that none of the relevant plugins use this typedef, we can remove it. This includes the custom plugins that matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typedefs.paths
is not used anywhere in Koko nor is used in any custom plugins. As such, we could technically remove it, however, that still may not be the right thing to do. Hence why I wanted to have this conversation, does that change your viewpoints at all?
I can't make any decisions here, so will defer to the rest of you all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the documentation:
The typedefs variable (obtained by requiring kong.db.schema.typedefs) is a table containing a lot of useful type definitions and aliases....
To learn more about schemas, see:
· The source code of typedefs.lua to get an idea of what’s provided there by default.
To me this sounds like most typedefs should stay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am on the fence with this. path
and paths
seemed to be historically for routes and the router and most plugins (and custom plugins I have seen) use string for path fields. If we want to keep backwards compatibility for the small (if not 0) percentage of users using this typedef I think we should alias path
and paths
to router_path
and router_paths
.
Also we need to add additional tests for router_path
and router_pathssince you are including them here. I noticed the validate functions are calling
ngx.re.findwhich is not available in
goks` and the aliasing piece for the loader is still being worked on by @omegabytes.
I think cidr
is already being handled by ip_or_cidr
in the tests, but please verify and create a test for that as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikefero I am on the fence with this. path and paths seemed to be historically for routes and the router and most plugins (and custom plugins I have seen) use string for path fields. If we want to keep backwards compatibility for the small (if not 0) percentage of users using this typedef I think we should alias path and paths to router_path and router_paths.
I'm also on the fence, as the use of this legacy typedef would likely be quite low; I'm not saying removing it is the right answer either.
@mikefero Also we need to add additional tests for router_path and router_pathssince you are including them here. I noticed the validate functions are callingngx.re.findwhich is not available ingoks` and the aliasing piece for the loader is still being worked on by @omegabytes.
I frankly didn't dig in too much to see if aliasing path
& paths
to router_path
& router_paths
would be 100% backwards compatible, but indeed, that's an option & something we can audit.
@mikefero I think cidr is already being handled by ip_or_cidr in the tests, but please verify and create a test for that as well.
After looking a bit more, I see that typedefs.cidr
is just an alias for cidr_v4
, will remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ended up re-introducing typedefs.path
per the conversations here.
03d32b4
to
7e6e20c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few simple changes:
- Move a lot of content from the 2nd commit message into the patch file itself.
- Please specify the git sha of the alpha.3 git tag. I do not trust tags to be around all the time.
patches/lua-tree.patch
Outdated
- end, | ||
- } }, | ||
- }, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add this to the patch description like we do for all other changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I did log these things, but it must have got reverted while I was making changes. Will add it back.
+ end | ||
+ return copy | ||
+ end | ||
+ end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document this in the patch description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will defer to this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The general comment Reintroducing fallback Lua functions, as the OpenResty tooling is not available for use
could be expanded on a bit instead of linking to the Kong Gateway OSS source code. I count three OpenResty table
usages that could be added to the bullets under that section; WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikefero The general comment Reintroducing fallback Lua functions, as the OpenResty tooling is not available for use could be expanded on a bit instead of linking to the Kong Gateway OSS source code. I count three OpenResty table usages that could be added to the bullets under that section; WDYT?
Ah, can do. I'll be a bit more specific there.
patches/lua-tree.patch
Outdated
+local time_ns = function() | ||
+ return require("socket").gettime() * 10^9 | ||
end | ||
_M.time_ns = time_ns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document this in the patch description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will defer to this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mentioned this earlier, but I think we can simply remove time_ns()
from util.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikefero I mentioned this earlier, but I think we can simply remove time_ns() from util.
Will keep the convo in this conversation.
_M.yield = function() return end | ||
|
||
local time_ns = function() | ||
return require("socket").gettime() * 10^9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the source for this gettime function?
I couldn't grep my way to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it's actually part of a the Lua socket C-lib: https://github.com/lunarmodules/luasocket/blob/5b18e475f38fcf28429b1cc4b17baee3b9793a62/src/timeout.c#L36
Guessing this function is unused during the code execution (however it was previously failing due to the imports before). I'll switch it to use something else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If nothing for plugin validation is using utils.time_ns()
then we can safely remove this function and add that to the patch. It looks like all the imports are localized so removing should be sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, nothing is directly using it right now. As it's a global function though, technically speaking couldn't custom plugin schemas use it for "insert any reason"? It wasn't difficult to support, so I was personally leaning to support it. Sure, it doesn't return the exact time in nanoseconds (and technically that could be a security risk if one were using the value for randomness seeding), but for our current use-case of plugin validation, I felt this was okay.
I'm perfectly fine with removing it if that's what we want, however, I'm just thinking about these things from a maintainability perspective and "what if" it's used in the future, because it's a global function after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically speaking couldn't custom plugin schemas use it for "insert any reason"?
Being a util
and not built into the PDK I think we can safely assume that no custom plugins will be using this in their custom validations.
I'm just thinking about these things from a maintainability perspective and "what if" it's used in the future, because it's a global function after all.
Fair point, but I think for those what if future uses we can deal with things then or provide them a solution that works within their schema.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do make some good points there too. I honestly could go either way here. I'll assume we'll just remove the global time_ns()
function unless anyone says otherwise. Removing it could break things in a future Kong Lua code update, however, the chances are that are likely rare.
For verification, how did you generate the first commit? |
Had to do it manually as the script is hard-coded to pull from the Luarocks repository. As such, I checked out Kong, built everything myself, and generated the tree from that. Any such automation there should be part of another PR. |
I did actually intend to have it in the patch file itself per this comment, and that's what was in the patch file before. As noted, I'll get that fixed. Anyway, will strip it out of the commit. |
Alright. |
7e6e20c
to
1a7efa2
Compare
c78a29d
to
ff0ad4b
Compare
return tonumber(t.tv_sec) * 1e9 + tonumber(t.tv_nsec) | ||
end | ||
local time_ns = function() | ||
return require("os").time() * 10^9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gopher-lua VM does support this & returns the current Unix epoch in seconds, as expected:
https://github.com/yuin/gopher-lua/blob/658193537a640772633e656f4673334fe1644944/oslib.go#L67
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just get rid of the function entirely; it doesn't seem to be used. It is only being used in:
- kong/pdk/tracing.lua
- kong/plugins/opentelemetry/otlp.lua
- kong/tracing/instrumentation.lua
kong.tracing.instrumentation
is imported in kong/init.lua
; however this isn't used directly by goks
so none of these should be utilized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will defer this conversation to this thread.
patches/lua-tree.patch
Outdated
@@ -42,6 +46,8 @@ schema/init.lua: | |||
- use re_match as UUID match intad of re_find | |||
- remove log statements | |||
- ensure custom_entity_checks in schemas return error message | |||
- Reintroducing fallback Lua functions, as the OpenResty tooling is not available for use. | |||
Read more: https://github.com/Kong/kong/commit/15c427e090452396a5f52bf6848d8ad6bbe5e2d1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Secret referencing has been disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, can you be a bit more specific? Are you saying to add that as a bullet item? I felt that was not needed as this existing bullet item is saying:
Line 40 in c3b4a7a
- removing references to vault due to C lib usage (e.g. referenceable objects) |
The code checks out. Deferring the final review to @javierguerragiraldez and @mikefero. |
{ sources = typedefs.sources }, | ||
{ destinations = typedefs.destinations }, | ||
{ hosts = typedefs.hosts }, | ||
{ paths = typedefs.paths }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the documentation:
The typedefs variable (obtained by requiring kong.db.schema.typedefs) is a table containing a lot of useful type definitions and aliases....
To learn more about schemas, see:
· The source code of typedefs.lua to get an idea of what’s provided there by default.
To me this sounds like most typedefs should stay.
|
||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are several of these lines with whitespace. i think cleaning them would make the diff much easier to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These whitespaces were generated by the Git patch generation itself, I did not purposefully add these.
Whitespaces in patch files shouldn't be edited as these are part of the source files & how the diff was generated, if this were to be edited, the patch wouldn't be able to be applied without telling it to ignore whitespace (via git apply --reject --whitespace=fix
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, no need to edit whitespaces (even if only because git is particularly bad in that respect), but this commit adds a lot of them. they weren't there before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, I assume because the past author of these changes had their editor strip the whitespaces. I didn't edit these manually, I just pasted in the generated patch & rearranged two files as they were previously out of order (and I left it that way).
The way the patch is after these changes is how it actually should have been in the first place.
_M.yield = function() return end | ||
|
||
local time_ns = function() | ||
return require("socket").gettime() * 10^9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If nothing for plugin validation is using utils.time_ns()
then we can safely remove this function and add that to the patch. It looks like all the imports are localized so removing should be sufficient.
return true | ||
end, | ||
} }, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am on the fence about this change. I understand we need this removal and the requires due to them not being available in gopher-lua, but WDYT about this instead.
- Move the local imports into the condition for
expression
- Force the
kong_router_flavor
to be traditional and add a comment - Revert the removal of the entity_checks here
-- ATC router is incompatible with goks
local kong_router_flavor = "traditional"
if kong_router_flavor == "expressions" then
local atc = require("kong.router.atc")
local router = require("resty.router.router")
return {
My reasoning here is less patch and if the defaults change out from underneath us and we are not ready then this catch will ensure nothing breaks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As local r = router.new(s)
uses the FFI interface (due to it using atc-router), importing resty.router.router
wouldn't work as intended as such. Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed it wouldn't work, but it should never hit that condition which means those ATC imports will never get performed either. We could also just remove everything in here for the ATC router, remove the if
block and keep only the else
block. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good with me. I'll just assume if we want to support the ATC router typedef, it'll be part of another effort then.
return tonumber(t.tv_sec) * 1e9 + tonumber(t.tv_nsec) | ||
end | ||
local time_ns = function() | ||
return require("os").time() * 10^9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just get rid of the function entirely; it doesn't seem to be used. It is only being used in:
- kong/pdk/tracing.lua
- kong/plugins/opentelemetry/otlp.lua
- kong/tracing/instrumentation.lua
kong.tracing.instrumentation
is imported in kong/init.lua
; however this isn't used directly by goks
so none of these should be utilized.
patches/lua-tree.patch
Outdated
+ end | ||
+end | ||
+ | ||
+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This localized function makes sense and it is only used if a field is referenceable. Maybe in the patch comments you can indicate a little more under Reintroducing fallback Lua functions, as the OpenResty tooling is not available for use
. Also could we add a small blurb as to why we are adding this function in the code?
-- 'table.new' is an OpenResty function and is not available to goks
local new_tab
something like that; please rephrase to make more coherent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can be a bit more specific within the patch file as mentioned here. Was there anything specific you wanted to call out other than what functions have been added back & to what files?
As for adding in comments into the code itself, sure thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just listing out the OpenResty functionality that you are re-implementing is good enough; just something to catch our eyes and help the next person looking at this.
+ end | ||
+ return copy | ||
+ end | ||
+ end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The general comment Reintroducing fallback Lua functions, as the OpenResty tooling is not available for use
could be expanded on a bit instead of linking to the Kong Gateway OSS source code. I count three OpenResty table
usages that could be added to the bullets under that section; WDYT?
patches/lua-tree.patch
Outdated
+local time_ns = function() | ||
+ return require("socket").gettime() * 10^9 | ||
end | ||
_M.time_ns = time_ns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mentioned this earlier, but I think we can simply remove time_ns()
from util.
{ sources = typedefs.sources }, | ||
{ destinations = typedefs.destinations }, | ||
{ hosts = typedefs.hosts }, | ||
{ paths = typedefs.paths }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am on the fence with this. path
and paths
seemed to be historically for routes and the router and most plugins (and custom plugins I have seen) use string for path fields. If we want to keep backwards compatibility for the small (if not 0) percentage of users using this typedef I think we should alias path
and paths
to router_path
and router_paths
.
Also we need to add additional tests for router_path
and router_pathssince you are including them here. I noticed the validate functions are calling
ngx.re.findwhich is not available in
goks` and the aliasing piece for the loader is still being worked on by @omegabytes.
I think cidr
is already being handled by ip_or_cidr
in the tests, but please verify and create a test for that as well.
I generally agree on @mikefero comments about removing impossible conditions or making the "fallback" functions as simple as possible. OTOH, these are very small details and I don't think affect maintainability at all, so I don't want to waste more of everybody's time on that. about removing typedefs, I do think that most of them should stay; even if the verification is currently weak. that could be progressively improved while maintaining source compatibility with Kong CP. |
77e2c34
to
7870c4a
Compare
patches/lua-tree.patch
Outdated
@@ -42,6 +47,7 @@ schema/init.lua: | |||
- use re_match as UUID match intad of re_find | |||
- remove log statements | |||
- ensure custom_entity_checks in schemas return error message | |||
- Reintroducing fallback `new_tab()` function, as `table.new()` OpenResty function is not available for use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: table.new is luajit, not openresty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah derp, will fix the comment. To be fair, it's slightly confusing as OpenResty maintains its own fork of LuaJIT.
patches/lua-tree.patch
Outdated
@@ -52,6 +58,11 @@ schema/typedefs.lua: | |||
- use go.re2::match instead of string.match | |||
- fix tag validation; switch from decimal ASCII code to hex | |||
- fix validate_path regex due to go.re2::match | |||
- No-oping `kong.tools.utils.yield()` function. | |||
- Removing `time_ns()` function, as it requires the FFI interface & is currently unused by goks. | |||
- Adding back the `paths` typedef as it was removed in 3.0, as we're wanting to keep it around for use in goks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now i'm confused, was paths
removed from Kong?
(nit, "we're wanting" sounds unnatural... at least to non-native ears)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, typedefs.paths
was removed from Kong 3.0 in favor of typedefs.router_paths
.
Regarding the grammatical comment, "we're wanting" is perfectly valid English, as "we're" is a contraction for "we are". To your point, English will always be English with its weird oddities. "we're" & "were" may or not be pronounced the same way depending on the accent, but the typical phonetic spelling of "we're" is "weer" & "were" is "wuhr".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on paths, as defined in Kong:
- pre-3.0:
- path : string starting with
/
; used on services and upstreams. - paths: array of "path" elements; used on routes.
- path : string starting with
- 3.0 and on:
- path : string starting with
/
; used on services and upstreams. - router_path : string starting with
/
or~/
- router_paths: array or "router_path" elements; used on routes.
- path : string starting with
so my confusion was because the plural form was removed(/replaced), but the singular is still there. and yes, since we have different backwards compatibility requirements we should keep it.
(on the grammatical thing, of course i do know about contractions (took a while, but i've grown used to the british style 🤣 ) it's the gerund form that seems a bit out of phase with the indefinite tense typical in docs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so my confusion was because the plural form was removed(/replaced), but the singular is still there. and yes, since we have different backwards compatibility requirements we should keep it.
Exactly, that's what I noticed as well. I'm unsure why the gateway team decided to keep typedefs.path
around, but perhaps there is a reason. Apologize for the confusion.
it's the gerund form that seems a bit out of phase with the indefinite tense typical in docs)
Ah, I see, I thought you were commenting on how it sounds vs. the tense. Yes, you're right, the verb form there wasn't grammatically proper. I've re-phrased it.
plugin/testdata/router-path-test.lua
Outdated
local typedefs = require "kong.db.schema.typedefs" | ||
|
||
local schema = { | ||
name = "path-test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the plugin name consistent with the filename. I understand that there is the alias, but it isn't an exact alias of router_path
. You should be able to update the function signature to pass in the plugin name or to use the basename of the filename.
name = "path-test", | |
name = "route-path-test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made this change, but called it "router-path-test" to be consistent with the typedef naming.
plugin/validator_test.go
Outdated
t.Run(path.name, func(t *testing.T) { | ||
err := v.Validate(fmt.Sprintf(pathTestPlugin, path.path)) | ||
require.Error(t, err) | ||
assert.JSONEq(t, path.expectedErr, err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we write a couple tests for this for typedefs.router_paths
? I know this is just an array of typedefs.router_path
, but it will allow for complete typedef coverage. The easiest would be all of the good router paths in one test, then a mixture of good and bad for failure test; WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no existing tests for typedefs.paths
, so I was just matching what was already done. With that said, yes we can update the code to support running tests for those types.
Edit: There are some very thorough tests here now. 😄
f387d53
to
dc1410c
Compare
d0c9f6b
to
d69830e
Compare
be9cbf3
to
8e5bc67
Compare
+local cjson = { array_mt = {} } --- TODO(hbagdi) XXX analyze the impact | ||
+local uuid = require "go.uuid".generate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the removal of local uuid = require "go.uuid".generate
expected? I see the "docstring" entry has not been removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is expected. I did not modify this patch manually, it was all done after updating the Lua tree & just simply replacing the existing patches for the files.
I just forgot to remove the docstring comment from the patch file. I'll go ahead and do that, nice catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed here:
de4b149
plugin/validator_paths_test.go
Outdated
shouldSkip := true | ||
for _, p := range t.scopedToPlugins { | ||
if p == pluginName { | ||
shouldSkip = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just return false
here to avoid keep looping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blerg, yea we can. This wasn't originally in a function & decided to move it into one, and didn't refactor it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! 7a0259e
@@ -0,0 +1,297 @@ | |||
package plugin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!!!
Two questions:
|
For now, that's the plan, until we can introduce better automation here. I didn't want to increase the scope of work of this too dramatically, as such automation there is a bit easier said than done.
As notated in the PR description, yes this was tested in Koko itself as much as I possibly can. |
8e5bc67
to
1c289a6
Compare
1c289a6
to
7a0259e
Compare
Introduces tests for: - `typedefs.router_path` - `typedefs.router_paths` - `typedefs.paths`
7a0259e
to
2919b47
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks great!!! There is one small issue as 3.0.0 has been recently tagged causing a patch issue with utils.lua. The patch will still work, but creates fuzz
apply due to changes between 3.0.0-alpha.3 and this new tag; 3.0.0-alpha applies cleanly.
No need to worry about this now, we can tackle that when luarock is available.
These changes update the Kong Lua tree to 3.0.0-alpha.3 (Kong/kong@e08c0c4).
The new patches that were applied are below:
entities/routes.lua
:schema/plugin_loader.lua
:new_tab()
function, astable.new()
LuaJIT function is not available for use.schema/typedefs.lua
:validate_path_with_regexes()
to usego.re2.find()
. This may cause problems in the future, due to it utilizing RE2 instead of PCRE.tools/utils.lua
:is_array_fast()
function, astable.isarray()
OpenResty function is not available for use.clone()
function, astable.clone()
OpenResty function is not available for use.The all-typedefs.lua plugin schema test fixture & the validation tests were also updated to include
typedefs.router_path(s)
& missing tests fortypedefs.paths
:These changes were tested against Koko, and after the expected changes (e.g.:
shorthands
field being removed in favor ofshorthand_fields
), all is working as expected. I did have to fake the Kong DP version as while Koko was updated to support a four-digit versioning scheme, go-kong was not.