Skip to content
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

Fix watcher search template test after #65332 #65382

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import static org.elasticsearch.xpack.core.watcher.support.WatcherDateTimeUtils.formatDate;
import static org.elasticsearch.xpack.core.watcher.support.WatcherUtils.flattenModel;
import static org.elasticsearch.xpack.watcher.input.search.ExecutableSearchInput.DEFAULT_SEARCH_TYPE;
import static org.elasticsearch.xpack.watcher.support.search.WatcherSearchTemplateRequest.DEFAULT_INDICES_OPTIONS;
import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.getRandomSupportedSearchType;
import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
import static org.hamcrest.Matchers.equalTo;
Expand Down Expand Up @@ -92,7 +93,9 @@ public void testSerializeSearchRequest() throws Exception {
String[] expectedIndices = generateRandomStringArray(5, 5, true);
String[] expectedTypes = generateRandomStringArray(2, 5, true, false);
IndicesOptions expectedIndicesOptions = IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(),
randomBoolean(), WatcherSearchTemplateRequest.DEFAULT_INDICES_OPTIONS);
randomBoolean(), randomBoolean(), DEFAULT_INDICES_OPTIONS.allowAliasesToMultipleIndices(),
DEFAULT_INDICES_OPTIONS.forbidClosedIndices(), DEFAULT_INDICES_OPTIONS.ignoreAliases(),
DEFAULT_INDICES_OPTIONS.ignoreThrottled());
SearchType expectedSearchType = getRandomSupportedSearchType();

BytesReference expectedSource = null;
Expand Down Expand Up @@ -150,7 +153,6 @@ public void testSerializeSearchRequest() throws Exception {
}
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/65397")
public void testDeserializeSearchRequest() throws Exception {

XContentBuilder builder = jsonBuilder().startObject();
Expand All @@ -175,18 +177,14 @@ public void testDeserializeSearchRequest() throws Exception {
}
}

IndicesOptions indicesOptions = WatcherSearchTemplateRequest.DEFAULT_INDICES_OPTIONS;
IndicesOptions indicesOptions = DEFAULT_INDICES_OPTIONS;
if (randomBoolean()) {
indicesOptions = IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(),
randomBoolean(), WatcherSearchTemplateRequest.DEFAULT_INDICES_OPTIONS);
builder.startObject("indices_options")
.field("allow_no_indices", indicesOptions.allowNoIndices())
.field("expand_wildcards", indicesOptions.expandWildcardsClosed() && indicesOptions.expandWildcardsOpen() ? "all" :
indicesOptions.expandWildcardsClosed() ? "closed" :
indicesOptions.expandWildcardsOpen() ? "open" :
"none")
.field("ignore_unavailable", indicesOptions.ignoreUnavailable())
.endObject();
randomBoolean(), randomBoolean(), indicesOptions.allowAliasesToMultipleIndices(),
indicesOptions.forbidClosedIndices(), indicesOptions.ignoreAliases(), indicesOptions.ignoreThrottled());
builder.startObject("indices_options");
indicesOptions.toXContent(builder, ToXContent.EMPTY_PARAMS);
builder.endObject();
}

SearchType searchType = SearchType.DEFAULT;
Expand Down Expand Up @@ -248,5 +246,4 @@ public void testDeserializeSearchRequest() throws Exception {
assertWarnings(WatcherSearchTemplateRequest.TYPES_DEPRECATION_MESSAGE);
}
}

}