Skip to content

Commit e737ea7

Browse files
authored
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.
1 parent 6880e2a commit e737ea7

29 files changed

+73
-90
lines changed

x-pack/docs/en/ilm/apis/get-status.asciidoc renamed to docs/reference/ilm/apis/get-status.asciidoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Gets the current status for ILM.
1010

1111
==== Request
1212

13-
`POST /_ilm/status`
13+
`GET /_ilm/status`
1414

1515
==== Description
1616

@@ -42,7 +42,6 @@ The following example stops the ILM plugin.
4242
GET _ilm/status
4343
--------------------------------------------------
4444
// CONSOLE
45-
// TEST
4645

4746
If the request does not encounter errors, you receive the following result:
4847

x-pack/docs/en/ilm/get-index-lifecycle-information.asciidoc renamed to docs/reference/ilm/get-index-lifecycle-information.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[role="xpack"]
12
[[get-index-lifecycle-information]]
23
== Get index lifecycle information
34

x-pack/docs/en/ilm/getting-started-ilm.asciidoc renamed to docs/reference/ilm/getting-started-ilm.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[role="xpack"]
12
[[getting-started-index-lifecycle-management]]
23
== Getting started with {ilm}
34

x-pack/docs/en/ilm/index.asciidoc renamed to docs/reference/ilm/index.asciidoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[role="xpack"]
2+
[testenv="basic"]
13
[[index-lifecycle-management]]
24
= Managing Indices
35

@@ -66,4 +68,4 @@ include::get-index-lifecycle-information.asciidoc[]
6668
include::start-stop-ilm.asciidoc[]
6769

6870
:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/x-pack/docs/en/ilm/apis/ilm-api.asciidoc
69-
include::{xes-repo-dir}/ilm/apis/ilm-api.asciidoc[]
71+
include::{es-repo-dir}/ilm/apis/ilm-api.asciidoc[]

x-pack/docs/en/ilm/set-up-lifecycle-policy.asciidoc renamed to docs/reference/ilm/set-up-lifecycle-policy.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[role="xpack"]
2+
[testenv="basic"]
13
[[set-up-lifecycle-policy]]
24
== Set up {ilm} policy
35

x-pack/docs/en/ilm/start-stop-ilm.asciidoc renamed to docs/reference/ilm/start-stop-ilm.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[role="xpack"]
2+
[testenv="basic"]
13
[[start-stop-ilm]]
24
== Start And Stop {ilm}
35

x-pack/docs/en/ilm/update-lifecycle-policy.asciidoc renamed to docs/reference/ilm/update-lifecycle-policy.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[role="xpack"]
2+
[testenv="basic"]
13
[[update-lifecycle-policy]]
24
== Update lifecycle policy
35

x-pack/docs/en/ilm/using-policies-rollover.asciidoc renamed to docs/reference/ilm/using-policies-rollover.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[role="xpack"]
2+
[testenv="basic"]
13
[[using-policies-rollover]]
24
== Using policies to manage index rollover
35

docs/reference/index.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ include::index-modules.asciidoc[]
5555

5656
include::ingest.asciidoc[]
5757

58-
include::{xes-repo-dir}/ilm/index.asciidoc[]
58+
include::ilm/index.asciidoc[]
5959

6060
include::sql/index.asciidoc[]
6161

test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ public static void waitForPendingTasks(final RestClient adminClient, final Predi
282282
/**
283283
* Returns whether to preserve the state of the cluster upon completion of this test. Defaults to false. If true, overrides the value of
284284
* {@link #preserveIndicesUponCompletion()}, {@link #preserveTemplatesUponCompletion()}, {@link #preserveReposUponCompletion()},
285-
* {@link #preserveSnapshotsUponCompletion()}, and {@link #preserveRollupJobsUponCompletion()}.
285+
* {@link #preserveSnapshotsUponCompletion()},{@link #preserveRollupJobsUponCompletion()},
286+
* and {@link #preserveILMPoliciesUponCompletion()}.
286287
*
287288
* @return true if the state of the cluster should be preserved
288289
*/
@@ -347,6 +348,15 @@ protected boolean preserveRollupJobsUponCompletion() {
347348
return false;
348349
}
349350

351+
/**
352+
* Returns whether to preserve ILM Policies of this test. Defaults to not
353+
* preserviing them. Only runs at all if xpack is installed on the cluster
354+
* being tested.
355+
*/
356+
protected boolean preserveILMPoliciesUponCompletion() {
357+
return false;
358+
}
359+
350360
private void wipeCluster() throws Exception {
351361
if (preserveIndicesUponCompletion() == false) {
352362
// wipe indices
@@ -399,6 +409,10 @@ private void wipeCluster() throws Exception {
399409
wipeRollupJobs();
400410
waitForPendingRollupTasks();
401411
}
412+
413+
if (hasXPack && false == preserveILMPoliciesUponCompletion()) {
414+
deleteAllPolicies();
415+
}
402416
}
403417

404418
/**
@@ -509,6 +523,29 @@ private void waitForPendingRollupTasks() throws Exception {
509523
waitForPendingTasks(adminClient(), taskName -> taskName.startsWith("xpack/rollup/job") == false);
510524
}
511525

526+
private static void deleteAllPolicies() throws IOException {
527+
Map<String, Object> policies;
528+
529+
try {
530+
Response response = adminClient().performRequest(new Request("GET", "/_ilm"));
531+
policies = entityAsMap(response);
532+
} catch (ResponseException e) {
533+
if (RestStatus.BAD_REQUEST.getStatus() == e.getResponse().getStatusLine().getStatusCode()) {
534+
// If bad request returned, ILM is not enabled.
535+
return;
536+
}
537+
throw e;
538+
}
539+
540+
if (policies == null || policies.isEmpty()) {
541+
return;
542+
}
543+
544+
for (String policyName : policies.keySet()) {
545+
adminClient().performRequest(new Request("DELETE", "/_ilm/" + policyName));
546+
}
547+
}
548+
512549
/**
513550
* 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
514551
* other tests.

test/framework/src/main/java/org/elasticsearch/upgrades/AbstractFullClusterRestartTestCase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,9 @@ protected boolean preserveClusterSettings() {
9696
protected boolean preserveRollupJobsUponCompletion() {
9797
return true;
9898
}
99+
100+
@Override
101+
protected boolean preserveILMPoliciesUponCompletion() {
102+
return true;
103+
}
99104
}

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

Whitespace-only changes.

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

Whitespace-only changes.

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

Whitespace-only changes.

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

Lines changed: 0 additions & 63 deletions
This file was deleted.

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.elasticsearch.test.rest.yaml.ClientYamlTestResponse;
2323
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
2424
import org.elasticsearch.test.rest.yaml.ObjectPath;
25-
import org.elasticsearch.xpack.core.indexlifecycle.ILMRestTestStateCleaner;
2625
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
2726
import org.elasticsearch.xpack.core.ml.integration.MlRestTestStateCleaner;
2827
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
@@ -246,7 +245,6 @@ private void disableMonitoring() throws Exception {
246245
public void cleanup() throws Exception {
247246
disableMonitoring();
248247
clearMlState();
249-
clearILMState();
250248
if (isWaitForPendingTasks()) {
251249
// This waits for pending tasks to complete, so must go last (otherwise
252250
// it could be waiting for pending tasks while monitoring is still running).
@@ -266,20 +264,6 @@ private void clearMlState() throws Exception {
266264
}
267265
}
268266

269-
private void clearILMState() throws Exception {
270-
if (isILMTest()) {
271-
ILMRestTestStateCleaner.clearILMMetadata(adminClient());
272-
}
273-
}
274-
275-
/**
276-
277-
private void clearILMState() throws Exception {
278-
if (isILMTest()) {
279-
ILMRestTestStateCleaner.clearILMMetadata(adminClient());
280-
}
281-
}
282-
283267
/**
284268
* Executes an API call using the admin context, waiting for it to succeed.
285269
*/
@@ -340,12 +324,6 @@ protected boolean isMachineLearningTest() {
340324
return testName != null && (testName.contains("=ml/") || testName.contains("=ml\\"));
341325
}
342326

343-
protected boolean isILMTest() {
344-
String testName = getTestName();
345-
return testName != null && (testName.contains("=ilm/") || testName.contains("=ilm\\"))
346-
|| (testName.contains("/ilm/") || testName.contains("\\ilm\\"));
347-
}
348-
349327
/**
350328
* Should each test wait for pending tasks to finish after execution?
351329
* @return Wait for pending tasks

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ protected boolean preserveRollupJobsUponCompletion() {
2929
return true;
3030
}
3131

32+
@Override
33+
protected boolean preserveILMPoliciesUponCompletion() {
34+
return true;
35+
}
36+
3237
enum CLUSTER_TYPE {
3338
OLD,
3439
MIXED,

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ protected boolean preserveRollupJobsUponCompletion() {
4343
return true;
4444
}
4545

46+
@Override
47+
protected boolean preserveILMPoliciesUponCompletion() {
48+
return true;
49+
}
50+
4651
enum ClusterType {
4752
OLD,
4853
MIXED,

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ protected boolean preserveRollupJobsUponCompletion() {
4747
return true;
4848
}
4949

50+
@Override
51+
protected boolean preserveILMPoliciesUponCompletion() {
52+
return true;
53+
}
54+
5055
public UpgradeClusterClientYamlTestSuiteIT(ClientYamlTestCandidate testCandidate) {
5156
super(testCandidate);
5257
}

0 commit comments

Comments
 (0)