From 875a7d633152286e797c539978cedfd921020c5e Mon Sep 17 00:00:00 2001 From: Eloy Coto Date: Thu, 25 Apr 2019 19:21:04 +0200 Subject: [PATCH] Test: Added APICAST_SERVICE_FILTER_BY_URL integration test. This test validates that the parameter `APICAST_SERVICE_FILTER_BY_URL` is working correctly across multiple services and the service discarding is working correctly. Signed-off-by: Eloy Coto --- t/apicast-subset-of-services.t | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/t/apicast-subset-of-services.t b/t/apicast-subset-of-services.t index c29740218..face5e8f1 100644 --- a/t/apicast-subset-of-services.t +++ b/t/apicast-subset-of-services.t @@ -54,3 +54,56 @@ __DATA__ ["yay, api backend: /one/\n", ""] --- error_code eval [200, 404] + + + +=== TEST 2: multi service configuration limited with Regexp Filter +--- env eval +("APICAST_SERVICES_FILTER_BY_URL", "^on*") +--- configuration +{ + "services": [ + { + "backend_version": 1, + "proxy": { + "hosts": [ + "one" + ], + "api_backend": "http://test:$TEST_NGINX_SERVER_PORT/api-backend/one/", + "proxy_rules": [ + { + "http_method": "GET", + "delta": 1, + "metric_system_name": "one", + "pattern": "/" + } + ] + }, + "id": 42 + }, + { + "proxy": { + "hosts": [ + "two" + ] + }, + "id": 11 + } + ] +} +--- backend + location /transactions/authrep.xml { + content_by_lua_block { ngx.exit(200) } + } +--- upstream + location ~ /api-backend(/.+) { + echo 'yay, api backend: $1'; + } +--- pipelined_requests eval +["GET /?user_key=1","GET /?user_key=2"] +--- more_headers eval +["Host: one", "Host: two"] +--- response_body eval +["yay, api backend: /one/\n", ""] +--- error_code eval +[200, 404]