Skip to content

Test docs for plugins #18337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,29 @@ apply plugin: 'elasticsearch.docs-test'
integTest {
cluster {
setting 'script.inline', 'true'
setting 'script.stored', 'true'
Closure configFile = {
extraConfigFile it, "src/test/cluster/config/$it"
}
configFile 'scripts/my_script.js'
configFile 'scripts/my_script.py'
configFile 'userdict_ja.txt'
configFile 'KeywordTokenizer.rbbi'
}
}

// Build the cluser with all plugins
project.rootProject.subprojects.findAll { it.parent.path == ':plugins' }.each { subproj ->
/* Skip repositories. We just aren't going to be able to test them so it
* doesn't make sense to waste time installing them. */
if (subproj.path.startsWith(':plugins:repository-')) {
return
}
integTest {
cluster {
// We need a non-decorated project object, so we lookup the project by path
plugin subproj.name, project(subproj.path)
}
}
}

Expand All @@ -30,8 +53,6 @@ buildRestTests.docs = fileTree(projectDir) {
exclude 'build.gradle'
// That is where the snippets go, not where they come from!
exclude 'build'
// Remove plugins because they aren't installed during this test. Yet?
exclude 'plugins'
// This file simply doesn't pass yet. We should figure out how to fix it.
exclude 'reference/modules/snapshots.asciidoc'
}
Expand Down
11 changes: 8 additions & 3 deletions docs/plugins/analysis-icu.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ PUT icu_sample
}
}

GET _cluster/health?wait_for_status=yellow

POST icu_sample/_analyze?analyzer=my_analyzer&text=Elasticsearch. Wow!
--------------------------------------------------
// CONSOLE
Expand All @@ -169,7 +171,6 @@ The above `analyze` request returns the following:

[source,js]
--------------------------------------------------
# Result
{
"tokens": [
{
Expand All @@ -182,7 +183,7 @@ The above `analyze` request returns the following:
]
}
--------------------------------------------------

// TESTRESPONSE

[[analysis-icu-normalization]]
==== ICU Normalization Token Filter
Expand Down Expand Up @@ -253,7 +254,7 @@ PUT icu_sample
"analysis": {
"analyzer": {
"folded": {
"tokenizer": "icu",
"tokenizer": "icu_tokenizer",
"filter": [
"icu_folding"
]
Expand Down Expand Up @@ -359,6 +360,8 @@ PUT /my_index
}
}

GET _cluster/health?wait_for_status=yellow

GET _search <3>
{
"query": {
Expand Down Expand Up @@ -478,6 +481,8 @@ PUT icu_sample
}
}

GET _cluster/health?wait_for_status=yellow

GET icu_sample/_analyze?analyzer=latin
{
"text": "你好" <2>
Expand Down
17 changes: 15 additions & 2 deletions docs/plugins/analysis-kuromoji.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ PUT kuromoji_sample
}
}

GET _cluster/health?wait_for_status=yellow
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do this wait as part of the general rest setup? Seems not nice to require we add waits for basically all docs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is being discussed in a more general way:
#9126

I'm not sure I want to do it with some magic in the testing framework because it makes the docs not copy-and-paste-able.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would we want a doc test to be run before the cluster is available? I don't want doc tests to be flaky b/c someone forgot to add this (and it doesn't seem it exists everywhere even now).


POST kuromoji_sample/_analyze?analyzer=my_analyzer&text=東京スカイツリー
--------------------------------------------------
// CONSOLE
Expand Down Expand Up @@ -224,6 +226,8 @@ PUT kuromoji_sample
}
}

GET _cluster/health?wait_for_status=yellow

POST kuromoji_sample/_analyze?analyzer=my_analyzer&text=飲み
--------------------------------------------------
// CONSOLE
Expand Down Expand Up @@ -282,6 +286,8 @@ PUT kuromoji_sample
}
}

GET _cluster/health?wait_for_status=yellow

POST kuromoji_sample/_analyze?analyzer=my_analyzer&text=寿司がおいしいね

--------------------------------------------------
Expand Down Expand Up @@ -354,6 +360,8 @@ PUT kuromoji_sample
}
}

GET _cluster/health?wait_for_status=yellow

POST kuromoji_sample/_analyze?analyzer=katakana_analyzer&text=寿司 <1>

POST kuromoji_sample/_analyze?analyzer=romaji_analyzer&text=寿司 <2>
Expand Down Expand Up @@ -405,6 +413,8 @@ PUT kuromoji_sample
}
}

GET _cluster/health?wait_for_status=yellow

POST kuromoji_sample/_analyze?analyzer=my_analyzer&text=コピー <1>

POST kuromoji_sample/_analyze?analyzer=my_analyzer&text=サーバー <2>
Expand Down Expand Up @@ -454,7 +464,9 @@ PUT kuromoji_sample
}
}

POST kuromoji_sample/_analyze?analyzer=my_analyzer&text=ストップは消える
GET _cluster/health?wait_for_status=yellow

POST kuromoji_sample/_analyze?analyzer=analyzer_with_ja_stop&text=ストップは消える
--------------------------------------------------
// CONSOLE

Expand Down Expand Up @@ -500,6 +512,8 @@ PUT kuromoji_sample
}
}

GET _cluster/health?wait_for_status=yellow

POST kuromoji_sample/_analyze?analyzer=my_analyzer&text=一〇〇〇

--------------------------------------------------
Expand All @@ -518,4 +532,3 @@ POST kuromoji_sample/_analyze?analyzer=my_analyzer&text=一〇〇〇
} ]
}
--------------------------------------------------

4 changes: 2 additions & 2 deletions docs/plugins/analysis-phonetic.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ PUT phonetic_sample
}
}

GET _cluster/health?wait_for_status=yellow

POST phonetic_sample/_analyze?analyzer=my_analyzer&text=Joe Bloggs <1>
--------------------------------------------------
// CONSOLE
Expand Down Expand Up @@ -116,5 +118,3 @@ supported:
be guessed. Accepts: `any`, `comomon`, `cyrillic`, `english`, `french`,
`german`, `hebrew`, `hungarian`, `polish`, `romanian`, `russian`,
`spanish`.


11 changes: 1 addition & 10 deletions docs/plugins/lang-javascript.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ you can use JavaScript as follows:

[source,js]
----
DELETE test

PUT test/doc/1
{
"num": 1.0
Expand Down Expand Up @@ -96,8 +94,6 @@ you can use JavaScript as follows:

[source,js]
----
DELETE test

PUT test/doc/1
{
"num": 1.0
Expand Down Expand Up @@ -129,7 +125,6 @@ GET test/_search
}
}
}

----
// CONSOLE

Expand All @@ -145,7 +140,7 @@ You can save your scripts to a file in the `config/scripts/` directory on
every node. The `.javascript` file suffix identifies the script as containing
JavaScript:

First, save this file as `config/scripts/my_script.javascript` on every node
First, save this file as `config/scripts/my_script.js` on every node
in the cluster:

[source,js]
Expand All @@ -157,8 +152,6 @@ then use the script as follows:

[source,js]
----
DELETE test

PUT test/doc/1
{
"num": 1.0
Expand All @@ -185,9 +178,7 @@ GET test/_search
}
}
}

----
// CONSOLE

<1> The function score query retrieves the script with filename `my_script.javascript`.

8 changes: 0 additions & 8 deletions docs/plugins/lang-python.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ you can use Python as follows:

[source,js]
----
DELETE test

PUT test/doc/1
{
"num": 1.0
Expand Down Expand Up @@ -95,8 +93,6 @@ you can use Python as follows:

[source,js]
----
DELETE test

PUT test/doc/1
{
"num": 1.0
Expand Down Expand Up @@ -156,8 +152,6 @@ then use the script as follows:

[source,js]
----
DELETE test

PUT test/doc/1
{
"num": 1.0
Expand All @@ -184,9 +178,7 @@ GET test/_search
}
}
}

----
// CONSOLE

<1> The function score query retrieves the script with filename `my_script.py`.

Loading