-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[add test case]add testcase for #1625 to test the filed of overhead #1645
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5e10f0b
add testcase for #1625 to correct overhead's value
dabue b4c6457
update the testcases in prometheus
dabue 492880c
resolve the conflict to master
dabue 2eb49ba
correct the style for test case
dabue 923fa95
reuse the sleep1 function
dabue 2269e1b
clean the route and service added
dabue File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,7 +200,7 @@ GET /t | |
{"error_msg":"failed to check the configuration of plugin prometheus err: additional properties forbidden, found invalid_property"} | ||
--- no_error_log | ||
[error] | ||
|
||
--- | ||
|
||
|
||
|
||
=== TEST 10: set it in service (with wrong property) | ||
|
@@ -534,3 +534,79 @@ GET /apisix/prometheus/metrics | |
qr/.*apisix_http_overhead_bucket.*/ | ||
--- no_error_log | ||
[error] | ||
|
||
membphis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
=== TEST 26: add service 3 to distinguish other services | ||
--- config | ||
location /t { | ||
content_by_lua_block { | ||
local t = require("lib.test_admin").test | ||
local code, body = t('/apisix/admin/services/3', | ||
ngx.HTTP_PUT, | ||
[[{ | ||
"plugins": { | ||
"prometheus": {} | ||
}, | ||
"upstream": { | ||
"nodes": { | ||
"127.0.0.1:1981": 1 | ||
}, | ||
"type": "roundrobin" | ||
} | ||
}]] | ||
) | ||
|
||
if code >= 300 then | ||
ngx.status = code | ||
end | ||
ngx.say(body) | ||
} | ||
} | ||
--- request | ||
GET /t | ||
--- response_body | ||
passed | ||
--- no_error_log | ||
[error] | ||
|
||
=== TEST 27: add a route 4 to redirect /hello4 | ||
--- config | ||
location /t { | ||
content_by_lua_block { | ||
local t = require("lib.test_admin").test | ||
local code, body = t('/apisix/admin/routes/4', | ||
ngx.HTTP_PUT, | ||
[[{ | ||
"service_id": 3, | ||
"uri": "/hello4" | ||
}]] | ||
) | ||
|
||
if code >= 300 then | ||
ngx.status = code | ||
end | ||
ngx.say(body) | ||
} | ||
} | ||
--- request | ||
GET /t | ||
--- response_body | ||
passed | ||
--- no_error_log | ||
[error] | ||
|
||
=== TEST 28: request from client to /hello4 ( all hit, the hello4 sleep 1s) | ||
--- pipelined_requests eval | ||
["GET /hello4", "GET /hello4", "GET /hello4"] | ||
--- error_code eval | ||
[200, 200, 200] | ||
--- no_error_log | ||
[error] | ||
|
||
|
||
=== TEST 29: fetch the prometheus metric data with `overhead`(the overhead < 1s) | ||
--- request | ||
GET /apisix/prometheus/metrics | ||
--- response_body eval | ||
qr/apisix_http_overhead_bucket.*service=\"3\".*le=\"00500.0.*/ | ||
--- no_error_log | ||
[error] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 reuse
sleep1
:https://github.com/apache/incubator-apisix/blob/492880c05ee064ea7274b0b1cd52f00356eea04d/t/lib/server.lua#L68
you can take a look at:
https://github.com/apache/incubator-apisix/blob/master/t/node/timeout-upstream.t#L49