mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
The last response body gets now always stashed in the REST tests and can be retrieved via `$body`. This implies that not only expected values can be retrieved from the stashed values, but actual values as well. Added support for regular expressions to `match` assertion, using `Pattern.COMMENTS` flag for better readability through new custom hamcrest matcher (adopted in do section as well). Functionality added through new feature called `regex` that needs to be mentioned in the skip sections whenever needed till all the runners support it. Added also example tests for cat count api
78 lines
1.2 KiB
YAML
78 lines
1.2 KiB
YAML
---
|
|
setup:
|
|
- skip:
|
|
features: regex
|
|
|
|
---
|
|
"Test cat count help":
|
|
- do:
|
|
cat.count:
|
|
help: true
|
|
|
|
- match:
|
|
$body: >
|
|
/^ epoch .+ \n
|
|
timestamp .+ \n
|
|
count .+ \n $/
|
|
|
|
---
|
|
"Test cat count output":
|
|
|
|
- do:
|
|
cat.count: {}
|
|
|
|
- match:
|
|
$body: >
|
|
/^ \d+ \s \d{2}:\d{2}:\d{2} \s 0 \s $/
|
|
|
|
- do:
|
|
index:
|
|
index: index1
|
|
type: type1
|
|
id: 1
|
|
body: { foo: bar }
|
|
refresh: true
|
|
|
|
- do:
|
|
cat.count: {}
|
|
|
|
- match:
|
|
$body: >
|
|
/^ \d+ \s \d{2}:\d{2}:\d{2} \s 1 \s $/
|
|
|
|
- do:
|
|
index:
|
|
index: index2
|
|
type: type2
|
|
id: 1
|
|
body: { foo: bar }
|
|
refresh: true
|
|
|
|
- do:
|
|
cat.count:
|
|
h: count
|
|
|
|
- match:
|
|
$body: >
|
|
/^ 2 \s $/
|
|
|
|
|
|
- do:
|
|
cat.count:
|
|
index: index1
|
|
|
|
- match:
|
|
$body: >
|
|
/^ \d+ \s \d{2}:\d{2}:\d{2} \s 1 \s $/
|
|
|
|
- do:
|
|
cat.count:
|
|
index: index2
|
|
v: true
|
|
|
|
- match:
|
|
$body: >
|
|
/^ epoch \s+ timestamp \s+ count \s+ \n
|
|
\d+ \s+ \d{2}:\d{2}:\d{2} \s+ \d+ \s+ \n $/
|
|
|