-
Notifications
You must be signed in to change notification settings - Fork 171
t/apicast-policy-3scale-batcher.t: convert to APIcast::Blackbox #1349
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
t/apicast-policy-3scale-batcher.t: convert to APIcast::Blackbox #1349
Conversation
| location /transactions.xml { | ||
| content_by_lua_block { | ||
| ngx.req.read_body() | ||
| local post_args = ngx.req.get_post_args() | ||
| local app_id_match, usage_match | ||
| for k, v in pairs(post_args) do | ||
| if k == 'transactions[0][app_key]' then | ||
| ngx.exit(500) | ||
| elseif k == 'transactions[0][usage][hits]' then | ||
| usage_match = v == '3' | ||
| elseif k == 'transactions[0][app_id]' then | ||
| app_id_match = v == 'appid' | ||
| end | ||
| end | ||
| ngx.shared.result = usage_match and app_id_match | ||
| } |
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 is executed when /force_report_to_backend is called, when the backend_client is instantiated, so it includes the usage (hits) from 3 calls now instead of 2, because the /force_report_to_backend endpoint is an upstream too so it increases the hits as well. It used to be 2 in the old test because that endpoint was accessed without going through APIcast.
| location /transactions.xml { | ||
| content_by_lua_block { | ||
| ngx.req.read_body() | ||
| local post_args = ngx.req.get_post_args() | ||
| local app_id_match, usage_match | ||
| for k, v in pairs(post_args) do | ||
| if k == 'transactions[0][app_key]' then | ||
| ngx.exit(500) | ||
| elseif k == 'transactions[0][usage][hits]' then | ||
| usage_match = v == '3' | ||
| elseif k == 'transactions[0][app_id]' then | ||
| app_id_match = v == 'appid' | ||
| end | ||
| end | ||
| ngx.shared.result = usage_match and app_id_match | ||
| } |
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 is executed when /force_report_to_backend is called, when the backend_client is instantiated, so it includes the usage (hits) from 3 calls now instead of 2, because the /force_report_to_backend endpoint is an upstream too so it increases the hits as well. It used to be 2 in the old test because that endpoint was accessed without going through APIcast.
3e74c4f to
35ca9b5
Compare
35ca9b5 to
04a3054
Compare
No description provided.