[TEST] Added cat.allocation and cat.aliases tests

This commit is contained in:
Clinton Gormley 2014-02-07 17:36:01 +01:00
parent 6e46ca29d4
commit 3bd0f6cb63
2 changed files with 382 additions and 0 deletions

View File

@ -0,0 +1,195 @@
---
setup:
- skip:
features: regex
---
"Help":
- do:
cat.aliases:
help: true
- match:
$body: >
/^ alias .+ \n
index .+ \n
filter .+ \n
routing.index .+ \n
routing.search .+ \n
$/
---
"Empty cluster":
- do:
cat.aliases: {}
- match:
$body: >
/^
$/
---
"Simple alias":
- do:
indices.create:
index: test
- do:
indices.put_alias:
index: test
name: test_alias
- do:
cat.aliases: {}
- match:
$body: >
/^
test_alias \s+
test \s+
- \s+
- \s+
- \s+
$/
---
"Complex alias":
- do:
indices.create:
index: test
- do:
indices.put_alias:
index: test
name: test_alias
body:
index_routing: ir
search_routing: "sr1,sr2"
filter:
term:
foo: bar
- do:
cat.aliases: {}
- match:
$body: >
/^
test_alias \s+
test \s+
[*] \s+
ir \s+
sr1,sr2 \s+
$/
---
"Alias name":
- do:
indices.create:
index: test
- do:
indices.put_alias:
index: test
name: test_1
- do:
indices.put_alias:
index: test
name: test_2
- do:
cat.aliases:
name: test_1
- match:
$body: /^test_1 .+ \n$/
- do:
cat.aliases:
name: test_2
- match:
$body: /^test_2 .+ \n$/
- do:
cat.aliases:
name: test_*
- match:
$body: / (^|\n)test_1 .+ \n/
- match:
$body: / (^|\n)test_2 .+ \n/
---
"Column headers":
- do:
indices.create:
index: test
- do:
indices.put_alias:
index: test
name: test_1
- do:
cat.aliases:
v: true
- match:
$body: >
/^ alias \s+
index \s+
filter \s+
routing.index \s+
routing.search \s+
\n
test_1 \s+
test \s+
- \s+
- \s+
- \s+
$/
---
"Select columns":
- do:
indices.create:
index: test
- do:
indices.put_alias:
index: test
name: test_1
- do:
cat.aliases:
h: [index, alias]
- match:
$body: /^ test \s+ test_1 \s+ $/
- do:
cat.aliases:
h: [index, alias]
v: true
- match:
$body: >
/^
index \s+ alias \s+ \n
test \s+ test_1 \s+ \n
$/

View File

@ -0,0 +1,187 @@
---
setup:
- skip:
features: regex
---
"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+)?+gb \s+
\d+(\.\d+)?+gb \s+
\d+(\.\d+)?+gb \s+
\d+ \s+
[-\w.]+ \s+
\d+(\.\d+){3} \s+
\w[-\w ]* \n
)+
$/
---
"One index":
- do:
indices.create:
index: test
- do:
cluster.health:
wait_for_status: green
timeout: 1s
- do:
cat.allocation: {}
- match:
$body: >
/^
( [1-5] \s+
\d+(\.\d+)?+gb \s+
\d+(\.\d+)?+gb \s+
\d+(\.\d+)?+gb \s+
\d+ \s+
[-\w.]+ \s+
\d+(\.\d+){3} \s+
\w[-\w ]* \n
)+
$/
---
"Node ID":
- do:
cat.allocation:
node_id: _master
- match:
$body: >
/^
( 0 \s+
\d+(\.\d+)?+gb \s+
\d+(\.\d+)?+gb \s+
\d+(\.\d+)?+gb \s+
\d+ \s+
[-\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+)?+gb \s+
\d+(\.\d+)?+gb \s+
\d+(\.\d+)?+gb \s+
\d+ \s+
[-\w.]+ \s+
\d+(\.\d+){3} \s+
[-\w ]+ \n
)*
$/
---
"Select columns":
- do:
cat.allocation:
h: [disk.percent, node]
- match:
$body: >
/^
( \d+ \s+
\w[-\w ]* \n
)+
$/
- do:
cat.allocation:
h: [disk.percent, node]
v: true
- match:
$body: >
/^
disk.percent \s+
node \s+
\n
(
\s+\d+ \s+
\w[-\w ]* \n
)+
$/
---
"Bytes":
- do:
cat.allocation:
bytes: g
- match:
$body: >
/^
( 0 \s+
\d+ \s+
\d+ \s+
\d+ \s+
\d+ \s+
[-\w.]+ \s+
\d+(\.\d+){3} \s+
\w[-\w ]* \n
)+
$/