remove `type` config from LifecyclePolicy JSON (#32660)
Since there is only one production policy, Timeseries, there is no reason to expose the `type` argument to the user.
This commit is contained in:
parent
d1ab5dd650
commit
4baa721459
|
@ -49,7 +49,6 @@ public class IndexLifecycleIT extends ESRestHighLevelClientTestCase {
|
||||||
// TODO: NORELEASE convert this to using the high level client once there are APIs for it
|
// TODO: NORELEASE convert this to using the high level client once there are APIs for it
|
||||||
String jsonString = "{\n" +
|
String jsonString = "{\n" +
|
||||||
" \"policy\": {\n" +
|
" \"policy\": {\n" +
|
||||||
" \"type\": \"timeseries\",\n" +
|
|
||||||
" \"phases\": {\n" +
|
" \"phases\": {\n" +
|
||||||
" \"hot\": {\n" +
|
" \"hot\": {\n" +
|
||||||
" \"after\": \"60s\",\n" +
|
" \"after\": \"60s\",\n" +
|
||||||
|
@ -110,14 +109,13 @@ public class IndexLifecycleIT extends ESRestHighLevelClientTestCase {
|
||||||
assertThat(settingsResponse.getSetting("foo", "index.lifecycle.name"), equalTo(policy));
|
assertThat(settingsResponse.getSetting("foo", "index.lifecycle.name"), equalTo(policy));
|
||||||
assertThat(settingsResponse.getSetting("baz", "index.lifecycle.name"), equalTo(policy));
|
assertThat(settingsResponse.getSetting("baz", "index.lifecycle.name"), equalTo(policy));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStartStopILM() throws Exception {
|
public void testStartStopILM() throws Exception {
|
||||||
String policy = randomAlphaOfLength(10);
|
String policy = randomAlphaOfLength(10);
|
||||||
|
|
||||||
// TODO: NORELEASE convert this to using the high level client once there are APIs for it
|
// TODO: NORELEASE convert this to using the high level client once there are APIs for it
|
||||||
String jsonString = "{\n" +
|
String jsonString = "{\n" +
|
||||||
" \"policy\": {\n" +
|
" \"policy\": {\n" +
|
||||||
" \"type\": \"timeseries\",\n" +
|
|
||||||
" \"phases\": {\n" +
|
" \"phases\": {\n" +
|
||||||
" \"hot\": {\n" +
|
" \"hot\": {\n" +
|
||||||
" \"actions\": {\n" +
|
" \"actions\": {\n" +
|
||||||
|
@ -174,7 +172,7 @@ public class IndexLifecycleIT extends ESRestHighLevelClientTestCase {
|
||||||
Response statusResponse = client().performRequest(statusReq);
|
Response statusResponse = client().performRequest(statusReq);
|
||||||
String statusResponseString = EntityUtils.toString(statusResponse.getEntity());
|
String statusResponseString = EntityUtils.toString(statusResponse.getEntity());
|
||||||
assertEquals("{\"operation_mode\":\"RUNNING\"}", statusResponseString);
|
assertEquals("{\"operation_mode\":\"RUNNING\"}", statusResponseString);
|
||||||
|
|
||||||
StopILMRequest stopReq = new StopILMRequest();
|
StopILMRequest stopReq = new StopILMRequest();
|
||||||
AcknowledgedResponse stopResponse = execute(stopReq, highLevelClient().indexLifecycle()::stopILM,
|
AcknowledgedResponse stopResponse = execute(stopReq, highLevelClient().indexLifecycle()::stopILM,
|
||||||
highLevelClient().indexLifecycle()::stopILMAsync);
|
highLevelClient().indexLifecycle()::stopILMAsync);
|
||||||
|
@ -186,7 +184,7 @@ public class IndexLifecycleIT extends ESRestHighLevelClientTestCase {
|
||||||
statusResponseString = EntityUtils.toString(statusResponse.getEntity());
|
statusResponseString = EntityUtils.toString(statusResponse.getEntity());
|
||||||
assertThat(statusResponseString,
|
assertThat(statusResponseString,
|
||||||
Matchers.anyOf(equalTo("{\"operation_mode\":\"STOPPING\"}"), equalTo("{\"operation_mode\":\"STOPPED\"}")));
|
Matchers.anyOf(equalTo("{\"operation_mode\":\"STOPPING\"}"), equalTo("{\"operation_mode\":\"STOPPED\"}")));
|
||||||
|
|
||||||
StartILMRequest startReq = new StartILMRequest();
|
StartILMRequest startReq = new StartILMRequest();
|
||||||
AcknowledgedResponse startResponse = execute(startReq, highLevelClient().indexLifecycle()::startILM,
|
AcknowledgedResponse startResponse = execute(startReq, highLevelClient().indexLifecycle()::startILM,
|
||||||
highLevelClient().indexLifecycle()::startILMAsync);
|
highLevelClient().indexLifecycle()::startILMAsync);
|
||||||
|
@ -205,7 +203,6 @@ public class IndexLifecycleIT extends ESRestHighLevelClientTestCase {
|
||||||
// TODO: NORELEASE convert this to using the high level client once there are APIs for it
|
// TODO: NORELEASE convert this to using the high level client once there are APIs for it
|
||||||
String jsonString = "{\n" +
|
String jsonString = "{\n" +
|
||||||
" \"policy\": {\n" +
|
" \"policy\": {\n" +
|
||||||
" \"type\": \"timeseries\",\n" +
|
|
||||||
" \"phases\": {\n" +
|
" \"phases\": {\n" +
|
||||||
" \"hot\": {\n" +
|
" \"hot\": {\n" +
|
||||||
" \"actions\": {\n" +
|
" \"actions\": {\n" +
|
||||||
|
|
|
@ -15,7 +15,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.logging.ESLoggerFactory;
|
import org.elasticsearch.common.logging.ESLoggerFactory;
|
||||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||||
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
|
||||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
|
@ -45,19 +44,15 @@ public class LifecyclePolicy extends AbstractDiffable<LifecyclePolicy>
|
||||||
private static final Logger logger = ESLoggerFactory.getLogger(LifecyclePolicy.class);
|
private static final Logger logger = ESLoggerFactory.getLogger(LifecyclePolicy.class);
|
||||||
|
|
||||||
public static final ParseField PHASES_FIELD = new ParseField("phases");
|
public static final ParseField PHASES_FIELD = new ParseField("phases");
|
||||||
public static final ParseField TYPE_FIELD = new ParseField("type");
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static ConstructingObjectParser<LifecyclePolicy, String> PARSER = new ConstructingObjectParser<>("lifecycle_policy", false,
|
public static ConstructingObjectParser<LifecyclePolicy, String> PARSER = new ConstructingObjectParser<>("lifecycle_policy", false,
|
||||||
(a, name) -> {
|
(a, name) -> {
|
||||||
LifecycleType type = (LifecycleType) a[0];
|
List<Phase> phases = (List<Phase>) a[0];
|
||||||
List<Phase> phases = (List<Phase>) a[1];
|
|
||||||
Map<String, Phase> phaseMap = phases.stream().collect(Collectors.toMap(Phase::getName, Function.identity()));
|
Map<String, Phase> phaseMap = phases.stream().collect(Collectors.toMap(Phase::getName, Function.identity()));
|
||||||
return new LifecyclePolicy(type, name, phaseMap);
|
return new LifecyclePolicy(TimeseriesLifecycleType.INSTANCE, name, phaseMap);
|
||||||
});
|
});
|
||||||
static {
|
static {
|
||||||
PARSER.declareField(ConstructingObjectParser.optionalConstructorArg(), (p, c) -> p.namedObject(LifecycleType.class, p.text(), null),
|
|
||||||
TYPE_FIELD, ValueType.STRING);
|
|
||||||
PARSER.declareNamedObjects(ConstructingObjectParser.constructorArg(), (p, c, n) -> Phase.parse(p, n), v -> {
|
PARSER.declareNamedObjects(ConstructingObjectParser.constructorArg(), (p, c, n) -> Phase.parse(p, n), v -> {
|
||||||
throw new IllegalArgumentException("ordered " + PHASES_FIELD.getPreferredName() + " are not supported");
|
throw new IllegalArgumentException("ordered " + PHASES_FIELD.getPreferredName() + " are not supported");
|
||||||
}, PHASES_FIELD);
|
}, PHASES_FIELD);
|
||||||
|
@ -74,15 +69,8 @@ public class LifecyclePolicy extends AbstractDiffable<LifecyclePolicy>
|
||||||
* a {@link Map} of {@link Phase}s which make up this
|
* a {@link Map} of {@link Phase}s which make up this
|
||||||
* {@link LifecyclePolicy}.
|
* {@link LifecyclePolicy}.
|
||||||
*/
|
*/
|
||||||
public LifecyclePolicy(LifecycleType type, String name, Map<String, Phase> phases) {
|
public LifecyclePolicy(String name, Map<String, Phase> phases) {
|
||||||
if (type == null) {
|
this(TimeseriesLifecycleType.INSTANCE, name, phases);
|
||||||
this.type = TimeseriesLifecycleType.INSTANCE;
|
|
||||||
} else {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
this.name = name;
|
|
||||||
this.phases = phases;
|
|
||||||
this.type.validate(phases.values());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,6 +82,21 @@ public class LifecyclePolicy extends AbstractDiffable<LifecyclePolicy>
|
||||||
phases = Collections.unmodifiableMap(in.readMap(StreamInput::readString, Phase::new));
|
phases = Collections.unmodifiableMap(in.readMap(StreamInput::readString, Phase::new));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type
|
||||||
|
* the {@link LifecycleType} of the policy
|
||||||
|
* @param name
|
||||||
|
* the name of this {@link LifecyclePolicy}
|
||||||
|
* @param phases
|
||||||
|
* a {@link Map} of {@link Phase}s which make up this
|
||||||
|
* {@link LifecyclePolicy}.
|
||||||
|
*/
|
||||||
|
LifecyclePolicy(LifecycleType type, String name, Map<String, Phase> phases) {
|
||||||
|
this.name = name;
|
||||||
|
this.phases = phases;
|
||||||
|
this.type = type;
|
||||||
|
this.type.validate(phases.values());
|
||||||
|
}
|
||||||
public static LifecyclePolicy parse(XContentParser parser, String name) {
|
public static LifecyclePolicy parse(XContentParser parser, String name) {
|
||||||
return PARSER.apply(parser, name);
|
return PARSER.apply(parser, name);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +133,6 @@ public class LifecyclePolicy extends AbstractDiffable<LifecyclePolicy>
|
||||||
@Override
|
@Override
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.field(TYPE_FIELD.getPreferredName(), type.getWriteableName());
|
|
||||||
builder.startObject(PHASES_FIELD.getPreferredName());
|
builder.startObject(PHASES_FIELD.getPreferredName());
|
||||||
for (Phase phase : phases.values()) {
|
for (Phase phase : phases.values()) {
|
||||||
builder.field(phase.getName(), phase);
|
builder.field(phase.getName(), phase);
|
||||||
|
@ -183,7 +185,7 @@ public class LifecyclePolicy extends AbstractDiffable<LifecyclePolicy>
|
||||||
|
|
||||||
// add `after` step for phase before next
|
// add `after` step for phase before next
|
||||||
if (phase != null) {
|
if (phase != null) {
|
||||||
// after step should have the name of the previous phase since the index is still in the
|
// after step should have the name of the previous phase since the index is still in the
|
||||||
// previous phase until the after condition is reached
|
// previous phase until the after condition is reached
|
||||||
Step.StepKey afterStepKey = new Step.StepKey(previousPhase.getName(), PhaseAfterStep.NAME, PhaseAfterStep.NAME);
|
Step.StepKey afterStepKey = new Step.StepKey(previousPhase.getName(), PhaseAfterStep.NAME, PhaseAfterStep.NAME);
|
||||||
Step phaseAfterStep = new PhaseAfterStep(nowSupplier, phase.getAfter(), afterStepKey, lastStepKey);
|
Step phaseAfterStep = new PhaseAfterStep(nowSupplier, phase.getAfter(), afterStepKey, lastStepKey);
|
||||||
|
@ -278,7 +280,7 @@ public class LifecyclePolicy extends AbstractDiffable<LifecyclePolicy>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private StepKey getNextAfterStep(String currentPhaseName) {
|
private StepKey getNextAfterStep(String currentPhaseName) {
|
||||||
String nextPhaseName = type.getNextPhaseName(currentPhaseName, phases);
|
String nextPhaseName = type.getNextPhaseName(currentPhaseName, phases);
|
||||||
if (nextPhaseName == null) {
|
if (nextPhaseName == null) {
|
||||||
|
@ -335,7 +337,7 @@ public class LifecyclePolicy extends AbstractDiffable<LifecyclePolicy>
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LifecyclePolicy other = (LifecyclePolicy) obj;
|
LifecyclePolicy other = (LifecyclePolicy) obj;
|
||||||
return Objects.equals(name, other.name) &&
|
return Objects.equals(name, other.name) &&
|
||||||
Objects.equals(phases, other.phases);
|
Objects.equals(phases, other.phases);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,13 @@ public class LifecyclePolicyMetadata extends AbstractDiffable<LifecyclePolicyMet
|
||||||
public static final ParseField HEADERS = new ParseField("headers");
|
public static final ParseField HEADERS = new ParseField("headers");
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static final ConstructingObjectParser<LifecyclePolicyMetadata, String> PARSER = new ConstructingObjectParser<>("policy_metadata",
|
public static final ConstructingObjectParser<LifecyclePolicyMetadata, String> PARSER = new ConstructingObjectParser<>("policy_metadata",
|
||||||
a -> new LifecyclePolicyMetadata((LifecyclePolicy) a[0], (Map<String, String>) a[1]));
|
a -> {
|
||||||
|
LifecyclePolicy policy = (LifecyclePolicy) a[0];
|
||||||
|
return new LifecyclePolicyMetadata(policy, (Map<String, String>) a[1]);
|
||||||
|
});
|
||||||
static {
|
static {
|
||||||
PARSER.declareObject(ConstructingObjectParser.constructorArg(), (p, c) -> LifecyclePolicy.parse(p, c), POLICY);
|
PARSER.declareObject(ConstructingObjectParser.constructorArg(), LifecyclePolicy::parse, POLICY);
|
||||||
PARSER.declareField(ConstructingObjectParser.constructorArg(), p -> p.mapStrings(), HEADERS, ValueType.OBJECT);
|
PARSER.declareField(ConstructingObjectParser.constructorArg(), XContentParser::mapStrings, HEADERS, ValueType.OBJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LifecyclePolicyMetadata parse(XContentParser parser, String name) {
|
public static LifecyclePolicyMetadata parse(XContentParser parser, String name) {
|
||||||
|
@ -40,12 +43,12 @@ public class LifecyclePolicyMetadata extends AbstractDiffable<LifecyclePolicyMet
|
||||||
|
|
||||||
private final LifecyclePolicy policy;
|
private final LifecyclePolicy policy;
|
||||||
private final Map<String, String> headers;
|
private final Map<String, String> headers;
|
||||||
|
|
||||||
public LifecyclePolicyMetadata(LifecyclePolicy policy, Map<String, String> headers) {
|
public LifecyclePolicyMetadata(LifecyclePolicy policy, Map<String, String> headers) {
|
||||||
this.policy = policy;
|
this.policy = policy;
|
||||||
this.headers = headers;
|
this.headers = headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public LifecyclePolicyMetadata(StreamInput in) throws IOException {
|
public LifecyclePolicyMetadata(StreamInput in) throws IOException {
|
||||||
this.policy = new LifecyclePolicy(in);
|
this.policy = new LifecyclePolicy(in);
|
||||||
|
@ -55,11 +58,11 @@ public class LifecyclePolicyMetadata extends AbstractDiffable<LifecyclePolicyMet
|
||||||
public Map<String, String> getHeaders() {
|
public Map<String, String> getHeaders() {
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LifecyclePolicy getPolicy() {
|
public LifecyclePolicy getPolicy() {
|
||||||
return policy;
|
return policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return policy.getName();
|
return policy.getName();
|
||||||
}
|
}
|
||||||
|
@ -78,12 +81,12 @@ public class LifecyclePolicyMetadata extends AbstractDiffable<LifecyclePolicyMet
|
||||||
policy.writeTo(out);
|
policy.writeTo(out);
|
||||||
out.writeGenericValue(headers);
|
out.writeGenericValue(headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(policy, headers);
|
return Objects.hash(policy, headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
|
@ -94,7 +97,7 @@ public class LifecyclePolicyMetadata extends AbstractDiffable<LifecyclePolicyMet
|
||||||
}
|
}
|
||||||
LifecyclePolicyMetadata other = (LifecyclePolicyMetadata) obj;
|
LifecyclePolicyMetadata other = (LifecyclePolicyMetadata) obj;
|
||||||
return Objects.equals(policy, other.policy) &&
|
return Objects.equals(policy, other.policy) &&
|
||||||
Objects.equals(headers, other.headers);
|
Objects.equals(headers, other.headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class PutLifecycleAction extends Action<PutLifecycleAction.Response> {
|
||||||
private static final ConstructingObjectParser<Request, String> PARSER =
|
private static final ConstructingObjectParser<Request, String> PARSER =
|
||||||
new ConstructingObjectParser<>("put_lifecycle_request", a -> new Request((LifecyclePolicy) a[0]));
|
new ConstructingObjectParser<>("put_lifecycle_request", a -> new Request((LifecyclePolicy) a[0]));
|
||||||
static {
|
static {
|
||||||
PARSER.declareObject(ConstructingObjectParser.constructorArg(), (p, name) -> LifecyclePolicy.parse(p, name), POLICY_FIELD);
|
PARSER.declareObject(ConstructingObjectParser.constructorArg(), LifecyclePolicy::parse, POLICY_FIELD);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LifecyclePolicy policy;
|
private LifecyclePolicy policy;
|
||||||
|
|
|
@ -34,16 +34,32 @@ public class LifecyclePolicyMetadataTests extends AbstractSerializingTestCase<Li
|
||||||
@Override
|
@Override
|
||||||
protected NamedWriteableRegistry getNamedWriteableRegistry() {
|
protected NamedWriteableRegistry getNamedWriteableRegistry() {
|
||||||
return new NamedWriteableRegistry(
|
return new NamedWriteableRegistry(
|
||||||
Arrays.asList(new NamedWriteableRegistry.Entry(LifecycleAction.class, MockAction.NAME, MockAction::new),
|
Arrays.asList(
|
||||||
new NamedWriteableRegistry.Entry(LifecycleType.class, TestLifecycleType.TYPE, (in) -> TestLifecycleType.INSTANCE)));
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, MockAction.NAME, MockAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleType.class, TimeseriesLifecycleType.TYPE,
|
||||||
|
(in) -> TimeseriesLifecycleType.INSTANCE),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, AllocateAction.NAME, AllocateAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, DeleteAction.NAME, DeleteAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, ForceMergeAction.NAME, ForceMergeAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, ReadOnlyAction.NAME, ReadOnlyAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, RolloverAction.NAME, RolloverAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, ShrinkAction.NAME, ShrinkAction::new)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected NamedXContentRegistry xContentRegistry() {
|
protected NamedXContentRegistry xContentRegistry() {
|
||||||
List<NamedXContentRegistry.Entry> entries = new ArrayList<>(ClusterModule.getNamedXWriteables());
|
List<NamedXContentRegistry.Entry> entries = new ArrayList<>(ClusterModule.getNamedXWriteables());
|
||||||
entries.add(new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(MockAction.NAME), MockAction::parse));
|
entries.addAll(Arrays.asList(
|
||||||
entries.add(new NamedXContentRegistry.Entry(LifecycleType.class, new ParseField(TestLifecycleType.TYPE),
|
new NamedXContentRegistry.Entry(LifecycleType.class, new ParseField(TimeseriesLifecycleType.TYPE),
|
||||||
(p) -> TestLifecycleType.INSTANCE));
|
(p) -> TimeseriesLifecycleType.INSTANCE),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(AllocateAction.NAME), AllocateAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(DeleteAction.NAME), DeleteAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(ForceMergeAction.NAME), ForceMergeAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(ReadOnlyAction.NAME), ReadOnlyAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(RolloverAction.NAME), RolloverAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(ShrinkAction.NAME), ShrinkAction::parse)
|
||||||
|
));
|
||||||
return new NamedXContentRegistry(entries);
|
return new NamedXContentRegistry(entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +75,7 @@ public class LifecyclePolicyMetadataTests extends AbstractSerializingTestCase<Li
|
||||||
for (int i = 0; i < numberHeaders; i++) {
|
for (int i = 0; i < numberHeaders; i++) {
|
||||||
headers.put(randomAlphaOfLength(10), randomAlphaOfLength(10));
|
headers.put(randomAlphaOfLength(10), randomAlphaOfLength(10));
|
||||||
}
|
}
|
||||||
return new LifecyclePolicyMetadata(LifecyclePolicyTests.randomTestLifecyclePolicy(lifecycleName), headers);
|
return new LifecyclePolicyMetadata(LifecyclePolicyTests.randomTimeseriesLifecyclePolicy(lifecycleName), headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,7 +89,7 @@ public class LifecyclePolicyMetadataTests extends AbstractSerializingTestCase<Li
|
||||||
Map<String, String> headers = instance.getHeaders();
|
Map<String, String> headers = instance.getHeaders();
|
||||||
switch (between(0, 1)) {
|
switch (between(0, 1)) {
|
||||||
case 0:
|
case 0:
|
||||||
policy = new LifecyclePolicy(TestLifecycleType.INSTANCE, policy.getName() + randomAlphaOfLengthBetween(1, 5),
|
policy = new LifecyclePolicy(TimeseriesLifecycleType.INSTANCE, policy.getName() + randomAlphaOfLengthBetween(1, 5),
|
||||||
policy.getPhases());
|
policy.getPhases());
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
@ -50,7 +50,6 @@ public class LifecyclePolicyTests extends AbstractSerializingTestCase<LifecycleP
|
||||||
protected NamedWriteableRegistry getNamedWriteableRegistry() {
|
protected NamedWriteableRegistry getNamedWriteableRegistry() {
|
||||||
return new NamedWriteableRegistry(
|
return new NamedWriteableRegistry(
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
new NamedWriteableRegistry.Entry(LifecycleAction.class, MockAction.NAME, MockAction::new),
|
|
||||||
new NamedWriteableRegistry.Entry(LifecycleType.class, TimeseriesLifecycleType.TYPE,
|
new NamedWriteableRegistry.Entry(LifecycleType.class, TimeseriesLifecycleType.TYPE,
|
||||||
(in) -> TimeseriesLifecycleType.INSTANCE),
|
(in) -> TimeseriesLifecycleType.INSTANCE),
|
||||||
new NamedWriteableRegistry.Entry(LifecycleAction.class, AllocateAction.NAME, AllocateAction::new),
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, AllocateAction.NAME, AllocateAction::new),
|
||||||
|
@ -154,14 +153,14 @@ public class LifecyclePolicyTests extends AbstractSerializingTestCase<LifecycleP
|
||||||
name = name + randomAlphaOfLengthBetween(1, 5);
|
name = name + randomAlphaOfLengthBetween(1, 5);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
String phaseName = randomValueOtherThanMany(phases::containsKey, () -> randomFrom(TimeseriesLifecycleType.VALID_PHASES));
|
||||||
phases = new LinkedHashMap<>(phases);
|
phases = new LinkedHashMap<>(phases);
|
||||||
String phaseName = randomAlphaOfLengthBetween(1, 10);
|
|
||||||
phases.put(phaseName, new Phase(phaseName, TimeValue.timeValueSeconds(randomIntBetween(1, 1000)), Collections.emptyMap()));
|
phases.put(phaseName, new Phase(phaseName, TimeValue.timeValueSeconds(randomIntBetween(1, 1000)), Collections.emptyMap()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new AssertionError("Illegal randomisation branch");
|
throw new AssertionError("Illegal randomisation branch");
|
||||||
}
|
}
|
||||||
return new LifecyclePolicy(TestLifecycleType.INSTANCE, name, phases);
|
return new LifecyclePolicy(TimeseriesLifecycleType.INSTANCE, name, phases);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -169,11 +168,6 @@ public class LifecyclePolicyTests extends AbstractSerializingTestCase<LifecycleP
|
||||||
return LifecyclePolicy::new;
|
return LifecyclePolicy::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDefaultLifecycleType() {
|
|
||||||
LifecyclePolicy policy = new LifecyclePolicy(null, randomAlphaOfLength(10), Collections.emptyMap());
|
|
||||||
assertSame(TimeseriesLifecycleType.INSTANCE, policy.getType());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testFirstAndLastSteps() {
|
public void testFirstAndLastSteps() {
|
||||||
Client client = mock(Client.class);
|
Client client = mock(Client.class);
|
||||||
LongSupplier nowSupplier = () -> 0L;
|
LongSupplier nowSupplier = () -> 0L;
|
||||||
|
|
|
@ -7,26 +7,27 @@ package org.elasticsearch.xpack.core.indexlifecycle.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||||
import org.elasticsearch.test.AbstractStreamableTestCase;
|
import org.elasticsearch.test.AbstractStreamableTestCase;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.DeleteAction;
|
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.LifecycleAction;
|
import org.elasticsearch.xpack.core.indexlifecycle.LifecycleAction;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicy;
|
import org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicy;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.LifecycleType;
|
import org.elasticsearch.xpack.core.indexlifecycle.LifecycleType;
|
||||||
|
import org.elasticsearch.xpack.core.indexlifecycle.MockAction;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.TestLifecycleType;
|
import org.elasticsearch.xpack.core.indexlifecycle.TestLifecycleType;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.action.GetLifecycleAction.Response;
|
import org.elasticsearch.xpack.core.indexlifecycle.action.GetLifecycleAction.Response;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicyTests.randomTestLifecyclePolicy;
|
||||||
|
|
||||||
public class GetLifecycleResponseTests extends AbstractStreamableTestCase<GetLifecycleAction.Response> {
|
public class GetLifecycleResponseTests extends AbstractStreamableTestCase<GetLifecycleAction.Response> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Response createTestInstance() {
|
protected Response createTestInstance() {
|
||||||
String randomPrefix = randomAlphaOfLength(5);
|
String randomPrefix = randomAlphaOfLength(5);
|
||||||
List<LifecyclePolicy> policies = new ArrayList<>();
|
List<LifecyclePolicy> policies = new ArrayList<>();
|
||||||
for (int i = 0; i < randomIntBetween(0, 2); i++) {
|
for (int i = 0; i < randomIntBetween(0, 2); i++) {
|
||||||
policies.add(new LifecyclePolicy(TestLifecycleType.INSTANCE, randomPrefix + i, Collections.emptyMap()));
|
policies.add(randomTestLifecyclePolicy(randomPrefix + i));
|
||||||
}
|
}
|
||||||
return new Response(policies);
|
return new Response(policies);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +39,7 @@ public class GetLifecycleResponseTests extends AbstractStreamableTestCase<GetLif
|
||||||
|
|
||||||
protected NamedWriteableRegistry getNamedWriteableRegistry() {
|
protected NamedWriteableRegistry getNamedWriteableRegistry() {
|
||||||
return new NamedWriteableRegistry(
|
return new NamedWriteableRegistry(
|
||||||
Arrays.asList(new NamedWriteableRegistry.Entry(LifecycleAction.class, DeleteAction.NAME, DeleteAction::new),
|
Arrays.asList(new NamedWriteableRegistry.Entry(LifecycleAction.class, MockAction.NAME, MockAction::new),
|
||||||
new NamedWriteableRegistry.Entry(LifecycleType.class, TestLifecycleType.TYPE, in -> TestLifecycleType.INSTANCE)));
|
new NamedWriteableRegistry.Entry(LifecycleType.class, TestLifecycleType.TYPE, in -> TestLifecycleType.INSTANCE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,12 +48,12 @@ public class GetLifecycleResponseTests extends AbstractStreamableTestCase<GetLif
|
||||||
List<LifecyclePolicy> policies = new ArrayList<>(response.getPolicies());
|
List<LifecyclePolicy> policies = new ArrayList<>(response.getPolicies());
|
||||||
if (policies.size() > 0) {
|
if (policies.size() > 0) {
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
policies.add(new LifecyclePolicy(TestLifecycleType.INSTANCE, randomAlphaOfLength(2), Collections.emptyMap()));
|
policies.add(randomTestLifecyclePolicy(randomAlphaOfLength(5)));
|
||||||
} else {
|
} else {
|
||||||
policies.remove(policies.size() - 1);
|
policies.remove(policies.size() - 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
policies.add(new LifecyclePolicy(TestLifecycleType.INSTANCE, randomAlphaOfLength(2), Collections.emptyMap()));
|
policies.add(randomTestLifecyclePolicy(randomAlphaOfLength(2)));
|
||||||
}
|
}
|
||||||
return new Response(policies);
|
return new Response(policies);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,28 +8,29 @@ package org.elasticsearch.xpack.core.indexlifecycle.action;
|
||||||
import org.elasticsearch.cluster.ClusterModule;
|
import org.elasticsearch.cluster.ClusterModule;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
|
||||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
|
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
|
||||||
|
import org.elasticsearch.xpack.core.indexlifecycle.AllocateAction;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.DeleteAction;
|
import org.elasticsearch.xpack.core.indexlifecycle.DeleteAction;
|
||||||
|
import org.elasticsearch.xpack.core.indexlifecycle.ForceMergeAction;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.LifecycleAction;
|
import org.elasticsearch.xpack.core.indexlifecycle.LifecycleAction;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicy;
|
import org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicy;
|
||||||
|
import org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicyTests;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.LifecycleType;
|
import org.elasticsearch.xpack.core.indexlifecycle.LifecycleType;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.Phase;
|
import org.elasticsearch.xpack.core.indexlifecycle.ReadOnlyAction;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.TestLifecycleType;
|
import org.elasticsearch.xpack.core.indexlifecycle.RolloverAction;
|
||||||
|
import org.elasticsearch.xpack.core.indexlifecycle.ShrinkAction;
|
||||||
|
import org.elasticsearch.xpack.core.indexlifecycle.TimeseriesLifecycleType;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.action.PutLifecycleAction.Request;
|
import org.elasticsearch.xpack.core.indexlifecycle.action.PutLifecycleAction.Request;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class PutLifecycleRequestTests extends AbstractStreamableXContentTestCase<PutLifecycleAction.Request> {
|
public class PutLifecycleRequestTests extends AbstractStreamableXContentTestCase<PutLifecycleAction.Request> {
|
||||||
|
|
||||||
private String lifecycleName;
|
private String lifecycleName;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -39,7 +40,7 @@ public class PutLifecycleRequestTests extends AbstractStreamableXContentTestCase
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request createTestInstance() {
|
protected Request createTestInstance() {
|
||||||
return new Request(new LifecyclePolicy(TestLifecycleType.INSTANCE, lifecycleName, Collections.emptyMap()));
|
return new Request(LifecyclePolicyTests.randomTimeseriesLifecyclePolicy(lifecycleName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,18 +53,34 @@ public class PutLifecycleRequestTests extends AbstractStreamableXContentTestCase
|
||||||
return PutLifecycleAction.Request.parseRequest(lifecycleName, parser);
|
return PutLifecycleAction.Request.parseRequest(lifecycleName, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected NamedWriteableRegistry getNamedWriteableRegistry() {
|
protected NamedWriteableRegistry getNamedWriteableRegistry() {
|
||||||
return new NamedWriteableRegistry(
|
return new NamedWriteableRegistry(
|
||||||
Arrays.asList(new NamedWriteableRegistry.Entry(LifecycleAction.class, DeleteAction.NAME, DeleteAction::new),
|
Arrays.asList(
|
||||||
new NamedWriteableRegistry.Entry(LifecycleType.class, TestLifecycleType.TYPE, in -> TestLifecycleType.INSTANCE)));
|
new NamedWriteableRegistry.Entry(LifecycleType.class, TimeseriesLifecycleType.TYPE,
|
||||||
|
(in) -> TimeseriesLifecycleType.INSTANCE),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, AllocateAction.NAME, AllocateAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, DeleteAction.NAME, DeleteAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, ForceMergeAction.NAME, ForceMergeAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, ReadOnlyAction.NAME, ReadOnlyAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, RolloverAction.NAME, RolloverAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, ShrinkAction.NAME, ShrinkAction::new)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected NamedXContentRegistry xContentRegistry() {
|
protected NamedXContentRegistry xContentRegistry() {
|
||||||
List<NamedXContentRegistry.Entry> entries = new ArrayList<>(ClusterModule.getNamedXWriteables());
|
List<NamedXContentRegistry.Entry> entries = new ArrayList<>(ClusterModule.getNamedXWriteables());
|
||||||
entries.add(new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(DeleteAction.NAME), DeleteAction::parse));
|
entries.addAll(Arrays.asList(
|
||||||
entries.add(new NamedXContentRegistry.Entry(LifecycleType.class, new ParseField(TestLifecycleType.TYPE),
|
new NamedXContentRegistry.Entry(LifecycleType.class, new ParseField(TimeseriesLifecycleType.TYPE),
|
||||||
(p) -> TestLifecycleType.INSTANCE));
|
(p) -> TimeseriesLifecycleType.INSTANCE),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(AllocateAction.NAME), AllocateAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(DeleteAction.NAME), DeleteAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(ForceMergeAction.NAME), ForceMergeAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(ReadOnlyAction.NAME), ReadOnlyAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(RolloverAction.NAME), RolloverAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(ShrinkAction.NAME), ShrinkAction::parse)
|
||||||
|
));
|
||||||
return new NamedXContentRegistry(entries);
|
return new NamedXContentRegistry(entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,23 +90,10 @@ public class PutLifecycleRequestTests extends AbstractStreamableXContentTestCase
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request mutateInstance(Request request) {
|
protected Request mutateInstance(Request request) {
|
||||||
LifecyclePolicy policy = request.getPolicy();
|
String name = randomBoolean() ? lifecycleName : randomAlphaOfLength(5);
|
||||||
String name = policy.getName();
|
LifecyclePolicy policy = randomValueOtherThan(request.getPolicy(),
|
||||||
Map<String, Phase> phases = policy.getPhases();
|
() -> LifecyclePolicyTests.randomTimeseriesLifecyclePolicy(name));
|
||||||
switch (between(0, 1)) {
|
return new Request(policy);
|
||||||
case 0:
|
|
||||||
name = name + randomAlphaOfLengthBetween(1, 5);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
phases = new HashMap<>(phases);
|
|
||||||
String newPhaseName = randomAlphaOfLengthBetween(1, 10);
|
|
||||||
phases.put(name, new Phase(newPhaseName, TimeValue.timeValueSeconds(randomIntBetween(1, 1000)),
|
|
||||||
Collections.emptyMap()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new AssertionError("Illegal randomisation branch");
|
|
||||||
}
|
|
||||||
return new Request(new LifecyclePolicy(TestLifecycleType.INSTANCE, name, phases));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* 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.xpack.indexlifecycle.LockableLifecycleType;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is here for constructing instances of {@link LifecyclePolicy} that differs from
|
||||||
|
* the main {@link TimeseriesLifecycleType} one. Since the more generic constructor is package-private so
|
||||||
|
* that users are not exposed to {@link LifecycleType}, it is still useful to construct different ones for
|
||||||
|
* testing purposes
|
||||||
|
*/
|
||||||
|
public class LifecyclePolicyTestsUtils {
|
||||||
|
|
||||||
|
public static LifecyclePolicy newTestLifecyclePolicy(String policyName, Map<String, Phase> phases) {
|
||||||
|
return new LifecyclePolicy(TestLifecycleType.INSTANCE, policyName, phases);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LifecyclePolicy newLockableLifecyclePolicy(String policyName, Map<String, Phase> phases) {
|
||||||
|
return new LifecyclePolicy(LockableLifecycleType.INSTANCE, policyName, phases);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LifecyclePolicy randomTimeseriesLifecyclePolicy(String policyName) {
|
||||||
|
return LifecyclePolicyTests.randomTimeseriesLifecyclePolicy(policyName);
|
||||||
|
}
|
||||||
|
}
|
|
@ -32,7 +32,6 @@ import org.elasticsearch.xpack.core.indexlifecycle.Phase;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.Step;
|
import org.elasticsearch.xpack.core.indexlifecycle.Step;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.Step.StepKey;
|
import org.elasticsearch.xpack.core.indexlifecycle.Step.StepKey;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.TerminalPolicyStep;
|
import org.elasticsearch.xpack.core.indexlifecycle.TerminalPolicyStep;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.TestLifecycleType;
|
|
||||||
import org.elasticsearch.xpack.indexlifecycle.IndexLifecycleRunnerTests.MockClusterStateActionStep;
|
import org.elasticsearch.xpack.indexlifecycle.IndexLifecycleRunnerTests.MockClusterStateActionStep;
|
||||||
import org.elasticsearch.xpack.indexlifecycle.IndexLifecycleRunnerTests.MockClusterStateWaitStep;
|
import org.elasticsearch.xpack.indexlifecycle.IndexLifecycleRunnerTests.MockClusterStateWaitStep;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -44,6 +43,7 @@ import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicyTestsUtils.newTestLifecyclePolicy;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.sameInstance;
|
import static org.hamcrest.Matchers.sameInstance;
|
||||||
|
|
||||||
|
@ -84,11 +84,11 @@ public class ExecuteStepsUpdateTaskTests extends ESTestCase {
|
||||||
new MockAction(Arrays.asList(firstStep, allClusterSecondStep))));
|
new MockAction(Arrays.asList(firstStep, allClusterSecondStep))));
|
||||||
Phase invalidPhase = new Phase("invalid_phase", TimeValue.ZERO, Collections.singletonMap(MockAction.NAME,
|
Phase invalidPhase = new Phase("invalid_phase", TimeValue.ZERO, Collections.singletonMap(MockAction.NAME,
|
||||||
new MockAction(Arrays.asList(new MockClusterStateActionStep(firstStepKey, invalidStepKey)))));
|
new MockAction(Arrays.asList(new MockClusterStateActionStep(firstStepKey, invalidStepKey)))));
|
||||||
LifecyclePolicy mixedPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, mixedPolicyName,
|
LifecyclePolicy mixedPolicy = newTestLifecyclePolicy(mixedPolicyName,
|
||||||
Collections.singletonMap(mixedPhase.getName(), mixedPhase));
|
Collections.singletonMap(mixedPhase.getName(), mixedPhase));
|
||||||
LifecyclePolicy allClusterPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, allClusterPolicyName,
|
LifecyclePolicy allClusterPolicy = newTestLifecyclePolicy(allClusterPolicyName,
|
||||||
Collections.singletonMap(allClusterPhase.getName(), allClusterPhase));
|
Collections.singletonMap(allClusterPhase.getName(), allClusterPhase));
|
||||||
LifecyclePolicy invalidPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, invalidPolicyName,
|
LifecyclePolicy invalidPolicy = newTestLifecyclePolicy(invalidPolicyName,
|
||||||
Collections.singletonMap(invalidPhase.getName(), invalidPhase));
|
Collections.singletonMap(invalidPhase.getName(), invalidPhase));
|
||||||
Map<String, LifecyclePolicyMetadata> policyMap = new HashMap<>();
|
Map<String, LifecyclePolicyMetadata> policyMap = new HashMap<>();
|
||||||
policyMap.put(mixedPolicyName, new LifecyclePolicyMetadata(mixedPolicy, Collections.emptyMap()));
|
policyMap.put(mixedPolicyName, new LifecyclePolicyMetadata(mixedPolicy, Collections.emptyMap()));
|
||||||
|
|
|
@ -52,6 +52,7 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
|
||||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
|
import static org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicyTestsUtils.newLockableLifecyclePolicy;
|
||||||
import static org.hamcrest.CoreMatchers.not;
|
import static org.hamcrest.CoreMatchers.not;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.core.IsNull.nullValue;
|
import static org.hamcrest.core.IsNull.nullValue;
|
||||||
|
@ -112,7 +113,7 @@ public class IndexLifecycleInitialisationIT extends ESIntegTestCase {
|
||||||
steps.add(new ObservableClusterStateWaitStep(key, TerminalPolicyStep.KEY));
|
steps.add(new ObservableClusterStateWaitStep(key, TerminalPolicyStep.KEY));
|
||||||
Map<String, LifecycleAction> actions = Collections.singletonMap(ObservableAction.NAME, new ObservableAction(steps, true));
|
Map<String, LifecycleAction> actions = Collections.singletonMap(ObservableAction.NAME, new ObservableAction(steps, true));
|
||||||
Map<String, Phase> phases = Collections.singletonMap("mock", new Phase("mock", TimeValue.timeValueSeconds(0), actions));
|
Map<String, Phase> phases = Collections.singletonMap("mock", new Phase("mock", TimeValue.timeValueSeconds(0), actions));
|
||||||
lifecyclePolicy = new LifecyclePolicy(LockableLifecycleType.INSTANCE, "test", phases);
|
lifecyclePolicy = newLockableLifecyclePolicy("test", phases);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSingleNodeCluster() throws Exception {
|
public void testSingleNodeCluster() throws Exception {
|
||||||
|
|
|
@ -18,7 +18,9 @@ import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.protocol.xpack.indexlifecycle.OperationMode;
|
import org.elasticsearch.protocol.xpack.indexlifecycle.OperationMode;
|
||||||
import org.elasticsearch.test.AbstractDiffableSerializationTestCase;
|
import org.elasticsearch.test.AbstractDiffableSerializationTestCase;
|
||||||
|
import org.elasticsearch.xpack.core.indexlifecycle.AllocateAction;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.DeleteAction;
|
import org.elasticsearch.xpack.core.indexlifecycle.DeleteAction;
|
||||||
|
import org.elasticsearch.xpack.core.indexlifecycle.ForceMergeAction;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.IndexLifecycleMetadata;
|
import org.elasticsearch.xpack.core.indexlifecycle.IndexLifecycleMetadata;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.IndexLifecycleMetadata.IndexLifecycleMetadataDiff;
|
import org.elasticsearch.xpack.core.indexlifecycle.IndexLifecycleMetadata.IndexLifecycleMetadataDiff;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.LifecycleAction;
|
import org.elasticsearch.xpack.core.indexlifecycle.LifecycleAction;
|
||||||
|
@ -26,7 +28,10 @@ import org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicy;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicyMetadata;
|
import org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicyMetadata;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.LifecycleType;
|
import org.elasticsearch.xpack.core.indexlifecycle.LifecycleType;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.Phase;
|
import org.elasticsearch.xpack.core.indexlifecycle.Phase;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.TestLifecycleType;
|
import org.elasticsearch.xpack.core.indexlifecycle.ReadOnlyAction;
|
||||||
|
import org.elasticsearch.xpack.core.indexlifecycle.RolloverAction;
|
||||||
|
import org.elasticsearch.xpack.core.indexlifecycle.ShrinkAction;
|
||||||
|
import org.elasticsearch.xpack.core.indexlifecycle.TimeseriesLifecycleType;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -38,11 +43,20 @@ import java.util.Map;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import static org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicyTestsUtils.newTestLifecyclePolicy;
|
||||||
|
import static org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicyTestsUtils.randomTimeseriesLifecyclePolicy;
|
||||||
|
|
||||||
public class IndexLifecycleMetadataTests extends AbstractDiffableSerializationTestCase<MetaData.Custom> {
|
public class IndexLifecycleMetadataTests extends AbstractDiffableSerializationTestCase<MetaData.Custom> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IndexLifecycleMetadata createTestInstance() {
|
protected IndexLifecycleMetadata createTestInstance() {
|
||||||
return createTestInstance(randomInt(5), randomFrom(OperationMode.values()));
|
int numPolicies = randomIntBetween(1, 5);
|
||||||
|
Map<String, LifecyclePolicyMetadata> policies = new HashMap<>(numPolicies);
|
||||||
|
for (int i = 0; i < numPolicies; i++) {
|
||||||
|
LifecyclePolicy policy = randomTimeseriesLifecyclePolicy(randomAlphaOfLength(4) + i);
|
||||||
|
policies.put(policy.getName(), new LifecyclePolicyMetadata(policy, Collections.emptyMap()));
|
||||||
|
}
|
||||||
|
return new IndexLifecycleMetadata(policies, randomFrom(OperationMode.values()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,16 +72,31 @@ public class IndexLifecycleMetadataTests extends AbstractDiffableSerializationTe
|
||||||
@Override
|
@Override
|
||||||
protected NamedWriteableRegistry getNamedWriteableRegistry() {
|
protected NamedWriteableRegistry getNamedWriteableRegistry() {
|
||||||
return new NamedWriteableRegistry(
|
return new NamedWriteableRegistry(
|
||||||
Arrays.asList(new NamedWriteableRegistry.Entry(LifecycleAction.class, DeleteAction.NAME, DeleteAction::new),
|
Arrays.asList(
|
||||||
new NamedWriteableRegistry.Entry(LifecycleType.class, TestLifecycleType.TYPE, (in) -> TestLifecycleType.INSTANCE)));
|
new NamedWriteableRegistry.Entry(LifecycleType.class, TimeseriesLifecycleType.TYPE,
|
||||||
|
(in) -> TimeseriesLifecycleType.INSTANCE),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, AllocateAction.NAME, AllocateAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, DeleteAction.NAME, DeleteAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, ForceMergeAction.NAME, ForceMergeAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, ReadOnlyAction.NAME, ReadOnlyAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, RolloverAction.NAME, RolloverAction::new),
|
||||||
|
new NamedWriteableRegistry.Entry(LifecycleAction.class, ShrinkAction.NAME, ShrinkAction::new)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected NamedXContentRegistry xContentRegistry() {
|
protected NamedXContentRegistry xContentRegistry() {
|
||||||
List<NamedXContentRegistry.Entry> entries = new ArrayList<>(ClusterModule.getNamedXWriteables());
|
List<NamedXContentRegistry.Entry> entries = new ArrayList<>(ClusterModule.getNamedXWriteables());
|
||||||
entries.add(new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(DeleteAction.NAME), DeleteAction::parse));
|
entries.addAll(Arrays.asList(
|
||||||
entries.add(new NamedXContentRegistry.Entry(LifecycleType.class, new ParseField(TestLifecycleType.TYPE),
|
new NamedXContentRegistry.Entry(LifecycleType.class, new ParseField(TimeseriesLifecycleType.TYPE),
|
||||||
(p) -> TestLifecycleType.INSTANCE));
|
(p) -> TimeseriesLifecycleType.INSTANCE),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(AllocateAction.NAME), AllocateAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(DeleteAction.NAME), DeleteAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(ForceMergeAction.NAME), ForceMergeAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(ReadOnlyAction.NAME), ReadOnlyAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(RolloverAction.NAME), RolloverAction::parse),
|
||||||
|
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(ShrinkAction.NAME), ShrinkAction::parse)
|
||||||
|
));
|
||||||
return new NamedXContentRegistry(entries);
|
return new NamedXContentRegistry(entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,8 +108,7 @@ public class IndexLifecycleMetadataTests extends AbstractDiffableSerializationTe
|
||||||
OperationMode mode = metadata.getOperationMode();
|
OperationMode mode = metadata.getOperationMode();
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
String policyName = randomAlphaOfLength(10);
|
String policyName = randomAlphaOfLength(10);
|
||||||
policies.put(policyName, new LifecyclePolicyMetadata(
|
policies.put(policyName, new LifecyclePolicyMetadata(randomTimeseriesLifecyclePolicy(policyName), Collections.emptyMap()));
|
||||||
new LifecyclePolicy(TestLifecycleType.INSTANCE, policyName, Collections.emptyMap()), Collections.emptyMap()));
|
|
||||||
} else {
|
} else {
|
||||||
mode = randomValueOtherThan(metadata.getOperationMode(), () -> randomFrom(OperationMode.values()));
|
mode = randomValueOtherThan(metadata.getOperationMode(), () -> randomFrom(OperationMode.values()));
|
||||||
}
|
}
|
||||||
|
@ -120,8 +148,7 @@ public class IndexLifecycleMetadataTests extends AbstractDiffableSerializationTe
|
||||||
phases.put(phaseName, new Phase(phaseName, after, actions));
|
phases.put(phaseName, new Phase(phaseName, after, actions));
|
||||||
}
|
}
|
||||||
String policyName = randomAlphaOfLength(10);
|
String policyName = randomAlphaOfLength(10);
|
||||||
policies.put(policyName, new LifecyclePolicyMetadata(new LifecyclePolicy(TestLifecycleType.INSTANCE, policyName, phases),
|
policies.put(policyName, new LifecyclePolicyMetadata(newTestLifecyclePolicy(policyName, phases), Collections.emptyMap()));
|
||||||
Collections.emptyMap()));
|
|
||||||
}
|
}
|
||||||
return new IndexLifecycleMetadata(policies, mode);
|
return new IndexLifecycleMetadata(policies, mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ import org.elasticsearch.xpack.core.indexlifecycle.RolloverAction;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.Step;
|
import org.elasticsearch.xpack.core.indexlifecycle.Step;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.Step.StepKey;
|
import org.elasticsearch.xpack.core.indexlifecycle.Step.StepKey;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.TerminalPolicyStep;
|
import org.elasticsearch.xpack.core.indexlifecycle.TerminalPolicyStep;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.TestLifecycleType;
|
|
||||||
import org.mockito.ArgumentMatcher;
|
import org.mockito.ArgumentMatcher;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
|
@ -57,6 +56,7 @@ import java.util.SortedMap;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicyTestsUtils.newTestLifecyclePolicy;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
|
@ -863,7 +863,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
long now = randomNonNegativeLong();
|
long now = randomNonNegativeLong();
|
||||||
String indexName = randomAlphaOfLength(10);
|
String indexName = randomAlphaOfLength(10);
|
||||||
String newPolicyName = "new_policy";
|
String newPolicyName = "new_policy";
|
||||||
LifecyclePolicy newPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, newPolicyName, Collections.emptyMap());
|
LifecyclePolicy newPolicy = newTestLifecyclePolicy(newPolicyName, Collections.emptyMap());
|
||||||
StepKey currentStep = new StepKey("", "", "");
|
StepKey currentStep = new StepKey("", "", "");
|
||||||
Settings.Builder indexSettingsBuilder = Settings.builder();
|
Settings.Builder indexSettingsBuilder = Settings.builder();
|
||||||
ClusterState clusterState = buildClusterState(indexName, indexSettingsBuilder, Collections.emptyList());
|
ClusterState clusterState = buildClusterState(indexName, indexSettingsBuilder, Collections.emptyList());
|
||||||
|
@ -883,8 +883,8 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
String indexName = randomAlphaOfLength(10);
|
String indexName = randomAlphaOfLength(10);
|
||||||
String oldPolicyName = "old_policy";
|
String oldPolicyName = "old_policy";
|
||||||
String newPolicyName = "new_policy";
|
String newPolicyName = "new_policy";
|
||||||
LifecyclePolicy oldPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, oldPolicyName, Collections.emptyMap());
|
LifecyclePolicy oldPolicy = newTestLifecyclePolicy(oldPolicyName, Collections.emptyMap());
|
||||||
LifecyclePolicy newPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, newPolicyName, Collections.emptyMap());
|
LifecyclePolicy newPolicy = newTestLifecyclePolicy(newPolicyName, Collections.emptyMap());
|
||||||
StepKey currentStep = AbstractStepTestCase.randomStepKey();
|
StepKey currentStep = AbstractStepTestCase.randomStepKey();
|
||||||
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
||||||
.put(LifecycleSettings.LIFECYCLE_PHASE, currentStep.getPhase())
|
.put(LifecycleSettings.LIFECYCLE_PHASE, currentStep.getPhase())
|
||||||
|
@ -910,7 +910,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
String indexName = randomAlphaOfLength(10);
|
String indexName = randomAlphaOfLength(10);
|
||||||
String oldPolicyName = "old_policy";
|
String oldPolicyName = "old_policy";
|
||||||
String newPolicyName = "new_policy";
|
String newPolicyName = "new_policy";
|
||||||
LifecyclePolicy newPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, newPolicyName, Collections.emptyMap());
|
LifecyclePolicy newPolicy = new LifecyclePolicy(newPolicyName, Collections.emptyMap());
|
||||||
StepKey currentStep = new StepKey(randomAlphaOfLength(10), MockAction.NAME, randomAlphaOfLength(10));
|
StepKey currentStep = new StepKey(randomAlphaOfLength(10), MockAction.NAME, randomAlphaOfLength(10));
|
||||||
LifecyclePolicy oldPolicy = createPolicy(oldPolicyName, null, currentStep);
|
LifecyclePolicy oldPolicy = createPolicy(oldPolicyName, null, currentStep);
|
||||||
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
||||||
|
@ -976,7 +976,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
actions.put(unsafeAction.getWriteableName(), unsafeAction);
|
actions.put(unsafeAction.getWriteableName(), unsafeAction);
|
||||||
Phase phase = new Phase(currentStep.getPhase(), TimeValue.timeValueMillis(0), actions);
|
Phase phase = new Phase(currentStep.getPhase(), TimeValue.timeValueMillis(0), actions);
|
||||||
phases.put(phase.getName(), phase);
|
phases.put(phase.getName(), phase);
|
||||||
LifecyclePolicy newPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, newPolicyName, phases);
|
LifecyclePolicy newPolicy = newTestLifecyclePolicy(newPolicyName, phases);
|
||||||
|
|
||||||
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
||||||
.put(LifecycleSettings.LIFECYCLE_PHASE, currentStep.getPhase())
|
.put(LifecycleSettings.LIFECYCLE_PHASE, currentStep.getPhase())
|
||||||
|
@ -1019,15 +1019,14 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
Phase phase = new Phase(unsafeStep.getPhase(), TimeValue.timeValueMillis(0), actions);
|
Phase phase = new Phase(unsafeStep.getPhase(), TimeValue.timeValueMillis(0), actions);
|
||||||
phases.put(phase.getName(), phase);
|
phases.put(phase.getName(), phase);
|
||||||
}
|
}
|
||||||
LifecyclePolicy oldPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, policyName, phases);
|
return newTestLifecyclePolicy(policyName, phases);
|
||||||
return oldPolicy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCanUpdatePolicy() {
|
public void testCanUpdatePolicy() {
|
||||||
String indexName = randomAlphaOfLength(10);
|
String indexName = randomAlphaOfLength(10);
|
||||||
String oldPolicyName = "old_policy";
|
String oldPolicyName = "old_policy";
|
||||||
String newPolicyName = "new_policy";
|
String newPolicyName = "new_policy";
|
||||||
LifecyclePolicy newPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, newPolicyName, Collections.emptyMap());
|
LifecyclePolicy newPolicy = newTestLifecyclePolicy(newPolicyName, Collections.emptyMap());
|
||||||
StepKey currentStep = new StepKey(randomAlphaOfLength(10), MockAction.NAME, randomAlphaOfLength(10));
|
StepKey currentStep = new StepKey(randomAlphaOfLength(10), MockAction.NAME, randomAlphaOfLength(10));
|
||||||
LifecyclePolicy oldPolicy = createPolicy(oldPolicyName, currentStep, null);
|
LifecyclePolicy oldPolicy = createPolicy(oldPolicyName, currentStep, null);
|
||||||
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
||||||
|
@ -1047,7 +1046,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
String indexName = randomAlphaOfLength(10);
|
String indexName = randomAlphaOfLength(10);
|
||||||
String oldPolicyName = "old_policy";
|
String oldPolicyName = "old_policy";
|
||||||
String newPolicyName = "new_policy";
|
String newPolicyName = "new_policy";
|
||||||
LifecyclePolicy newPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, newPolicyName, Collections.emptyMap());
|
LifecyclePolicy newPolicy = newTestLifecyclePolicy(newPolicyName, Collections.emptyMap());
|
||||||
StepKey currentStep = new StepKey(randomAlphaOfLength(10), MockAction.NAME, randomAlphaOfLength(10));
|
StepKey currentStep = new StepKey(randomAlphaOfLength(10), MockAction.NAME, randomAlphaOfLength(10));
|
||||||
LifecyclePolicy oldPolicy = createPolicy(oldPolicyName, null, currentStep);
|
LifecyclePolicy oldPolicy = createPolicy(oldPolicyName, null, currentStep);
|
||||||
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
||||||
|
@ -1101,7 +1100,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
actions.put(unsafeAction.getWriteableName(), unsafeAction);
|
actions.put(unsafeAction.getWriteableName(), unsafeAction);
|
||||||
Phase phase = new Phase(currentStep.getPhase(), TimeValue.timeValueMillis(0), actions);
|
Phase phase = new Phase(currentStep.getPhase(), TimeValue.timeValueMillis(0), actions);
|
||||||
phases.put(phase.getName(), phase);
|
phases.put(phase.getName(), phase);
|
||||||
LifecyclePolicy newPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, newPolicyName, phases);
|
LifecyclePolicy newPolicy = newTestLifecyclePolicy(newPolicyName, phases);
|
||||||
|
|
||||||
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
||||||
.put(LifecycleSettings.LIFECYCLE_PHASE, currentStep.getPhase())
|
.put(LifecycleSettings.LIFECYCLE_PHASE, currentStep.getPhase())
|
||||||
|
@ -1120,8 +1119,8 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
String indexName = randomAlphaOfLength(10);
|
String indexName = randomAlphaOfLength(10);
|
||||||
String oldPolicyName = "old_policy";
|
String oldPolicyName = "old_policy";
|
||||||
String newPolicyName = "new_policy";
|
String newPolicyName = "new_policy";
|
||||||
LifecyclePolicy oldPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, oldPolicyName, Collections.emptyMap());
|
LifecyclePolicy oldPolicy = newTestLifecyclePolicy(oldPolicyName, Collections.emptyMap());
|
||||||
LifecyclePolicy newPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, newPolicyName, Collections.emptyMap());
|
LifecyclePolicy newPolicy = newTestLifecyclePolicy(newPolicyName, Collections.emptyMap());
|
||||||
Settings.Builder indexSettingsBuilder = Settings.builder();
|
Settings.Builder indexSettingsBuilder = Settings.builder();
|
||||||
List<LifecyclePolicyMetadata> policyMetadatas = new ArrayList<>();
|
List<LifecyclePolicyMetadata> policyMetadatas = new ArrayList<>();
|
||||||
policyMetadatas.add(new LifecyclePolicyMetadata(oldPolicy, Collections.emptyMap()));
|
policyMetadatas.add(new LifecyclePolicyMetadata(oldPolicy, Collections.emptyMap()));
|
||||||
|
@ -1136,8 +1135,8 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
String indexName = randomAlphaOfLength(10);
|
String indexName = randomAlphaOfLength(10);
|
||||||
String oldPolicyName = "old_policy";
|
String oldPolicyName = "old_policy";
|
||||||
String newPolicyName = "new_policy";
|
String newPolicyName = "new_policy";
|
||||||
LifecyclePolicy oldPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, oldPolicyName, Collections.emptyMap());
|
LifecyclePolicy oldPolicy = newTestLifecyclePolicy(oldPolicyName, Collections.emptyMap());
|
||||||
LifecyclePolicy newPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, newPolicyName, Collections.emptyMap());
|
LifecyclePolicy newPolicy = newTestLifecyclePolicy(newPolicyName, Collections.emptyMap());
|
||||||
StepKey currentStep = new StepKey(randomAlphaOfLength(10), ShrinkAction.NAME, randomAlphaOfLength(10));
|
StepKey currentStep = new StepKey(randomAlphaOfLength(10), ShrinkAction.NAME, randomAlphaOfLength(10));
|
||||||
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, "different_policy")
|
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, "different_policy")
|
||||||
.put(LifecycleSettings.LIFECYCLE_PHASE, currentStep.getPhase())
|
.put(LifecycleSettings.LIFECYCLE_PHASE, currentStep.getPhase())
|
||||||
|
@ -1155,7 +1154,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
public void testCanUpdatePolicyMultipleIndexesUpdateAllowed() {
|
public void testCanUpdatePolicyMultipleIndexesUpdateAllowed() {
|
||||||
String oldPolicyName = "old_policy";
|
String oldPolicyName = "old_policy";
|
||||||
String newPolicyName = "new_policy";
|
String newPolicyName = "new_policy";
|
||||||
LifecyclePolicy newPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, newPolicyName, Collections.emptyMap());
|
LifecyclePolicy newPolicy = newTestLifecyclePolicy(newPolicyName, Collections.emptyMap());
|
||||||
|
|
||||||
String index1Name = randomAlphaOfLength(10);
|
String index1Name = randomAlphaOfLength(10);
|
||||||
StepKey currentStep1 = new StepKey(randomAlphaOfLength(10), MockAction.NAME, randomAlphaOfLength(10));
|
StepKey currentStep1 = new StepKey(randomAlphaOfLength(10), MockAction.NAME, randomAlphaOfLength(10));
|
||||||
|
@ -1208,7 +1207,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
public void testCanUpdatePolicyMultipleIndexesUpdateForbidden() {
|
public void testCanUpdatePolicyMultipleIndexesUpdateForbidden() {
|
||||||
String oldPolicyName = "old_policy";
|
String oldPolicyName = "old_policy";
|
||||||
String newPolicyName = "new_policy";
|
String newPolicyName = "new_policy";
|
||||||
LifecyclePolicy newPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, newPolicyName, Collections.emptyMap());
|
LifecyclePolicy newPolicy = newTestLifecyclePolicy(newPolicyName, Collections.emptyMap());
|
||||||
|
|
||||||
String index1Name = randomAlphaOfLength(10);
|
String index1Name = randomAlphaOfLength(10);
|
||||||
StepKey currentStep1 = new StepKey(randomAlphaOfLength(10), MockAction.NAME, randomAlphaOfLength(10));
|
StepKey currentStep1 = new StepKey(randomAlphaOfLength(10), MockAction.NAME, randomAlphaOfLength(10));
|
||||||
|
@ -1297,7 +1296,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
public void testRemovePolicyForIndexIndexDoesntExist() {
|
public void testRemovePolicyForIndexIndexDoesntExist() {
|
||||||
String indexName = randomAlphaOfLength(10);
|
String indexName = randomAlphaOfLength(10);
|
||||||
String oldPolicyName = "old_policy";
|
String oldPolicyName = "old_policy";
|
||||||
LifecyclePolicy oldPolicy = new LifecyclePolicy(TestLifecycleType.INSTANCE, oldPolicyName, Collections.emptyMap());
|
LifecyclePolicy oldPolicy = newTestLifecyclePolicy(oldPolicyName, Collections.emptyMap());
|
||||||
StepKey currentStep = AbstractStepTestCase.randomStepKey();
|
StepKey currentStep = AbstractStepTestCase.randomStepKey();
|
||||||
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, oldPolicyName)
|
||||||
.put(LifecycleSettings.LIFECYCLE_PHASE, currentStep.getPhase())
|
.put(LifecycleSettings.LIFECYCLE_PHASE, currentStep.getPhase())
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.xpack.core.indexlifecycle.MockAction;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.Phase;
|
import org.elasticsearch.xpack.core.indexlifecycle.Phase;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.ShrinkAction;
|
import org.elasticsearch.xpack.core.indexlifecycle.ShrinkAction;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.Step;
|
import org.elasticsearch.xpack.core.indexlifecycle.Step;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.TestLifecycleType;
|
|
||||||
import org.elasticsearch.xpack.core.scheduler.SchedulerEngine;
|
import org.elasticsearch.xpack.core.scheduler.SchedulerEngine;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -51,6 +50,7 @@ import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import static org.elasticsearch.node.Node.NODE_MASTER_SETTING;
|
import static org.elasticsearch.node.Node.NODE_MASTER_SETTING;
|
||||||
import static org.elasticsearch.xpack.core.indexlifecycle.AbstractStepTestCase.randomStepKey;
|
import static org.elasticsearch.xpack.core.indexlifecycle.AbstractStepTestCase.randomStepKey;
|
||||||
|
import static org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicyTestsUtils.newTestLifecyclePolicy;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
import static org.mockito.Matchers.anyString;
|
import static org.mockito.Matchers.anyString;
|
||||||
|
@ -284,8 +284,7 @@ public class IndexLifecycleServiceTests extends ESTestCase {
|
||||||
new IndexLifecycleRunnerTests.MockClusterStateActionStep(randomStepKey(), randomStepKey());
|
new IndexLifecycleRunnerTests.MockClusterStateActionStep(randomStepKey(), randomStepKey());
|
||||||
MockAction mockAction = new MockAction(Collections.singletonList(mockStep));
|
MockAction mockAction = new MockAction(Collections.singletonList(mockStep));
|
||||||
Phase phase = new Phase("phase", TimeValue.ZERO, Collections.singletonMap("action", mockAction));
|
Phase phase = new Phase("phase", TimeValue.ZERO, Collections.singletonMap("action", mockAction));
|
||||||
LifecyclePolicy policy = new LifecyclePolicy(TestLifecycleType.INSTANCE, policyName,
|
LifecyclePolicy policy = newTestLifecyclePolicy(policyName, Collections.singletonMap(phase.getName(), phase));
|
||||||
Collections.singletonMap(phase.getName(), phase));
|
|
||||||
SortedMap<String, LifecyclePolicyMetadata> policyMap = new TreeMap<>();
|
SortedMap<String, LifecyclePolicyMetadata> policyMap = new TreeMap<>();
|
||||||
policyMap.put(policyName, new LifecyclePolicyMetadata(policy, Collections.emptyMap()));
|
policyMap.put(policyName, new LifecyclePolicyMetadata(policy, Collections.emptyMap()));
|
||||||
Index index = new Index(randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20));
|
Index index = new Index(randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20));
|
||||||
|
@ -314,8 +313,7 @@ public class IndexLifecycleServiceTests extends ESTestCase {
|
||||||
new IndexLifecycleRunnerTests.MockClusterStateActionStep(mockShrinkStep, randomStepKey());
|
new IndexLifecycleRunnerTests.MockClusterStateActionStep(mockShrinkStep, randomStepKey());
|
||||||
MockAction mockAction = new MockAction(Collections.singletonList(mockStep));
|
MockAction mockAction = new MockAction(Collections.singletonList(mockStep));
|
||||||
Phase phase = new Phase("phase", TimeValue.ZERO, Collections.singletonMap("action", mockAction));
|
Phase phase = new Phase("phase", TimeValue.ZERO, Collections.singletonMap("action", mockAction));
|
||||||
LifecyclePolicy policy = new LifecyclePolicy(TestLifecycleType.INSTANCE, policyName,
|
LifecyclePolicy policy = newTestLifecyclePolicy(policyName, Collections.singletonMap(phase.getName(), phase));
|
||||||
Collections.singletonMap(phase.getName(), phase));
|
|
||||||
SortedMap<String, LifecyclePolicyMetadata> policyMap = new TreeMap<>();
|
SortedMap<String, LifecyclePolicyMetadata> policyMap = new TreeMap<>();
|
||||||
policyMap.put(policyName, new LifecyclePolicyMetadata(policy, Collections.emptyMap()));
|
policyMap.put(policyName, new LifecyclePolicyMetadata(policy, Collections.emptyMap()));
|
||||||
Index index = new Index(randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20));
|
Index index = new Index(randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20));
|
||||||
|
@ -355,8 +353,7 @@ public class IndexLifecycleServiceTests extends ESTestCase {
|
||||||
new IndexLifecycleRunnerTests.MockClusterStateActionStep(currentStepKey, randomStepKey());
|
new IndexLifecycleRunnerTests.MockClusterStateActionStep(currentStepKey, randomStepKey());
|
||||||
MockAction mockAction = new MockAction(Collections.singletonList(mockStep));
|
MockAction mockAction = new MockAction(Collections.singletonList(mockStep));
|
||||||
Phase phase = new Phase("phase", TimeValue.ZERO, Collections.singletonMap("action", mockAction));
|
Phase phase = new Phase("phase", TimeValue.ZERO, Collections.singletonMap("action", mockAction));
|
||||||
LifecyclePolicy policy = new LifecyclePolicy(TestLifecycleType.INSTANCE, policyName,
|
LifecyclePolicy policy = newTestLifecyclePolicy(policyName, Collections.singletonMap(phase.getName(), phase));
|
||||||
Collections.singletonMap(phase.getName(), phase));
|
|
||||||
SortedMap<String, LifecyclePolicyMetadata> policyMap = new TreeMap<>();
|
SortedMap<String, LifecyclePolicyMetadata> policyMap = new TreeMap<>();
|
||||||
policyMap.put(policyName, new LifecyclePolicyMetadata(policy, Collections.emptyMap()));
|
policyMap.put(policyName, new LifecyclePolicyMetadata(policy, Collections.emptyMap()));
|
||||||
Index index = new Index(randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20));
|
Index index = new Index(randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20));
|
||||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.xpack.core.indexlifecycle.ReadOnlyAction;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.ShrinkAction;
|
import org.elasticsearch.xpack.core.indexlifecycle.ShrinkAction;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.Step.StepKey;
|
import org.elasticsearch.xpack.core.indexlifecycle.Step.StepKey;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.TerminalPolicyStep;
|
import org.elasticsearch.xpack.core.indexlifecycle.TerminalPolicyStep;
|
||||||
import org.elasticsearch.xpack.core.indexlifecycle.TimeseriesLifecycleType;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -172,8 +171,7 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase {
|
||||||
|
|
||||||
private void createNewSingletonPolicy(String phaseName, LifecycleAction action) throws IOException {
|
private void createNewSingletonPolicy(String phaseName, LifecycleAction action) throws IOException {
|
||||||
Phase phase = new Phase(phaseName, TimeValue.ZERO, singletonMap(action.getWriteableName(), action));
|
Phase phase = new Phase(phaseName, TimeValue.ZERO, singletonMap(action.getWriteableName(), action));
|
||||||
LifecyclePolicy lifecyclePolicy =
|
LifecyclePolicy lifecyclePolicy = new LifecyclePolicy(policy, singletonMap(phase.getName(), phase));
|
||||||
new LifecyclePolicy(TimeseriesLifecycleType.INSTANCE, policy, singletonMap(phase.getName(), phase));
|
|
||||||
XContentBuilder builder = jsonBuilder();
|
XContentBuilder builder = jsonBuilder();
|
||||||
lifecyclePolicy.toXContent(builder, null);
|
lifecyclePolicy.toXContent(builder, null);
|
||||||
final StringEntity entity = new StringEntity(
|
final StringEntity entity = new StringEntity(
|
||||||
|
|
|
@ -23,7 +23,6 @@ setup:
|
||||||
body: |
|
body: |
|
||||||
{
|
{
|
||||||
"policy": {
|
"policy": {
|
||||||
"type": "timeseries",
|
|
||||||
"phases": {
|
"phases": {
|
||||||
"warm": {
|
"warm": {
|
||||||
"after": "10s",
|
"after": "10s",
|
||||||
|
@ -47,7 +46,6 @@ setup:
|
||||||
acknowledge: true
|
acknowledge: true
|
||||||
ilm.get_lifecycle:
|
ilm.get_lifecycle:
|
||||||
lifecycle: "my_timeseries_lifecycle"
|
lifecycle: "my_timeseries_lifecycle"
|
||||||
- match: { my_timeseries_lifecycle.type: "timeseries" }
|
|
||||||
- match: { my_timeseries_lifecycle.phases.warm.after: "10s" }
|
- match: { my_timeseries_lifecycle.phases.warm.after: "10s" }
|
||||||
- match: { my_timeseries_lifecycle.phases.delete.after: "30s" }
|
- match: { my_timeseries_lifecycle.phases.delete.after: "30s" }
|
||||||
|
|
||||||
|
@ -70,7 +68,6 @@ setup:
|
||||||
body: |
|
body: |
|
||||||
{
|
{
|
||||||
"policy": {
|
"policy": {
|
||||||
"type": "timeseries",
|
|
||||||
"phases": {
|
"phases": {
|
||||||
"warm": {
|
"warm": {
|
||||||
"after": "10s",
|
"after": "10s",
|
||||||
|
@ -94,7 +91,6 @@ setup:
|
||||||
acknowledge: true
|
acknowledge: true
|
||||||
ilm.get_lifecycle:
|
ilm.get_lifecycle:
|
||||||
lifecycle: "my_timeseries_lifecycle"
|
lifecycle: "my_timeseries_lifecycle"
|
||||||
- match: { my_timeseries_lifecycle.type: "timeseries" }
|
|
||||||
- match: { my_timeseries_lifecycle.phases.warm.after: "10s" }
|
- match: { my_timeseries_lifecycle.phases.warm.after: "10s" }
|
||||||
- match: { my_timeseries_lifecycle.phases.delete.after: "30s" }
|
- match: { my_timeseries_lifecycle.phases.delete.after: "30s" }
|
||||||
|
|
||||||
|
@ -120,7 +116,6 @@ setup:
|
||||||
body: |
|
body: |
|
||||||
{
|
{
|
||||||
"policy": {
|
"policy": {
|
||||||
"type": "timeseries",
|
|
||||||
"phases": {
|
"phases": {
|
||||||
"warm": {
|
"warm": {
|
||||||
"after": "300s",
|
"after": "300s",
|
||||||
|
@ -144,7 +139,6 @@ setup:
|
||||||
acknowledge: true
|
acknowledge: true
|
||||||
ilm.get_lifecycle:
|
ilm.get_lifecycle:
|
||||||
lifecycle: "my_timeseries_lifecycle"
|
lifecycle: "my_timeseries_lifecycle"
|
||||||
- match: { my_timeseries_lifecycle.type: "timeseries" }
|
|
||||||
- match: { my_timeseries_lifecycle.phases.warm.after: "300s" }
|
- match: { my_timeseries_lifecycle.phases.warm.after: "300s" }
|
||||||
- match: { my_timeseries_lifecycle.phases.delete.after: "600s" }
|
- match: { my_timeseries_lifecycle.phases.delete.after: "600s" }
|
||||||
|
|
||||||
|
@ -176,7 +170,6 @@ setup:
|
||||||
body: |
|
body: |
|
||||||
{
|
{
|
||||||
"policy": {
|
"policy": {
|
||||||
"type": "timeseries",
|
|
||||||
"phases": {
|
"phases": {
|
||||||
"warm": {
|
"warm": {
|
||||||
"after": "10s",
|
"after": "10s",
|
||||||
|
@ -200,7 +193,6 @@ setup:
|
||||||
acknowledge: true
|
acknowledge: true
|
||||||
ilm.get_lifecycle:
|
ilm.get_lifecycle:
|
||||||
lifecycle: "my_timeseries_lifecycle"
|
lifecycle: "my_timeseries_lifecycle"
|
||||||
- match: { my_timeseries_lifecycle.type: "timeseries" }
|
|
||||||
- match: { my_timeseries_lifecycle.phases.warm.after: "10s" }
|
- match: { my_timeseries_lifecycle.phases.warm.after: "10s" }
|
||||||
- match: { my_timeseries_lifecycle.phases.delete.after: "30s" }
|
- match: { my_timeseries_lifecycle.phases.delete.after: "30s" }
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ setup:
|
||||||
body: |
|
body: |
|
||||||
{
|
{
|
||||||
"policy": {
|
"policy": {
|
||||||
"type": "timeseries",
|
|
||||||
"phases": {
|
"phases": {
|
||||||
"warm": {
|
"warm": {
|
||||||
"after": "1000s",
|
"after": "1000s",
|
||||||
|
|
|
@ -11,7 +11,6 @@ setup:
|
||||||
body: |
|
body: |
|
||||||
{
|
{
|
||||||
"policy": {
|
"policy": {
|
||||||
"type": "timeseries",
|
|
||||||
"phases": {
|
"phases": {
|
||||||
"warm": {
|
"warm": {
|
||||||
"after": "1000s",
|
"after": "1000s",
|
||||||
|
|
|
@ -10,7 +10,6 @@ setup:
|
||||||
body: |
|
body: |
|
||||||
{
|
{
|
||||||
"policy": {
|
"policy": {
|
||||||
"type": "timeseries",
|
|
||||||
"phases": {
|
"phases": {
|
||||||
"warm": {
|
"warm": {
|
||||||
"after": "1000s",
|
"after": "1000s",
|
||||||
|
|
|
@ -10,7 +10,6 @@ setup:
|
||||||
body: |
|
body: |
|
||||||
{
|
{
|
||||||
"policy": {
|
"policy": {
|
||||||
"type": "timeseries",
|
|
||||||
"phases": {
|
"phases": {
|
||||||
"warm": {
|
"warm": {
|
||||||
"after": "1000s",
|
"after": "1000s",
|
||||||
|
@ -40,7 +39,6 @@ setup:
|
||||||
body: |
|
body: |
|
||||||
{
|
{
|
||||||
"policy": {
|
"policy": {
|
||||||
"type": "timeseries",
|
|
||||||
"phases": {
|
"phases": {
|
||||||
"warm": {
|
"warm": {
|
||||||
"after": "1000s",
|
"after": "1000s",
|
||||||
|
|
|
@ -17,7 +17,6 @@ setup:
|
||||||
body: |
|
body: |
|
||||||
{
|
{
|
||||||
"policy": {
|
"policy": {
|
||||||
"type": "timeseries",
|
|
||||||
"phases": {
|
"phases": {
|
||||||
"warm": {
|
"warm": {
|
||||||
"after": "10s",
|
"after": "10s",
|
||||||
|
|
|
@ -10,7 +10,6 @@ setup:
|
||||||
body: |
|
body: |
|
||||||
{
|
{
|
||||||
"policy": {
|
"policy": {
|
||||||
"type": "timeseries",
|
|
||||||
"phases": {
|
"phases": {
|
||||||
"warm": {
|
"warm": {
|
||||||
"after": "1000s",
|
"after": "1000s",
|
||||||
|
@ -40,7 +39,6 @@ setup:
|
||||||
body: |
|
body: |
|
||||||
{
|
{
|
||||||
"policy": {
|
"policy": {
|
||||||
"type": "timeseries",
|
|
||||||
"phases": {
|
"phases": {
|
||||||
"warm": {
|
"warm": {
|
||||||
"after": "1000s",
|
"after": "1000s",
|
||||||
|
|
Loading…
Reference in New Issue