Skip to content

Commit

Permalink
Add clarification around TESTSETUP docs and error message (elastic#43306
Browse files Browse the repository at this point in the history
)
  • Loading branch information
keen99 authored and javanna committed Jul 15, 2019
1 parent 23943ae commit cf488d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public class RestTestsFromSnippetsTask extends SnippetsTask {

private void testSetup(Snippet snippet) {
if (lastDocsPath == snippet.path) {
throw new InvalidUserDataException("$snippet: wasn't first")
throw new InvalidUserDataException("$snippet: wasn't first. TESTSETUP can only be used in the first snippet of a document.")
}
setupCurrent(snippet)
current.println('---')
Expand Down
3 changes: 2 additions & 1 deletion docs/README.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ for its modifiers:
but rather than the setup defined in `docs/build.gradle` the setup is defined
right in the documentation file. In general, we should prefer `// TESTSETUP`
over `// TEST[setup:name]` because it makes it more clear what steps have to
be taken before the examples will work.
be taken before the examples will work. Tip: `// TESTSETUP` can only be used
on the first snippet of a document.
* `// NOTCONSOLE`: Marks this snippet as neither `// CONSOLE` nor
`// TESTRESPONSE`, excluding it from the list of unconverted snippets. We
should only use this for snippets that *are* JSON but are *not* responses or
Expand Down

0 comments on commit cf488d0

Please sign in to comment.