@@ -1310,3 +1310,89 @@ Authentication parameters missing
13101310
13111311
13121312
1313+ === TEST 36 : works with BACKEND_ENDPOINT_OVERRIDE
1314+ -- - env eval
1315+ (
1316+ ' BACKEND_ENDPOINT_OVERRIDE' => " http://test_backend:$ ENV{ TEST_NGINX_SERVER_PORT} "
1317+ )
1318+ -- - configuration
1319+ {
1320+ " services" : [
1321+ {
1322+ " backend_version" : 1 ,
1323+ " proxy" : {
1324+ " api_backend" : " http://test:$ TEST_NGINX_SERVER_PORT /api-backend/" ,
1325+ " proxy_rules" : [
1326+ { " pattern" : " /" , " http_method" : " GET" , " metric_system_name" : " hits" , " delta" : 1 }
1327+ ],
1328+ " policy_chain" : [
1329+ { " name" : " apicast.policy.apicast" }
1330+ ]
1331+ }
1332+ }
1333+ ]
1334+ }
1335+ -- - upstream
1336+ location / api-backend/ {
1337+ echo " yay, api backend!" ;
1338+ }
1339+ -- - backend
1340+ location / transactions/ authrep. xml {
1341+ content_by_lua_block {
1342+ content_by_lua_block { ngx. exit(200 ) }
1343+ }
1344+ }
1345+ -- - request
1346+ GET /? user_key= value
1347+ -- - error_code: 200
1348+ -- - response_body
1349+ yay, api backend!
1350+ -- - no_error_log
1351+ [error]
1352+
1353+
1354+
1355+ === TEST 37 : with invalid BACKEND_ENDPOINT_OVERRIDE
1356+ Print the stacktrace, and terminate the request with 500 response code
1357+ -- - env eval
1358+ (
1359+ ' BACKEND_ENDPOINT_OVERRIDE' => ' invalid.backend.com'
1360+ )
1361+ -- - configuration
1362+ {
1363+ " services" : [
1364+ {
1365+ " backend_version" : 1 ,
1366+ " proxy" : {
1367+ " api_backend" : " http://test:$ TEST_NGINX_SERVER_PORT /api-backend/" ,
1368+ " proxy_rules" : [
1369+ { " pattern" : " /" , " http_method" : " GET" , " metric_system_name" : " hits" , " delta" : 1 }
1370+ ],
1371+ " policy_chain" : [
1372+ { " name" : " apicast.policy.apicast" }
1373+ ]
1374+ }
1375+ }
1376+ ]
1377+ }
1378+ -- - upstream
1379+ location / api-backend/ {
1380+ echo " yay, api backend!" ;
1381+ }
1382+ -- - backend
1383+ location / transactions/ authrep. xml {
1384+ content_by_lua_block {
1385+ error(' APIcast called authrep, but it should not have' )
1386+ }
1387+ }
1388+ -- - request
1389+ GET /? user_key= value
1390+ -- - error_code: 500
1391+ -- - error_log eval
1392+ [
1393+ ' lua entry thread aborted: runtime error:' ,
1394+ ' missing scheme' ,
1395+ ' stack traceback:' ,
1396+ " in function 'error'" ,
1397+ " : in function 'access'" ,
1398+ ]
0 commit comments