Browse Source

remove old doc placeholder and migrate ilm docs to top-level (#34615)

we are restructuring the docs, this migrates ILM docs outside of the x-pack doc structure.
Tal Levy 7 years ago
parent
commit
e737ea7d4a
29 changed files with 73 additions and 90 deletions
  1. 0 0
      docs/reference/ilm/apis/delete-lifecycle.asciidoc
  2. 0 0
      docs/reference/ilm/apis/explain.asciidoc
  3. 0 0
      docs/reference/ilm/apis/get-lifecycle.asciidoc
  4. 1 2
      docs/reference/ilm/apis/get-status.asciidoc
  5. 0 0
      docs/reference/ilm/apis/ilm-api.asciidoc
  6. 0 0
      docs/reference/ilm/apis/move-to-step.asciidoc
  7. 0 0
      docs/reference/ilm/apis/put-lifecycle.asciidoc
  8. 0 0
      docs/reference/ilm/apis/remove-policy.asciidoc
  9. 0 0
      docs/reference/ilm/apis/retry-policy.asciidoc
  10. 0 0
      docs/reference/ilm/apis/start.asciidoc
  11. 0 0
      docs/reference/ilm/apis/stop.asciidoc
  12. 1 0
      docs/reference/ilm/get-index-lifecycle-information.asciidoc
  13. 1 0
      docs/reference/ilm/getting-started-ilm.asciidoc
  14. 3 1
      docs/reference/ilm/index.asciidoc
  15. 2 0
      docs/reference/ilm/set-up-lifecycle-policy.asciidoc
  16. 2 0
      docs/reference/ilm/start-stop-ilm.asciidoc
  17. 2 0
      docs/reference/ilm/update-lifecycle-policy.asciidoc
  18. 2 0
      docs/reference/ilm/using-policies-rollover.asciidoc
  19. 1 1
      docs/reference/index.asciidoc
  20. 38 1
      test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java
  21. 5 0
      test/framework/src/main/java/org/elasticsearch/upgrades/AbstractFullClusterRestartTestCase.java
  22. 0 0
      x-pack/docs/en/rest-api/index-lifecycle/delete-policy.asciidoc
  23. 0 0
      x-pack/docs/en/rest-api/index-lifecycle/get-policy.asciidoc
  24. 0 0
      x-pack/docs/en/rest-api/index-lifecycle/put-policy.asciidoc
  25. 0 63
      x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/ILMRestTestStateCleaner.java
  26. 0 22
      x-pack/plugin/src/test/java/org/elasticsearch/xpack/test/rest/XPackRestIT.java
  27. 5 0
      x-pack/qa/rolling-upgrade-basic/src/test/java/org/elasticsearch/upgrades/AbstractUpgradeTestCase.java
  28. 5 0
      x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/AbstractUpgradeTestCase.java
  29. 5 0
      x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/UpgradeClusterClientYamlTestSuiteIT.java

+ 0 - 0
x-pack/docs/en/ilm/apis/delete-lifecycle.asciidoc → docs/reference/ilm/apis/delete-lifecycle.asciidoc


+ 0 - 0
x-pack/docs/en/ilm/apis/explain.asciidoc → docs/reference/ilm/apis/explain.asciidoc


+ 0 - 0
x-pack/docs/en/ilm/apis/get-lifecycle.asciidoc → docs/reference/ilm/apis/get-lifecycle.asciidoc


+ 1 - 2
x-pack/docs/en/ilm/apis/get-status.asciidoc → docs/reference/ilm/apis/get-status.asciidoc

@@ -10,7 +10,7 @@ Gets the current status for ILM.
 
 ==== Request
 
-`POST /_ilm/status`
+`GET /_ilm/status`
 
 ==== Description
 
@@ -42,7 +42,6 @@ The following example stops the ILM plugin.
 GET _ilm/status
 --------------------------------------------------
 // CONSOLE
-// TEST
 
 If the request does not encounter errors, you receive the following result:
 

+ 0 - 0
x-pack/docs/en/ilm/apis/ilm-api.asciidoc → docs/reference/ilm/apis/ilm-api.asciidoc


+ 0 - 0
x-pack/docs/en/ilm/apis/move-to-step.asciidoc → docs/reference/ilm/apis/move-to-step.asciidoc


+ 0 - 0
x-pack/docs/en/ilm/apis/put-lifecycle.asciidoc → docs/reference/ilm/apis/put-lifecycle.asciidoc


+ 0 - 0
x-pack/docs/en/ilm/apis/remove-policy.asciidoc → docs/reference/ilm/apis/remove-policy.asciidoc


+ 0 - 0
x-pack/docs/en/ilm/apis/retry-policy.asciidoc → docs/reference/ilm/apis/retry-policy.asciidoc


+ 0 - 0
x-pack/docs/en/ilm/apis/start.asciidoc → docs/reference/ilm/apis/start.asciidoc


+ 0 - 0
x-pack/docs/en/ilm/apis/stop.asciidoc → docs/reference/ilm/apis/stop.asciidoc


+ 1 - 0
x-pack/docs/en/ilm/get-index-lifecycle-information.asciidoc → docs/reference/ilm/get-index-lifecycle-information.asciidoc

@@ -1,3 +1,4 @@
+[role="xpack"]
 [[get-index-lifecycle-information]]
 == Get index lifecycle information
 

+ 1 - 0
x-pack/docs/en/ilm/getting-started-ilm.asciidoc → docs/reference/ilm/getting-started-ilm.asciidoc

@@ -1,3 +1,4 @@
+[role="xpack"]
 [[getting-started-index-lifecycle-management]]
 == Getting started with {ilm}
 

+ 3 - 1
x-pack/docs/en/ilm/index.asciidoc → docs/reference/ilm/index.asciidoc

@@ -1,3 +1,5 @@
+[role="xpack"]
+[testenv="basic"]
 [[index-lifecycle-management]]
 = Managing Indices
 
@@ -66,4 +68,4 @@ include::get-index-lifecycle-information.asciidoc[]
 include::start-stop-ilm.asciidoc[]
 
 :edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/x-pack/docs/en/ilm/apis/ilm-api.asciidoc
-include::{xes-repo-dir}/ilm/apis/ilm-api.asciidoc[]
+include::{es-repo-dir}/ilm/apis/ilm-api.asciidoc[]

+ 2 - 0
x-pack/docs/en/ilm/set-up-lifecycle-policy.asciidoc → docs/reference/ilm/set-up-lifecycle-policy.asciidoc

@@ -1,3 +1,5 @@
+[role="xpack"]
+[testenv="basic"]
 [[set-up-lifecycle-policy]]
 == Set up {ilm} policy
 

+ 2 - 0
x-pack/docs/en/ilm/start-stop-ilm.asciidoc → docs/reference/ilm/start-stop-ilm.asciidoc

@@ -1,3 +1,5 @@
+[role="xpack"]
+[testenv="basic"]
 [[start-stop-ilm]]
 == Start And Stop {ilm}
 

+ 2 - 0
x-pack/docs/en/ilm/update-lifecycle-policy.asciidoc → docs/reference/ilm/update-lifecycle-policy.asciidoc

@@ -1,3 +1,5 @@
+[role="xpack"]
+[testenv="basic"]
 [[update-lifecycle-policy]]
 == Update lifecycle policy
 

+ 2 - 0
x-pack/docs/en/ilm/using-policies-rollover.asciidoc → docs/reference/ilm/using-policies-rollover.asciidoc

@@ -1,3 +1,5 @@
+[role="xpack"]
+[testenv="basic"]
 [[using-policies-rollover]]
 == Using policies to manage index rollover
 

+ 1 - 1
docs/reference/index.asciidoc

@@ -55,7 +55,7 @@ include::index-modules.asciidoc[]
 
 include::ingest.asciidoc[]
 
-include::{xes-repo-dir}/ilm/index.asciidoc[]
+include::ilm/index.asciidoc[]
 
 include::sql/index.asciidoc[]
 

+ 38 - 1
test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java

@@ -282,7 +282,8 @@ public abstract class ESRestTestCase extends ESTestCase {
     /**
      * Returns whether to preserve the state of the cluster upon completion of this test. Defaults to false. If true, overrides the value of
      * {@link #preserveIndicesUponCompletion()}, {@link #preserveTemplatesUponCompletion()}, {@link #preserveReposUponCompletion()},
-     * {@link #preserveSnapshotsUponCompletion()}, and {@link #preserveRollupJobsUponCompletion()}.
+     * {@link #preserveSnapshotsUponCompletion()},{@link #preserveRollupJobsUponCompletion()},
+     * and {@link #preserveILMPoliciesUponCompletion()}.
      *
      * @return true if the state of the cluster should be preserved
      */
@@ -347,6 +348,15 @@ public abstract class ESRestTestCase extends ESTestCase {
         return false;
     }
 
+    /**
+     * Returns whether to preserve ILM Policies of this test. Defaults to not
+     * preserviing them. Only runs at all if xpack is installed on the cluster
+     * being tested.
+     */
+    protected boolean preserveILMPoliciesUponCompletion() {
+        return false;
+    }
+
     private void wipeCluster() throws Exception {
         if (preserveIndicesUponCompletion() == false) {
             // wipe indices
@@ -399,6 +409,10 @@ public abstract class ESRestTestCase extends ESTestCase {
             wipeRollupJobs();
             waitForPendingRollupTasks();
         }
+
+        if (hasXPack && false == preserveILMPoliciesUponCompletion()) {
+            deleteAllPolicies();
+        }
     }
 
     /**
@@ -509,6 +523,29 @@ public abstract class ESRestTestCase extends ESTestCase {
         waitForPendingTasks(adminClient(), taskName -> taskName.startsWith("xpack/rollup/job") == false);
     }
 
+    private static void deleteAllPolicies() throws IOException {
+        Map<String, Object> policies;
+
+        try {
+            Response response = adminClient().performRequest(new Request("GET", "/_ilm"));
+            policies = entityAsMap(response);
+        } catch (ResponseException e) {
+            if (RestStatus.BAD_REQUEST.getStatus() == e.getResponse().getStatusLine().getStatusCode()) {
+                // If bad request returned, ILM is not enabled.
+                return;
+            }
+            throw e;
+        }
+
+        if (policies == null || policies.isEmpty()) {
+            return;
+        }
+
+        for (String policyName : policies.keySet()) {
+            adminClient().performRequest(new Request("DELETE", "/_ilm/" + policyName));
+        }
+    }
+
     /**
      * Logs a message if there are still running tasks. The reasoning is that any tasks still running are state the is trying to bleed into
      * other tests.

+ 5 - 0
test/framework/src/main/java/org/elasticsearch/upgrades/AbstractFullClusterRestartTestCase.java

@@ -96,4 +96,9 @@ public abstract class AbstractFullClusterRestartTestCase extends ESRestTestCase
     protected boolean preserveRollupJobsUponCompletion() {
         return true;
     }
+
+    @Override
+    protected boolean preserveILMPoliciesUponCompletion() {
+        return true;
+    }
 }

+ 0 - 0
x-pack/docs/en/rest-api/index-lifecycle/delete-policy.asciidoc


+ 0 - 0
x-pack/docs/en/rest-api/index-lifecycle/get-policy.asciidoc


+ 0 - 0
x-pack/docs/en/rest-api/index-lifecycle/put-policy.asciidoc


+ 0 - 63
x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/ILMRestTestStateCleaner.java

@@ -1,63 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-package org.elasticsearch.xpack.core.indexlifecycle;
-
-import org.elasticsearch.client.Request;
-import org.elasticsearch.client.Response;
-import org.elasticsearch.client.RestClient;
-import org.elasticsearch.test.rest.ESRestTestCase;
-
-import java.io.IOException;
-import java.util.Map;
-
-public class ILMRestTestStateCleaner {
-
-    public static void clearILMMetadata(RestClient adminClient) throws Exception {
-        removePoliciesFromAllIndexes(adminClient);
-        deleteAllPolicies(adminClient);
-        // indices will be deleted by the ESRestTestCase class
-    }
-
-    private static void removePoliciesFromAllIndexes(RestClient adminClient) throws IOException {
-        Response response = adminClient.performRequest(new Request("GET", "/_all"));
-        Map<String, Object> indexes = ESRestTestCase.entityAsMap(response);
-
-        if (indexes == null || indexes.isEmpty()) {
-            return;
-        }
-
-        for (String indexName : indexes.keySet()) {
-            try {
-                adminClient.performRequest(new Request("DELETE", indexName + "/_ilm/"));
-            } catch (Exception e) {
-                // ok
-            }
-        }
-    }
-
-    private static void deleteAllPolicies(RestClient adminClient) throws Exception {
-        Map<String, Object> policies;
-
-        try {
-            Response response = adminClient.performRequest(new Request("GET", "/_ilm"));
-            policies = ESRestTestCase.entityAsMap(response);
-        } catch (Exception e) {
-            return;
-        }
-
-        if (policies == null || policies.isEmpty()) {
-            return;
-        }
-
-        for (String policyName : policies.keySet()) {
-            try {
-                adminClient.performRequest(new Request("DELETE", "/_ilm/" + policyName));
-            } catch (Exception e) {
-                // ok
-            }
-        }
-    }
-}

+ 0 - 22
x-pack/plugin/src/test/java/org/elasticsearch/xpack/test/rest/XPackRestIT.java

@@ -22,7 +22,6 @@ import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
 import org.elasticsearch.test.rest.yaml.ClientYamlTestResponse;
 import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
 import org.elasticsearch.test.rest.yaml.ObjectPath;
-import org.elasticsearch.xpack.core.indexlifecycle.ILMRestTestStateCleaner;
 import org.elasticsearch.xpack.core.ml.MlMetaIndex;
 import org.elasticsearch.xpack.core.ml.integration.MlRestTestStateCleaner;
 import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
@@ -246,7 +245,6 @@ public class XPackRestIT extends ESClientYamlSuiteTestCase {
     public void cleanup() throws Exception {
         disableMonitoring();
         clearMlState();
-        clearILMState();
         if (isWaitForPendingTasks()) {
             // This waits for pending tasks to complete, so must go last (otherwise
             // it could be waiting for pending tasks while monitoring is still running).
@@ -266,20 +264,6 @@ public class XPackRestIT extends ESClientYamlSuiteTestCase {
         }
     }
 
-    private void clearILMState() throws Exception {
-        if (isILMTest()) {
-            ILMRestTestStateCleaner.clearILMMetadata(adminClient());
-        }
-    }
-
-    /**
-
-    private void clearILMState() throws Exception {
-        if (isILMTest()) {
-            ILMRestTestStateCleaner.clearILMMetadata(adminClient());
-        }
-    }
-
     /**
      * Executes an API call using the admin context, waiting for it to succeed.
      */
@@ -340,12 +324,6 @@ public class XPackRestIT extends ESClientYamlSuiteTestCase {
         return testName != null && (testName.contains("=ml/") || testName.contains("=ml\\"));
     }
 
-    protected boolean isILMTest() {
-        String testName = getTestName();
-        return testName != null && (testName.contains("=ilm/") || testName.contains("=ilm\\"))
-                || (testName.contains("/ilm/") || testName.contains("\\ilm\\"));
-    }
-
     /**
      * Should each test wait for pending tasks to finish after execution?
      * @return Wait for pending tasks

+ 5 - 0
x-pack/qa/rolling-upgrade-basic/src/test/java/org/elasticsearch/upgrades/AbstractUpgradeTestCase.java

@@ -29,6 +29,11 @@ public abstract class AbstractUpgradeTestCase extends ESRestTestCase {
         return true;
     }
 
+    @Override
+    protected boolean preserveILMPoliciesUponCompletion() {
+        return true;
+    }
+
     enum CLUSTER_TYPE {
         OLD,
         MIXED,

+ 5 - 0
x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/AbstractUpgradeTestCase.java

@@ -43,6 +43,11 @@ public abstract class AbstractUpgradeTestCase extends ESRestTestCase {
         return true;
     }
 
+    @Override
+    protected boolean preserveILMPoliciesUponCompletion() {
+        return true;
+    }
+
     enum ClusterType {
         OLD,
         MIXED,

+ 5 - 0
x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/UpgradeClusterClientYamlTestSuiteIT.java

@@ -47,6 +47,11 @@ public class UpgradeClusterClientYamlTestSuiteIT extends ESClientYamlSuiteTestCa
         return true;
     }
 
+    @Override
+    protected boolean preserveILMPoliciesUponCompletion() {
+        return true;
+    }
+
     public UpgradeClusterClientYamlTestSuiteIT(ClientYamlTestCandidate testCandidate) {
         super(testCandidate);
     }