-
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
feat(test): add reconfiguration completion detection plugin #12391
feat(test): add reconfiguration completion detection plugin #12391
Conversation
94841e9
to
22fbc04
Compare
22fbc04
to
de990ca
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.
nice and simple, looks good to me
fe7a254
to
e822bc7
Compare
f0dc75a
to
bc43602
Compare
Implemented as a tests-only plugin now.
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 like the idea. It simplifies the test a lot. However, could we rely on this behavior of sequential application of the changes?
I think the mechanism is reliable enough. It is still that further synchronization is needed, i.e. when testing plugins that perform asynchronous configuration operations, but for most tests, this should be good enough. |
bc43602
to
4af2518
Compare
spec/fixtures/custom_plugins/kong/plugins/reconfiguration-completion/handler.lua
Outdated
Show resolved
Hide resolved
4af2518
to
a788ec4
Compare
Unlike the previous implementation, this one does not require changes to Kong and its proxy path. It works based on the assumption that the order of admin API changes is preserved. The admin API client marks the end of the changes that it needs to see propagated to the data plane(s) by changing the configuration of this plugin, setting a particular configuration version number. On the proxy path, a header X-Kong-Configuration-Version is sent with that version number. The plugin's access handler verifies that the version number configured in the plugin (on the dataplane) matches the version number requested by the client. If the version numbers do not match, a 503 error is generated, which causes the client to retry. The plugin is available only to busted tests. It needs to be enabled when starting Kong. A new busted test helper function make_synchronized_clients is provided that automatically synchronizes a proxy client and an admin API client. The the test can freely mix invocations to either endpoints. Whenever a change is made through the admin API, the proxy path request is delayed until the change has propagated to the data plane. spec/02-integration/13-vaults/06-refresh-secrets_spec.lua has been updated to use the function as an illustration.
a788ec4
to
eb6f0b6
Compare
Successfully created cherry-pick PR for |
Summary
Unlike the previous implementation, this one does not require changes
to Kong and its proxy path. It works based on the assumption that the
order of admin API changes is preserved. The admin API client marks
the end of the changes that it needs to see propagated to the data
plane(s) by changing the configuration of this plugin, setting a
particular configuration version number. On the proxy path, a header
X-Kong-Configuration-Version is sent with that version number. The
plugin's access handler verifies that the version number configured in
the plugin (on the dataplane) matches the version number requested by
the client. If the version numbers do not match, a 503 error is
generated, which causes the client to retry.
The plugin is available only to busted tests. It needs to be enabled
when starting Kong.
A new busted test helper function
make_synchronized_clients
isprovided that automatically synchronizes a proxy client and an admin
API client. The the test can freely mix invocations to either
endpoints. Whenever a change is made through the admin API, the proxy
path request is delayed until the change has propagated to the data
plane. spec/02-integration/13-vaults/06-refresh-secrets_spec.lua has
been updated to use the function as an illustration.
Checklist
changelog/unreleased/kong
orskip-changelog
label added on PR if changelog is unnecessary. README.mdIssue reference
KAG-3265