-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
tests(dns): flakiness due to hook conflict #13298
Conversation
013d9da
to
cee2041
Compare
|
||
before_each(function() | ||
client = require("kong.resty.dns.client") | ||
resolver = require("resty.dns.resolver") | ||
|
||
-- you can replace this `query_func` upvalue to spy on resolver query calls. | ||
-- you can replace this `resolver.query_func` to spy on resolver query calls. |
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.
What does this comment mean? I don't understand.
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 means the function is spied(hooked) to inspect the internal behavior of the DNS resolver, and the hook function can be changed. I'm not the one who wrote this originally.
KAG-4520 change the code order to ensure the resolve isnt released too early and cannot be used
ffab358
to
2b6a280
Compare
Successfully created cherry-pick PR for |
Summary
The test suits hook the query function and uses a shared variable to change the hook. This causes conflicts when test A has an aysnc query still running, and B swaps the hook function, so the function will be called more than expected times.
Checklist
CHANGELOG/unreleased/kong
or addingskip-changelog
label on PR if unnecessary. README.mdIssue reference
Fix KAG-4519