OpenSearch/rest-api-spec/test
Martijn van Groningen aa548f5148 Remove GET `_aliases` api in favour for GET `_alias` api
Currently there are two get aliases apis that both have the same functionality, but have a different response structure. The reason for having 2 apis is historic.

The GET _alias api was added in 0.90.x and is more efficient since it only sends the needed alias data from the cluster state between the master node and the node that received the request. In the GET _aliases api the complete cluster state is send to the node that received the request and then the right information is filtered out and send back to the client.

The GET _aliases api should be removed in favour for the alias api

Closes to #4539
2014-01-02 13:56:11 +01:00
..
bulk Corrected test names for "Bulk" test suite 2013-09-09 23:36:43 +02:00
cluster.node_info cluster.node_info 2013-07-24 17:13:03 +02:00
cluster.node_stats cluster.node_stats 2013-07-24 16:51:38 +02:00
cluster.put_settings Basic tests for get/set cluster settings 2013-07-18 16:46:41 +02:00
cluster.reroute super basic test for cluster.reroute 2013-07-18 16:36:20 +02:00
cluster.state cluster state 2013-07-24 17:08:54 +02:00
create Made single shards APIs fail if routing is configured to be required in the mapping. 2014-01-02 10:47:53 +01:00
delete Changed the `ignore_missing` client parameter to `ignore: 404` 2013-09-09 23:36:45 +02:00
delete_by_query Made APIs consistently accept a query in the request body's `query` field. 2014-01-02 10:06:01 +01:00
exists Made single shards APIs fail if routing is configured to be required in the mapping. 2014-01-02 10:47:53 +01:00
explain updated source filtering tests and spec 2013-10-08 18:18:20 +02:00
get Made single shards APIs fail if routing is configured to be required in the mapping. 2014-01-02 10:47:53 +01:00
get_source Made single shards APIs fail if routing is configured to be required in the mapping. 2014-01-02 10:47:53 +01:00
index Made single shards APIs fail if routing is configured to be required in the mapping. 2014-01-02 10:47:53 +01:00
indices.analyze [TEST] Added skip clause to analyze API with text format. 2013-12-11 22:43:18 +00:00
indices.clear_cache indices.clear_cache 2013-07-24 16:51:55 +02:00
indices.delete_alias [TEST] single alias APIs not supported before 0.90.1 2013-09-25 18:59:12 +02:00
indices.delete_mapping Delete mapping tests 2013-07-15 15:01:48 +02:00
indices.exists Tests for indices.exists 2013-07-15 15:04:56 +02:00
indices.get_field_mapping Added field mapping API tests which use wild cards 2013-12-11 15:00:33 +01:00
indices.get_mapping Allow for version >= 0.90.10 2013-12-23 12:07:05 +01:00
indices.get_template Get all templates not available before 0.90.3 2013-10-09 13:11:00 +02:00
indices.open [TEST] In the open indices test, wait for yellow after opening 2013-09-25 19:29:16 +02:00
indices.optimize Optimize tests 2013-07-24 03:57:58 +02:00
indices.put_alias [TEST] single alias APIs not supported before 0.90.1 2013-09-25 18:59:12 +02:00
indices.put_mapping Make put_mapping tests work for 0.90.2 and master 2013-07-23 20:26:58 +02:00
indices.put_settings Indices settings tests 2013-07-22 00:49:53 +02:00
indices.put_template Moved get-missing template tests into their own file 2013-09-18 15:29:21 +02:00
indices.put_warmer Warmer APIs 2013-07-24 01:28:27 +02:00
indices.segments Replaced `ignore_indices` with `ignore_unavailable`, `expand_wildcards` and `allow_no_indices`. 2014-01-02 12:19:45 +01:00
indices.snapshot_index indices.snapshot_index 2013-07-24 16:05:38 +02:00
indices.stats sanity check for stats 2013-07-24 15:59:08 +02:00
indices.status indices.status 2013-07-24 03:51:57 +02:00
indices.update_aliases Remove GET `_aliases` api in favour for GET `_alias` api 2014-01-02 13:56:11 +01:00
indices.validate_query validate query 2013-07-24 04:12:03 +02:00
info lucene_version is only in es sine 0.90.1 2013-07-11 13:51:36 +02:00
mget [TEST] Fixed bad indentation on realtime_refresh tests 2013-11-05 13:28:47 +01:00
mlt Super simple super useless mlt test 2013-07-24 01:47:28 +02:00
msearch msearch tests 2013-07-22 00:40:12 +02:00
percolate Allow for version >= 0.90.10 2013-12-23 12:07:05 +01:00
ping Renamed "ok" and "not_ok" to "is_true" and "is_false" 2013-07-01 15:58:23 +02:00
scroll Scroll test was missing an index - fails when other indices present 2013-09-16 20:56:32 +02:00
search Added brackets to a do command. 2013-10-11 12:29:44 +02:00
suggest Allow for version >= 0.90.10 2013-12-23 12:07:05 +01:00
update Made single shards APIs fail if routing is configured to be required in the mapping. 2014-01-02 10:47:53 +01:00
README.asciidoc Updated the test README to allow multiple test sections and an initial setup section 2013-09-18 15:54:58 +02:00

README.asciidoc

Test Suite:
===========

A YAML test file consists of:
* an optional `setup` section, followed by
* one or more test sections

For instance:

    setup:
      - do: ....
      - do: ....

    ---
    "First test":
      - do: ...
      - match: ...

    ---
    "Second test":
      - do: ...
      - match: ...


A `setup` section contains a list of commands to run before each test
section in order to setup the same environment for each test section.

A test section represents an independent test, containing multiple `do`
statements and assertions. The contents of a test section must be run in
order, but individual test sections may be run in any order, as follows:

1. run `setup` (if any)
2. reset the `response` var and the `stash` (see below)
2. run test contents
3. run teardown

The `teardown` should delete all indices and all templates.

Dot notation:
-------------
Dot notation is used for (1) method calls and (2) hierarchical data structures.  For
instance, a method call like `cluster.health` would do the equivalent of:

    client.cluster.health(...params...)

A test against `_tokens.1.token` would examine the `token` key, in the second element
of the `tokens` array, inside the `response` var (see below):

    $val = $response->{tokens}[1]{token}  # Perl syntax roolz!

If one of the levels (eg `tokens`) does not exist, it should return an undefined value.
If no field name is given (ie the empty string) then return the current
$val -- used for testing the whole response body.

Use \. to specify paths that actually contain '.' in the key name, for example
in the `indices.get_settings` API.

Skipping tests:
---------------
If a test section should only be run on certain versions of Elasticsearch,
then the first entry in the section (after the title) should be called
`skip`, and should contain the range of versions to be
skipped, and the reason why the tests are skipped.  For instance:

....
    "Parent":
     - skip:
          version:     "0 - 0.90.2"
          reason:      Delete ignores the parent param

     - do:
       ... test definitions ...
....

All tests in the file following the skip statement should be skipped if:
`min <= current <= max`.

The `version` range should always have an upper bound. Versions should
either have each version part compared numerically, or should be converted
to a string with sufficient digits to allow string comparison, eg

    0.90.2 -> 000-090-002

Snapshot versions and versions of the form `1.0.0.Beta1` can be treated
as the rounded down version, eg `1.0.0`.

Required operators:
-------------------

=== `do`

The `do` operator calls a method on the client. For instance:

....
    - do:
        cluster.health:
            level: shards
....

The response from the `do` operator should be stored in the `response` var, which
is reset (1) at the beginning of a file or (2) on the next `do`.

If the arguments to `do` include `catch`, then we are expecting an error, which should
be caught and tested.  For instance:

....
    - do:
        catch:        missing
        get:
            index:    test
            type:    test
            id:        1
....

The argument to `catch` can be any of:

[horizontal]
`missing`::     a 404 response from ES
`conflict`::    a 409 response from ES
`request`::     a generic error response from ES
`param`::       a client-side error indicating an unknown parameter has been passed
                to the method
`/foo bar/`::   the text of the error message matches this regular expression

If `catch` is specified, then the `response` var must be cleared, and the test
should fail if no error is thrown.

=== `set`

For some tests, it is necessary to extract a value from the previous `response`, in
order to reuse it in a subsequent `do` and other tests.  For instance, when
testing indexing a document without a specified ID:

....
    - do:
        index:
            index: test
            type:  test
    - set:  { _id: id }   # stash the value of `response._id` as `id`
    - do:
        get:
            index: test
            type:  test
            id:    $id    # replace `$id` with the stashed value
    - match: { _id: $id } # the returned `response._id` matches the stashed `id`
....

The stash should be reset at the beginning of each test file.

=== `is_true`

The specified key exists and has a true value (ie not `0`, `false`, `undefined`, `null`
or the empty string), eg:

....
    - is_true:  fields._parent  # the _parent key exists in the fields hash and is "true"
....

=== `is_false`

The specified key doesn't exist or has a false value (ie `0`, `false`, `undefined`,
`null` or the empty string), eg:

....
    - is_false:  fields._source  # the _source key doesn't exist in the fields hash or is "false"
....

=== `match`

Used to compare two variables (could be scalars, arrays or hashes).  The two variables
should be identical, eg:

....
    - match: { _source: { foo: bar }}
....

=== `lt` and `gt`

Compares two numeric values, eg:

....
    - lt: { fields._ttl: 10000 }  # the `_ttl` value is less than 10,000
....

=== `length`

This depends on the datatype of the value being examined, eg:

....
    - length: { _id: 22    }   # the `_id` string is 22 chars long
    - length: { _tokens: 3 }   # the `_tokens` array has 3 elements
    - length: { _source: 5 }   # the `_source` hash has 5 keys
....