[ML] Fix streaming the process update request (elastic/x-pack-elasticsearch#2928)
Original commit: elastic/x-pack-elasticsearch@cf76c13a2b
This commit is contained in:
parent
17ae4899c8
commit
cba4421a75
|
@ -142,7 +142,7 @@ public class UpdateProcessAction extends
|
||||||
super.readFrom(in);
|
super.readFrom(in);
|
||||||
modelPlotConfig = in.readOptionalWriteable(ModelPlotConfig::new);
|
modelPlotConfig = in.readOptionalWriteable(ModelPlotConfig::new);
|
||||||
if (in.readBoolean()) {
|
if (in.readBoolean()) {
|
||||||
in.readList(JobUpdate.DetectorUpdate::new);
|
detectorUpdates = in.readList(JobUpdate.DetectorUpdate::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.elasticsearch.test.AbstractStreamableTestCase;
|
||||||
import org.elasticsearch.xpack.ml.job.config.JobUpdate;
|
import org.elasticsearch.xpack.ml.job.config.JobUpdate;
|
||||||
import org.elasticsearch.xpack.ml.job.config.ModelPlotConfig;
|
import org.elasticsearch.xpack.ml.job.config.ModelPlotConfig;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class UpdateProcessActionRequestTests extends AbstractStreamableTestCase<UpdateProcessAction.Request> {
|
public class UpdateProcessActionRequestTests extends AbstractStreamableTestCase<UpdateProcessAction.Request> {
|
||||||
|
@ -22,9 +23,10 @@ public class UpdateProcessActionRequestTests extends AbstractStreamableTestCase<
|
||||||
}
|
}
|
||||||
List<JobUpdate.DetectorUpdate> updates = null;
|
List<JobUpdate.DetectorUpdate> updates = null;
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
|
updates = new ArrayList<>();
|
||||||
int detectorUpdateCount = randomIntBetween(0, 5);
|
int detectorUpdateCount = randomIntBetween(0, 5);
|
||||||
for (int i = 0; i < detectorUpdateCount; i++) {
|
for (int i = 0; i < detectorUpdateCount; i++) {
|
||||||
new JobUpdate.DetectorUpdate(randomInt(), randomAlphaOfLength(10), null);
|
updates.add(new JobUpdate.DetectorUpdate(randomInt(), randomAlphaOfLength(10), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new UpdateProcessAction.Request(randomAlphaOfLength(10), config, updates);
|
return new UpdateProcessAction.Request(randomAlphaOfLength(10), config, updates);
|
||||||
|
|
Loading…
Reference in New Issue