| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| meta: {version: "1.0"} | |
| urtest: | |
| description: "Verify focused Lua remap APIs" | |
| requires: {plugins: [tslua.so]} | |
| server: {name: "origin"} | |
| client: {name: "client"} | |
| ats: | |
| name: "ts" | |
| process_config: {enable_cache: false} | |
| records_config: | |
| proxy.config.diags.debug.enabled: 1 | |
| proxy.config.diags.debug.tags: "ts_lua" | |
| variants: | |
| - name: "watermark" | |
| client: | |
| process_config: {keys: "lua-watermark"} | |
| ats: | |
| copy_to_config_dir: ["watermark.lua"] | |
| remap_config: | |
| - "map / http://127.0.0.1:{SERVER_HTTP_PORT}/ @plugin=tslua.so @pparam={CONFIG_DIR}/watermark.lua" | |
| file_checks: | |
| - {path: "{LOG_DIR}/traffic.out", contains: 'WMbytes\(31337\)'} | |
| - name: "client-hook" | |
| client: | |
| process_config: {keys: "lua-client-hook"} | |
| ats: | |
| copy_to_config_dir: ["client_hook.lua"] | |
| remap_config: | |
| - "map / http://127.0.0.1:{SERVER_HTTP_PORT}/ @plugin=tslua.so @pparam={CONFIG_DIR}/client_hook.lua" | |
| file_checks: | |
| - {path: "{LOG_DIR}/traffic.out", contains: "AAAA"} | |
| - name: "remap-after-hook" | |
| client: | |
| process_config: {keys: "lua-remap-after-hook"} | |
| ats: | |
| copy_to_config_dir: ["remap_after_hook.lua"] | |
| remap_config: | |
| - "map http://www.example.com/ http://127.0.0.1:{SERVER_HTTP_PORT}/ @plugin=tslua.so @pparam={CONFIG_DIR}/remap_after_hook.lua" | |
| - name: "fetch-ipv6-client-address" | |
| client: | |
| process_config: {keys: "lua-fetch-outer"} | |
| ats: | |
| copy_to_config_dir: ["fetch_ipv6_cliaddr.lua"] | |
| remap_config: | |
| - "map / http://127.0.0.1:{SERVER_HTTP_PORT}/ @plugin=tslua.so @pparam={CONFIG_DIR}/fetch_ipv6_cliaddr.lua" | |
| - name: "header-table" | |
| server: {enabled: false} | |
| client: | |
| process_config: {keys: "lua-header-table"} | |
| ats: | |
| copy_to_config_dir: ["header_table.lua"] | |
| remap_config: | |
| - "map / http://127.0.0.1 @plugin=tslua.so @pparam={CONFIG_DIR}/header_table.lua" | |
| - name: "verified-address" | |
| server: {enabled: false} | |
| client: | |
| process_config: {keys: "lua-verified-v4 lua-verified-v6 lua-verified-invalid lua-verified-both"} | |
| ats: | |
| copy_to_config_dir: ["verified_addr.lua"] | |
| remap_config: | |
| - "map / http://127.0.0.1 @plugin=tslua.so @pparam={CONFIG_DIR}/verified_addr.lua" | |
| - name: "debug-tags" | |
| server: {enabled: false} | |
| client: | |
| process_config: {keys: "lua-debug-tags"} | |
| ats: | |
| records_config: | |
| proxy.config.diags.debug.tags: "foo|ts_lua" | |
| copy_to_config_dir: ["tags.lua"] | |
| remap_config: | |
| - "map http://test/ http://127.0.0.1/ @plugin=tslua.so @pparam={CONFIG_DIR}/tags.lua" | |
| - name: "states-and-stats" | |
| server: {enabled: false} | |
| client: | |
| process_config: {keys: "lua-states-stats"} | |
| ats: | |
| environment: | |
| URTEST_TEST_DIR: "{TEST_DIR}" | |
| copy_to_config_dir: ["hello.lua", "global.lua"] | |
| plugin_config: | |
| - "tslua.so --states=4 {CONFIG_DIR}/global.lua" | |
| remap_config: | |
| - "map http://hello/ http://127.0.0.1/ @plugin=tslua.so @pparam=--states=4 @pparam={CONFIG_DIR}/hello.lua" | |
| post_client_commands: | |
| - 'bash "{TEST_DIR}/metrics.sh"' | |
| - name: "proxy-protocol" | |
| client: | |
| process_config: | |
| keys: "lua-proxy-present lua-proxy-absent" | |
| http_ports: ["{ATS_PROXY_PROTOCOL_PORT}"] | |
| ats: | |
| process_config: | |
| enable_cache: false | |
| enable_proxy_protocol: true | |
| copy_to_config_dir: ["proxy_protocol.lua"] | |
| remap_config: | |
| - "map / http://127.0.0.1:{SERVER_HTTP_PORT}/ @plugin=tslua.so @pparam={CONFIG_DIR}/proxy_protocol.lua" | |
| file_checks: | |
| - {path: "{LOG_DIR}/traffic.out", contains: "PP-Version: 1"} | |
| - {path: "{LOG_DIR}/traffic.out", contains: "PP-Source: 192\\.168\\.1\\.100"} | |
| - {path: "{LOG_DIR}/traffic.out", contains: "PP-Protocol: 2"} | |
| - {path: "{LOG_DIR}/traffic.out", contains: "PP-SocketType: 1"} | |
| - {path: "{LOG_DIR}/traffic.out", contains: "PP-Version: 0"} | |
| sessions: | |
| - transactions: | |
| - all: {headers: {fields: [[uuid, lua-watermark]]}} | |
| client-request: | |
| method: GET | |
| url: / | |
| version: "1.1" | |
| headers: {fields: [[Host, www.example.com]]} | |
| server-response: | |
| status: 200 | |
| headers: {fields: [[Content-Length, 0]]} | |
| proxy-response: {status: 200} | |
| - all: {headers: {fields: [[uuid, lua-client-hook]]}} | |
| client-request: | |
| method: GET | |
| url: / | |
| version: "1.1" | |
| headers: {fields: [[Host, www.example.com]]} | |
| server-response: | |
| status: 200 | |
| headers: {fields: [[Content-Length, 4]]} | |
| content: {data: "AAAA", size: 4} | |
| proxy-response: | |
| status: 200 | |
| content: {data: "AAAA", verify: {as: equal}} | |
| - all: {headers: {fields: [[uuid, lua-remap-after-hook]]}} | |
| client-request: | |
| method: GET | |
| url: / | |
| version: "1.1" | |
| headers: {fields: [[Host, www.example.com]]} | |
| server-response: | |
| status: 200 | |
| headers: {fields: [[Content-Length, 2]]} | |
| content: {data: "ok", size: 2} | |
| proxy-response: | |
| status: 200 | |
| headers: | |
| fields: | |
| - [Remap-From-Host, {value: www.example.com, as: equal}] | |
| - [Hook-From-Host, {value: "<nil>", as: equal}] | |
| - all: {headers: {fields: [[uuid, lua-fetch-outer]]}} | |
| client-request: | |
| method: GET | |
| url: / | |
| version: "1.1" | |
| headers: {fields: [[Host, www.example.com]]} | |
| server-response: | |
| status: 200 | |
| headers: {fields: [[Content-Length, 5]]} | |
| content: {data: "outer", size: 5} | |
| proxy-response: | |
| status: 200 | |
| headers: | |
| fields: | |
| - [Sub-Status, {value: "200", as: equal}] | |
| - [Sub-Body-Len, {value: "5", as: equal}] | |
| - all: {headers: {fields: [[uuid, lua-fetch-inner]]}} | |
| client-request: | |
| method: GET | |
| url: /inner.txt | |
| version: "1.1" | |
| headers: {fields: [[Host, www.example.com]]} | |
| server-response: | |
| status: 200 | |
| headers: {fields: [[Content-Length, 5]]} | |
| content: {data: "AAAAA", size: 5} | |
| proxy-response: {status: 200} | |
| - all: {headers: {fields: [[uuid, lua-header-table]]}} | |
| client-request: | |
| method: GET | |
| url: / | |
| version: "1.1" | |
| headers: | |
| fields: | |
| - [Host, example.com] | |
| - [X-Test, test1] | |
| - [X-Test, test2] | |
| server-response: {status: 599} | |
| proxy-response: | |
| status: 200 | |
| content: {data: "test1test2", verify: {as: equal}} | |
| - all: {headers: {fields: [[uuid, lua-verified-v4]]}} | |
| client-request: | |
| method: GET | |
| url: / | |
| version: "1.1" | |
| headers: {fields: [[Host, example.com], [X-Real-IP, 192.0.2.100], [Connection, close]]} | |
| server-response: {status: 599} | |
| proxy-response: | |
| status: 200 | |
| content: {data: "initial:nil;set:success;get:192.0.2.100:2;", verify: {as: equal}} | |
| - all: {headers: {fields: [[uuid, lua-verified-v6]]}} | |
| client-request: | |
| method: GET | |
| url: / | |
| version: "1.1" | |
| headers: {fields: [[Host, example.com], [X-Real-IP-V6, "2001:db8::1"], [Connection, close]]} | |
| server-response: {status: 599} | |
| proxy-response: | |
| status: 200 | |
| content: {data: "initial:nil;setv6:success;getv6:2001:db8::1:10;", verify: {as: equal}} | |
| - all: {headers: {fields: [[uuid, lua-verified-invalid]]}} | |
| client-request: | |
| method: GET | |
| url: / | |
| version: "1.1" | |
| headers: {fields: [[Host, example.com], [X-Invalid-IP, not.a.valid.ip], [Connection, close]]} | |
| server-response: {status: 599} | |
| proxy-response: | |
| status: 200 | |
| content: {data: "initial:nil;invalid:rejected;", verify: {as: equal}} | |
| - all: {headers: {fields: [[uuid, lua-verified-both]]}} | |
| client-request: | |
| method: GET | |
| url: / | |
| version: "1.1" | |
| headers: | |
| fields: | |
| - [Host, example.com] | |
| - [X-Real-IP, 203.0.113.42] | |
| - [X-Real-IP-V6, "2001:db8::42"] | |
| - [Connection, close] | |
| server-response: {status: 599} | |
| proxy-response: | |
| status: 200 | |
| content: | |
| data: "initial:nil;set:success;get:203.0.113.42:2;setv6:success;getv6:2001:db8::42:10;" | |
| verify: {as: equal} | |
| - all: {headers: {fields: [[uuid, lua-debug-tags]]}} | |
| client-request: | |
| method: GET | |
| url: /test.html | |
| version: "1.1" | |
| headers: {fields: [[Host, test]]} | |
| server-response: {status: 599} | |
| proxy-response: | |
| status: 200 | |
| content: {data: " default foo ts_lua", verify: {as: equal}} | |
| - all: {headers: {fields: [[uuid, lua-states-stats]]}} | |
| client-request: | |
| method: GET | |
| url: /hello | |
| version: "1.1" | |
| headers: {fields: [[Host, hello]]} | |
| server-response: {status: 599} | |
| proxy-response: | |
| status: 200 | |
| content: {data: "Hello, World", verify: {as: equal}} | |
| - protocol: | |
| stack: http | |
| proxy-protocol: | |
| version: 1 | |
| src-addr: "192.168.1.100:12345" | |
| dst-addr: "127.0.0.1:80" | |
| transactions: | |
| - all: {headers: {fields: [[uuid, lua-proxy-present]]}} | |
| client-request: | |
| method: GET | |
| url: / | |
| version: "1.1" | |
| headers: {fields: [[Host, www.example.com]]} | |
| server-response: | |
| status: 200 | |
| headers: {fields: [[Content-Length, 4]]} | |
| content: {data: "TEST", size: 4} | |
| proxy-response: | |
| status: 200 | |
| content: {data: "TEST", verify: {as: equal}} | |
| - protocol: {stack: http} | |
| transactions: | |
| - all: {headers: {fields: [[uuid, lua-proxy-absent]]}} | |
| client-request: | |
| method: GET | |
| url: / | |
| version: "1.1" | |
| headers: {fields: [[Host, www.example.com]]} | |
| server-response: | |
| status: 200 | |
| headers: {fields: [[Content-Length, 4]]} | |
| content: {data: "TEST", size: 4} | |
| proxy-response: | |
| status: 200 | |
| content: {data: "TEST", verify: {as: equal}} |