-
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
chore(tests): add a test case for /metrics
endpoint
#12695
base: master
Are you sure you want to change the base?
Conversation
Add a test case for `/metrics` endpoint. We expect the metrics endpoint can work weel even when database is down. And a db_proxy is added to spec/helpers for imitating database outage or performance decrease.
b5fbe3b
to
798a869
Compare
for _, strategy in helpers.all_strategies() do | ||
describe("Metrics API - with strategy #" .. strategy, function() | ||
|
||
if strategy == "postgres" then |
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 use helper.each_strategies()
to avoid the `if strategy == "postgres".
spec/helpers.lua
Outdated
stream_listen = "0.0.0.0:5555", | ||
proxy_listen = "0.0.0.0:16666", |
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 this is unused, will it be better just get_available_port
?
db_port = opts.db_port, | ||
db_proxy_port = get_available_port(), | ||
api_port = get_available_port(), | ||
tcp_port = get_available_port(), |
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 ports should have documentation describing their purposes
} | ||
end | ||
|
||
function db_proxy:delay(delay) |
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 documentation describing how to use these functions would also be better
123eb83
to
ff7c582
Compare
@@ -4156,6 +4156,243 @@ do | |||
end | |||
end | |||
|
|||
-------------- | |||
-- A kong based database proxy class for the simulation of database abnormal behavior. |
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.
would it make sense to move this to a separate file?
Summary
A test case is added for testing
/metrics
endpoint when database is down.And a db_proxy is added to spec/helpers for imitating database outage or performance decrease.
A related PR: https://github.com/Kong/kong-ee/pull/8321
Checklist
changelog/unreleased/kong
orskip-changelog
label added on PR if changelog is unnecessary. README.mdIssue reference
Fix #[issue number]