diff --git a/t/balancer.t b/t/balancer.t index 803632ef7..27a394dc0 100644 --- a/t/balancer.t +++ b/t/balancer.t @@ -1,27 +1,38 @@ use lib 't'; -use Test::APIcast 'no_plan'; +use Test::APIcast::Blackbox 'no_plan'; -$ENV{TEST_NGINX_HTTP_CONFIG} = "$Test::APIcast::path/http.d/*.conf"; -$ENV{RESOLVER} = '127.0.1.1:5353'; - -env_to_nginx( - 'RESOLVER' -); -master_on(); run_tests(); __DATA__ === TEST 1: round robin does not leak memory Balancing different hosts does not leak memory. ---- http_config - lua_package_path "$TEST_NGINX_LUA_PATH"; - init_by_lua_block { - require('resty.balancer.round_robin').cache_size = 1 +--- configuration +{ + "services": [ + { + "id": 42, + "backend_version": 1, + "backend_authentication_type": "service_token", + "backend_authentication_value": "token-value", + "proxy": { + "api_backend": "http://test:$TEST_NGINX_SERVER_PORT/", + "proxy_rules": [ { "pattern" : "/", "http_method" : "GET", + "metric_system_name" : "hits", "delta" : 2 } ] + } + } + ] +} +--- backend + location /transactions/authrep.xml { + content_by_lua_block { + ngx.exit(200) + } } ---- config +--- upstream location = /t { content_by_lua_block { + require('resty.balancer.round_robin').cache_size = 1 local round_robin = require('resty.balancer.round_robin') local balancer = round_robin.new() @@ -32,6 +43,6 @@ Balancing different hosts does not leak memory. } } --- pipelined_requests eval -[ "GET /t", "GET /t" ] +[ "GET /t?user_key=value", "GET /t?user_key=value" ] --- response_body eval [ "1", "1" ]