Skip to content

Commit

Permalink
[t] rewrite config loading test using blackbox
Browse files Browse the repository at this point in the history
  • Loading branch information
mikz committed Nov 29, 2017
1 parent 5cd37b7 commit ff8cddf
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions t/configuration-loading-boot-with-config.t
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
use lib 't';
use TestAPIcast 'no_plan';
use TestAPIcastBlackbox 'no_plan';

$ENV{TEST_NGINX_HTTP_CONFIG} = "$TestAPIcast::path/http.d/init.conf";
$ENV{APICAST_CONFIGURATION_LOADER} = 'boot';
$ENV{THREESCALE_CONFIG_FILE} = 't/servroot/html/config.json';

env_to_nginx(
'APICAST_CONFIGURATION_LOADER',
'TEST_NGINX_APICAST_PATH',
'THREESCALE_CONFIG_FILE'
);

log_level('warn');
Expand All @@ -18,27 +14,19 @@ __DATA__
=== TEST 1: require configuration file to exist
should exit when the config file is missing
--- http_config
include $TEST_NGINX_HTTP_CONFIG;
lua_package_path "$TEST_NGINX_LUA_PATH";
--- config
--- must_die
--- request
GET
--- configuration_file
t/servroot/html/config.json
--- error_log
config.json: No such file or directory
--- user_files
>>> wrong.json
=== TEST 2: require valid json file
should exit when the file has invalid json
--- http_config
include $TEST_NGINX_HTTP_CONFIG;
lua_package_path "$TEST_NGINX_LUA_PATH";
--- config
--- must_die
--- request
GET
--- configuration_file
t/servroot/html/config.json
--- error_log
Expected value but found invalid token at character 1
--- user_files
Expand All @@ -47,12 +35,11 @@ not valid json
=== TEST 3: empty json file
should continue as empty json is enough
--- http_config
include $TEST_NGINX_HTTP_CONFIG;
lua_package_path "$TEST_NGINX_LUA_PATH";
--- config
--- configuration_file
t/servroot/html/config.json
--- request
GET
--- error_code: 404
--- user_files
>>> config.json
{}
Expand Down

0 comments on commit ff8cddf

Please sign in to comment.