-
Notifications
You must be signed in to change notification settings - Fork 169
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
Converted balancer and backend to APIcast::Blackbox #1418
Closed
hector-vido
wants to merge
1
commit into
3scale:master
from
hector-vido:conversion_black_box_backend_balancer
Closed
Changes from all commits
Commits
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 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 |
---|---|---|
@@ -1,17 +1,41 @@ | ||
use lib 't'; | ||
use Test::APIcast 'no_plan'; | ||
use Test::APIcast::Blackbox 'no_plan'; | ||
|
||
repeat_each(1); | ||
|
||
run_tests(); | ||
|
||
__DATA__ | ||
|
||
=== TEST 1: backend | ||
This is just a simple demonstration of the | ||
=== TEST 1: This is just a simple demonstration of the | ||
echo directive provided by ngx_http_echo_module. | ||
--- config | ||
include $TEST_NGINX_BACKEND_CONFIG; | ||
--- configuration | ||
{ | ||
"services" : [ | ||
{ | ||
"id": 42, | ||
"backend_version": 1, | ||
"proxy" : { | ||
"api_backend": "http://test:$TEST_NGINX_SERVER_PORT/", | ||
"proxy_rules": [ | ||
{ "pattern" : "/", "http_method" : "GET", "metric_system_name" : "bar", "delta" : 1} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
--- backend | ||
location /transactions/authrep.xml { | ||
content_by_lua_block { | ||
ngx.exit(200) | ||
} | ||
} | ||
--- upstream | ||
location / { | ||
echo 'yay, api backend'; | ||
} | ||
--- request | ||
GET /transactions/authrep.xml | ||
GET /?user_key=value | ||
--- response_body | ||
transactions authrep! | ||
yay, api backend | ||
--- error_code: 200 |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is covered in #1416 . A small suggestion is to check existing PR(s) to avoid duplicating efforts. Good work on this one though. |
This file contains 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
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.
I wonder if we should delete this file because it really doesn't check anything.
cc @eguzki
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.
APIcast has configured a virtualhost
backend
, listening on8081
and configured withconf.d/backend.conf
. Not really used in production, but widely used in dev environments to mock backend and in the tests environments.It makes sense to me to test that this virtualhost
backend
exists and returns what the mocked backend does, which is return a200 OK
with the bodytransactions authrep!
The other alternative is to remove the virtualhost
backend
and run some mock server in another container for tests. Then it would make sense to remove this test IMO.Anyway, the new implementation of this
backend.t
is not testing thebackend
virtualhost. The request should hit thebackend
virtualhost directly.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.
@eguzki or @tkan145 any ideas on how to add a different port in the
--- request
section?Since the port is randomized in
Test/APIcast/Blackbox.pm
I can't find a way to talk directly with the backend listening in 8081.Don't know if this is the right path, but I added a section for
sites_d
:It is working from outside the test script.