Skip to content

Commit

Permalink
Update regex to exclude API calls on the index
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkyle committed Jun 19, 2018
1 parent 0641e18 commit b629d7e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ public class RestTestsFromSnippetsTask extends SnippetsTask {

/**
* Doc write operations start with an index name that cannot
* start with -, _ or + and must be lower case.
* start with -, _ or + and must be lower case and are followed
* by the doc type or doc Id. If the 2nd part of the path
* (after the '/') starts with a '_' then it is an API call.
*/
private static final Pattern DOCS_WRITE_OP_PATTERN = Pattern.compile("^[^_\\-\\+][a-z_-]+/");
private static final Pattern DOCS_WRITE_OP_PATTERN = Pattern.compile("^[^_\\-\\+][a-z_-]+/[^_]");

@Input
Map<String, String> setups = new HashMap()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class RestTestFromSnippetsTaskTest extends GroovyTestCase {
void testIsDocWriteRequest() {
assertTrue(isDocWriteRequest("doc-index/doc_id"));
assertTrue(isDocWriteRequest("doc_index/doc_type/doc_id"));
assertFalse(isDocWriteRequest("doc_index"))
assertFalse(isDocWriteRequest("doc_index/_search"))
assertFalse(isDocWriteRequest("_xpack/ml/datafeeds/datafeed-id/_preview"));
}
}

0 comments on commit b629d7e

Please sign in to comment.