blob: 47ba9fd1e11c8ad273eaad630d889fb1280a710c [file]
meta:
version: "1.0"
txn_box:
global: # place holder for now, add real testing later.
- when: ua-req
do:
- ua-req-field<Best-Band>: "Delain"
# Remap based on API version. Change paths like "app.ex/api/v1/method" to "v1.app.ex/method".
remap:
- with: ua-req-path
select:
- prefix: "api/"
do:
- with: "{*}"
select:
- rxp: "([^/]+)/(.*)$"
do:
- ua-req-host: "{1}.{ua-req-host}"
- ua-req-path: "{2}"
blocks:
- base-req: &base-req
version: "1.1"
method: "GET"
- base-rsp: &base-rsp
status: 200
reason: "OK"
headers:
fields:
- [ Content-Type, html/plaintext ]
- [ Content-Length, 96 ]
sessions:
- protocol:
stack: http
transactions:
#
- all: { headers: { fields: [[ uuid, 1 ]]}}
client-request:
<<: *base-req
url: "/api/v1/method"
headers:
fields:
- [ Host, app.ex ]
proxy-request:
url:
- [ path, { value: "/method", as: equal } ]
headers:
field:
- [ host, { value: "v1.app.ex", as: prefix } ]
<<: *base-req
server-response:
<<: *base-rsp
proxy-response:
<<: *base-rsp
- all: { headers: { fields: [[ uuid, 2 ]]}}
client-request:
<<: *base-req
url: "/api/v2/method/arg1/arg2"
headers:
fields:
- [ Host, app.ex ]
proxy-request:
url:
- [ path, { value: "/method/arg1/arg2", as: equal } ]
headers:
field:
- [ host, { value: "v2.app.ex", as: prefix } ]
<<: *base-req
server-response:
<<: *base-rsp
proxy-response:
<<: *base-rsp
- all: { headers: { fields: [[ uuid, 3 ]]}}
client-request:
<<: *base-req
url: "/api/v2/method?parm1=arg1;parm2=arg2"
headers:
fields:
- [ Host, app.ex ]
proxy-request:
url:
- [ path, { value: "/method", as: equal } ]
- [ query, { value: "parm1=arg1;parm2=arg2", as: equal } ]
headers:
field:
- [ host, { value: "v2.app.ex", as: prefix } ]
<<: *base-req
server-response:
<<: *base-rsp
proxy-response:
<<: *base-rsp
urtest:
description: Verify txn_box regular expressions
requires: {plugins: [txn_box.so]}
server: {name: txn-box-rxp-origin}
dns: {name: txn-box-rxp-dns, process_config: {default: 127.0.0.1}}
client: {name: txn-box-rxp-client}
ats:
name: txn-box-rxp-ts
records_config:
proxy.config.diags.debug.enabled: 1
proxy.config.diags.debug.tags: txn_box
copy_to_config_dir: [rxp.test.yaml]
plugin_config:
- txn_box.so
- txn_box.so --key meta.txn_box.global {CONFIG_DIR}/rxp.test.yaml
remap_config:
- map http://app.ex http://app.ex:{SERVER_HTTP_PORT} @plugin=txn_box.so @pparam=--key=meta.txn_box.remap @pparam={CONFIG_DIR}/rxp.test.yaml
- map http://one.ex/path/ http://two.ex:{SERVER_HTTP_PORT}/path/
- map http://one.ex http://one.ex:{SERVER_HTTP_PORT}