Zachary Tong f4c5cde8af [TEST] Replace folded blocks with literal blocks
The regex tests are formatted with blocks for readability.  Previously,
they were formatted using folded style blocks (e.g. using `>`). Folded
blocks convert newlines into spaces.  This is problematic for our regex,
since comments can only be terminated with a newline.

Effectively, anything after a comment will be commented out, making many
of the regex "silently pass".

This commit replaces them with scalar-style blocks (e.g. using `|`), which
treats newlines as significant, and thus correctly terminates comments
inside the regex.

Also fixes a regex test (`cat.thread_pool/10_basic.yaml`) that started
to fail after the block was fixed.  The test was missing a `\s+` before
the closing newline.
2014-05-02 18:30:48 -04:00

195 lines
4.5 KiB
YAML
Executable File

---
"Help":
- do:
cat.allocation:
help: true
- match:
$body: |
/^ shards .+ \n
disk.used .+ \n
disk.avail .+ \n
disk.total .+ \n
disk.percent .+ \n
host .+ \n
ip .+ \n
node .+ \n
$/
---
"Empty cluster":
- do:
cat.allocation: {}
- match:
$body: |
/^
( 0 \s+
\d+(\.\d+)?[kmgt]?b \s+
(\d+(\.\d+)?[kmgt]b)? \s+ #no value from client nodes
(\d+(\.\d+)?[kmgt]b)? \s+ #no value from client nodes
(\d+)? \s+ #no value from client nodes
[-\w.]+ \s+
\d+(\.\d+){3} \s+
\w.*
\n
)+
$/
---
"One index":
- do:
indices.create:
index: test
- do:
cluster.health:
wait_for_status: green
timeout: 1s
- do:
cat.allocation: {}
- match:
$body: |
/^
( \d+ \s+
\d+(\.\d+)?[kmgt]?b \s+
(\d+(\.\d+)?[kmgt]b)? \s+ #no value from client nodes
(\d+(\.\d+)?[kmgt]b)? \s+ #no value from client nodes
(\d+)? \s+ #no value from client nodes
[-\w.]+ \s+
\d+(\.\d+){3} \s+
\w.*
\n
)+
(
\d+ \s+
UNASSIGNED \s+
\n
)?
$/
---
"Node ID":
- do:
cat.allocation:
node_id: _master
- match:
$body: |
/^
( 0 \s+
\d+(\.\d+)?[kmgt]?b \s+
(\d+(\.\d+)?[kmgt]b)? \s+ #no value from client nodes
(\d+(\.\d+)?[kmgt]b)? \s+ #no value from client nodes
(\d+)? \s+ #no value from client nodes
[-\w.]+ \s+
\d+(\.\d+){3} \s+
\w.*
\n
)
$/
- do:
cat.allocation:
node_id: non_existent
- match:
$body: |
/^
$/
---
"Column headers":
- do:
cat.allocation:
v: true
- match:
$body: |
/^ shards \s+
disk.used \s+
disk.avail \s+
disk.total \s+
disk.percent \s+
host \s+
ip \s+
node \s+
\n
( \s+0 \s+
\d+(\.\d+)?[kmgt]?b \s+
(\d+(\.\d+)?[kmgt]b)? \s+ #no value from client nodes
(\d+(\.\d+)?[kmgt]b)? \s+ #no value from client nodes
(\d+)? \s+ #no value from client nodes
[-\w.]+ \s+
\d+(\.\d+){3} \s+
\w.*
\n
)+
$/
---
"Select columns":
- do:
cat.allocation:
h: [disk.percent, node]
- match:
$body: |
/^
( \d* \s+
\w.*
\n
)+
$/
- do:
cat.allocation:
h: [disk.percent, node]
v: true
- match:
$body: |
/^
disk.percent \s+
node \s+
\n
(
\s+\d* \s+
\w.*
\n
)+
$/
---
"Bytes":
- do:
cat.allocation:
bytes: g
- match:
$body: |
/^
( 0 \s+
\d+ \s+
\d* \s+ #no value from client nodes
\d* \s+ #no value from client nodes
\d* \s+ #no value from client nodes
[-\w.]+ \s+
\d+(\.\d+){3} \s+
\w.*
\n
)+
$/