@@ -4,24 +4,28 @@ Elasticsearch documentation build process.
4
4
See: https://github.com/elastic/docs
5
5
6
6
Snippets marked with `// CONSOLE` are automatically annotated with "VIEW IN
7
- CONSOLE" in the documentation and are automatically tested by the command
8
- `gradle :docs:check` . To test just the docs from a single page, use e.g.
9
- `gradle :docs:check -Dtests.method=*rollover*` .
7
+ CONSOLE" and "COPY AS CURL" in the documentation and are automatically tested
8
+ by the command `gradle :docs:check` . To test just the docs from a single page,
9
+ use e.g. `gradle :docs:check -Dtests.method=*rollover*` .
10
10
11
- By default `// CONSOLE` snippet runs as its own isolated
12
- test. You can manipulate the test execution in the following ways:
11
+ By default each `// CONSOLE` snippet runs as its own isolated test. You can
12
+ manipulate the test execution in the following ways:
13
13
14
14
* `// TEST` : Explicitly marks a snippet as a test. Snippets marked this way
15
- are tests even if they don't have `// CONSOLE` .
16
- * `// TEST[s/foo/bar/]` : Replace `foo` with `bar` in the test. This should be
17
- used sparingly because it makes the test "lie". Sometimes, though, you can use
18
- it to make the tests more clear.
15
+ are tests even if they don't have `// CONSOLE` but usually `// TEST` is used
16
+ for its modifiers:
17
+ * `// TEST[s/foo/bar/]` : Replace `foo` with `bar` in the generated test. This
18
+ should be used sparingly because it makes the snippet "lie". Sometimes,
19
+ though, you can use it to make the snippet more clear more clear. Keep in
20
+ mind the that if there are multiple substitutions then they are applied in
21
+ the order that they are defined.
19
22
* `// TEST[catch:foo]` : Used to expect errors in the requests. Replace `foo`
20
23
with `request` to expect a 400 error, for example. If the snippet contains
21
24
multiple requests then only the last request will expect the error.
22
25
* `// TEST[continued]` : Continue the test started in the last snippet. Between
23
- tests the nodes are cleaned: indexes are removed, etc. This will prevent that.
24
- This is really useful when you have text and snippets that work together to
26
+ tests the nodes are cleaned: indexes are removed, etc. This prevents that
27
+ from happening between snippets because the two snippets are a single test.
28
+ This is most useful when you have text and snippets that work together to
25
29
tell the story of some use case because it merges the snippets (and thus the
26
30
use case) into one big test.
27
31
* `// TEST[skip:reason]` : Skip this test. Replace `reason` with the actual
@@ -38,8 +42,11 @@ are tests even if they don't have `// CONSOLE`.
38
42
* `// TESTRESPONSE` : Matches this snippet against the body of the response of
39
43
the last test. If the response is JSON then order is ignored. If you add
40
44
`// TEST[continued]` to the snippet after `// TESTRESPONSE` it will continue
41
- in the same test, allowing you to interleve requests with responses to check.
42
- * `// TESTRESPONSE[s/foo/bar/]` : Substitutions. See `// TEST[s/foo/bar]` .
45
+ in the same test, allowing you to interleave requests with responses to check.
46
+ * `// TESTRESPONSE[s/foo/bar/]` : Substitutions. See `// TEST[s/foo/bar]` for
47
+ how it works. These are much more common than `// TEST[s/foo/bar]` because
48
+ they are useful for eliding portions of the response that are not pertinent
49
+ to the documentation.
43
50
* `// TESTRESPONSE[_cat]` : Add substitutions for testing `_cat` responses. Use
44
51
this after all other substitutions so it doesn't make other substitutions
45
52
difficult.
0 commit comments