Skip to content

Commit

Permalink
Merge remote-tracking branch 'elastic/6.x' into hard-coded-ports-are-…
Browse files Browse the repository at this point in the history
…bad-mkay

* elastic/6.x:
  [ML] Wait for ML indices in rolling upgrade tests (elastic#30615)
  Watcher: Ensure secrets integration tests also run triggered watch (elastic#30478)
  Move allocation awareness attributes to list setting (elastic#30626)
  [Docs] Update code snippet in has-child-query.asciidoc (elastic#30510)
  Allow date math for naming newly-created snapshots (elastic#7939) (elastic#30479)
  Awaits fix a failing test
  Switch many QA projects to use new style requests (elastic#30574)
  QA: System property to override distribution (elastic#30591)
  • Loading branch information
jasontedor committed May 16, 2018
2 parents a108125 + c2e0061 commit ef0dd2d
Show file tree
Hide file tree
Showing 34 changed files with 305 additions and 152 deletions.
2 changes: 1 addition & 1 deletion docs/java-api/query-dsl/has-child-query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ When using the `has_child` query it is important to use the `PreBuiltTransportCl
--------------------------------------------------
Settings settings = Settings.builder().put("cluster.name", "elasticsearch").build();
TransportClient client = new PreBuiltTransportClient(settings);
client.addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress(InetAddresses.forString("127.0.0.1"), 9300)));
client.addTransportAddress(new TransportAddress(new InetSocketAddress(InetAddresses.forString("127.0.0.1"), 9300)));
--------------------------------------------------

Otherwise the parent-join module doesn't get loaded and the `has_child` query can't be used from the transport client.
Expand Down
14 changes: 14 additions & 0 deletions docs/reference/modules/snapshots.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,20 @@ By setting `include_global_state` to false it's possible to prevent the cluster
the snapshot. By default, the entire snapshot will fail if one or more indices participating in the snapshot don't have
all primary shards available. This behaviour can be changed by setting `partial` to `true`.

Snapshot names can be automatically derived using <<date-math-index-names,date math expressions>>, similarly as when creating
new indices. Note that special characters need to be URI encoded.

For example, creating a snapshot with the current day in the name, like `snapshot-2018.05.11`, can be achieved with
the following command:
[source,js]
-----------------------------------
# PUT /_snapshot/my_backup/<snapshot-{now/d}>
PUT /_snapshot/my_backup/%3Csnapshot-%7Bnow%2Fd%7D%3E
-----------------------------------
// CONSOLE
// TEST[continued]


The index snapshot process is incremental. In the process of making the index snapshot Elasticsearch analyses
the list of the index files that are already stored in the repository and copies only files that were created or
changed since the last snapshot. That allows multiple snapshots to be preserved in the repository in a compact form.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

public class GoogleCloudStorageRepositoryDeprecationTests extends ESTestCase {

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/30638")
public void testDeprecatedSettings() throws Exception {
final Settings repositorySettings = Settings.builder()
.put("bucket", "test")
Expand Down
2 changes: 1 addition & 1 deletion qa/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.elasticsearch.gradle.test.RestIntegTestTask
subprojects { Project subproj ->
subproj.tasks.withType(RestIntegTestTask) {
subproj.extensions.configure("${it.name}Cluster") { cluster ->
cluster.distribution = 'oss-zip'
cluster.distribution = System.getProperty('tests.distribution', 'oss-zip')
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchScrollRequest;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.Response;
import org.elasticsearch.client.ResponseException;
import org.elasticsearch.client.RestClient;
Expand Down Expand Up @@ -134,7 +135,7 @@ public void testSearchSkipUnavailable() throws IOException {
for (int i = 0; i < 10; i++) {
restHighLevelClient.index(new IndexRequest("index", "doc", String.valueOf(i)).source("field", "value"));
}
Response refreshResponse = client().performRequest("POST", "/index/_refresh");
Response refreshResponse = client().performRequest(new Request("POST", "/index/_refresh"));
assertEquals(200, refreshResponse.getStatusLine().getStatusCode());

{
Expand Down Expand Up @@ -223,10 +224,11 @@ public void testSkipUnavailableDependsOnSeeds() throws IOException {

{
//check that skip_unavailable alone cannot be set
HttpEntity clusterSettingsEntity = buildUpdateSettingsRequestBody(
Collections.singletonMap("skip_unavailable", randomBoolean()));
Request request = new Request("PUT", "/_cluster/settings");
request.setEntity(buildUpdateSettingsRequestBody(
Collections.singletonMap("skip_unavailable", randomBoolean())));
ResponseException responseException = expectThrows(ResponseException.class,
() -> client().performRequest("PUT", "/_cluster/settings", Collections.emptyMap(), clusterSettingsEntity));
() -> client().performRequest(request));
assertEquals(400, responseException.getResponse().getStatusLine().getStatusCode());
assertThat(responseException.getMessage(),
containsString("Missing required setting [search.remote.remote1.seeds] " +
Expand All @@ -240,9 +242,10 @@ public void testSkipUnavailableDependsOnSeeds() throws IOException {

{
//check that seeds cannot be reset alone if skip_unavailable is set
HttpEntity clusterSettingsEntity = buildUpdateSettingsRequestBody(Collections.singletonMap("seeds", null));
Request request = new Request("PUT", "/_cluster/settings");
request.setEntity(buildUpdateSettingsRequestBody(Collections.singletonMap("seeds", null)));
ResponseException responseException = expectThrows(ResponseException.class,
() -> client().performRequest("PUT", "/_cluster/settings", Collections.emptyMap(), clusterSettingsEntity));
() -> client().performRequest(request));
assertEquals(400, responseException.getResponse().getStatusLine().getStatusCode());
assertThat(responseException.getMessage(), containsString("Missing required setting [search.remote.remote1.seeds] " +
"for setting [search.remote.remote1.skip_unavailable]"));
Expand Down Expand Up @@ -284,8 +287,9 @@ private static void assertSearchConnectFailure() {


private static void updateRemoteClusterSettings(Map<String, Object> settings) throws IOException {
HttpEntity clusterSettingsEntity = buildUpdateSettingsRequestBody(settings);
Response response = client().performRequest("PUT", "/_cluster/settings", Collections.emptyMap(), clusterSettingsEntity);
Request request = new Request("PUT", "/_cluster/settings");
request.setEntity(buildUpdateSettingsRequestBody(settings));
Response response = client().performRequest(request);
assertEquals(200, response.getStatusLine().getStatusCode());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.apache.http.ConnectionClosedException;
import org.apache.lucene.util.Constants;
import org.elasticsearch.client.Request;
import org.elasticsearch.common.io.PathUtils;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.hamcrest.Matcher;
Expand Down Expand Up @@ -51,7 +52,8 @@ public void testDieWithDignity() throws Exception {
assertThat(pidFileLines, hasSize(1));
final int pid = Integer.parseInt(pidFileLines.get(0));
Files.delete(pidFile);
IOException e = expectThrows(IOException.class, () -> client().performRequest("GET", "/_die_with_dignity"));
IOException e = expectThrows(IOException.class,
() -> client().performRequest(new Request("GET", "/_die_with_dignity")));
Matcher<IOException> failureMatcher = instanceOf(ConnectionClosedException.class);
if (Constants.WINDOWS) {
/*
Expand Down
9 changes: 8 additions & 1 deletion qa/mixed-cluster/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,16 @@ for (Version version : bwcVersions.wireCompatible) {
bwcTest.dependsOn(versionBwcTest)
}

/* To support taking index snapshots, we have to set path.repo setting */
tasks.getByName("${baseName}#mixedClusterTestRunner").configure {
/* To support taking index snapshots, we have to set path.repo setting */
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
if ('zip'.equals(extension.distribution)) {
systemProperty 'tests.rest.blacklist', [
'cat.templates/10_basic/No templates',
'cat.templates/10_basic/Sort templates',
'cat.templates/10_basic/Multiple template',
].join(',')
}
}
}

Expand Down
Loading

0 comments on commit ef0dd2d

Please sign in to comment.