Skip to content

Commit

Permalink
[THREESCALE-2194] Lazy configuration integration test.
Browse files Browse the repository at this point in the history
Load an invalid json to make sure that the invalid config does not break
the thread.

Signed-off-by: Eloy Coto <eloy.coto@gmail.com>
  • Loading branch information
eloycoto committed May 29, 2019
1 parent 24025ee commit 4c4573f
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions t/configuration-loading-lazy.t
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ GET /t
=== TEST 3: load valid configuration
should correctly route the request
--- main_config
env THREESCALE_PORTAL_ENDPOINT=http://127.0.0.1:$TEST_NGINX_SERVER_PORT;
env THREESCALE_PORTAL_ENDPOINT=http://127.0.0.1:$TEST_NGINX_SERVER_PORT/;
env APICAST_CONFIGURATION_LOADER=lazy;
--- http_config
include $TEST_NGINX_HTTP_CONFIG;
include $TEST_NGINX_UPSTREAM_CONFIG;
Expand All @@ -75,7 +76,7 @@ env THREESCALE_PORTAL_ENDPOINT=http://127.0.0.1:$TEST_NGINX_SERVER_PORT;
GET /t?user_key=fake
--- error_code: 200
--- user_files eval
[
[
[ 'config.json', qq|
{
"services": [{
Expand All @@ -95,3 +96,30 @@ GET /t?user_key=fake
| ]
]
=== TEST 4: load invalid json
To validate that process does not died with invalid config
--- main_config
env THREESCALE_PORTAL_ENDPOINT=http://127.0.0.1:$TEST_NGINX_SERVER_PORT/;
env APICAST_CONFIGURATION_LOADER=lazy;
--- http_config
include $TEST_NGINX_UPSTREAM_CONFIG;
lua_package_path "$TEST_NGINX_LUA_PATH";
--- config
include $TEST_NGINX_APICAST_CONFIG;
include $TEST_NGINX_BACKEND_CONFIG;
location = /admin/api/nginx/spec.json {
try_files /config.json =404;
}
location /api/ {
echo "all ok";
}
--- request
GET /t?user_key=fake
--- error_code: 404
--- user_files
>>> config.json
{Hello, world}
--- no_error_log
[error]

0 comments on commit 4c4573f

Please sign in to comment.