From 3bd0f6cb6349d6d21cad5a169a799a6c8b6ac955 Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Fri, 7 Feb 2014 17:36:01 +0100 Subject: [PATCH] [TEST] Added cat.allocation and cat.aliases tests --- rest-api-spec/test/cat.aliases/10_basic.yaml | 195 ++++++++++++++++++ .../test/cat.allocation/10_basic.yaml | 187 +++++++++++++++++ 2 files changed, 382 insertions(+) create mode 100644 rest-api-spec/test/cat.aliases/10_basic.yaml create mode 100644 rest-api-spec/test/cat.allocation/10_basic.yaml diff --git a/rest-api-spec/test/cat.aliases/10_basic.yaml b/rest-api-spec/test/cat.aliases/10_basic.yaml new file mode 100644 index 00000000000..60ea3c57833 --- /dev/null +++ b/rest-api-spec/test/cat.aliases/10_basic.yaml @@ -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 + $/ + + + + + + diff --git a/rest-api-spec/test/cat.allocation/10_basic.yaml b/rest-api-spec/test/cat.allocation/10_basic.yaml new file mode 100644 index 00000000000..98446949dca --- /dev/null +++ b/rest-api-spec/test/cat.allocation/10_basic.yaml @@ -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 + )+ + $/ +