[ML] Include all fields in Job copy constructor
Fields were missing from the job's copy constructor. This was the cause of intermittent test failures. Original commit: elastic/x-pack-elasticsearch@3cd705ab3c
This commit is contained in:
parent
0e44683de6
commit
b9f83da5ac
|
@ -515,6 +515,7 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
|
|||
this.id = job.getId();
|
||||
this.description = job.getDescription();
|
||||
this.analysisConfig = job.getAnalysisConfig();
|
||||
this.analysisLimits = job.getAnalysisLimits();
|
||||
this.dataDescription = job.getDataDescription();
|
||||
this.createTime = job.getCreateTime();
|
||||
this.finishedTime = job.getFinishedTime();
|
||||
|
@ -522,9 +523,12 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
|
|||
this.modelDebugConfig = job.getModelDebugConfig();
|
||||
this.renormalizationWindowDays = job.getRenormalizationWindowDays();
|
||||
this.backgroundPersistInterval = job.getBackgroundPersistInterval();
|
||||
this.modelSnapshotRetentionDays = job.getModelSnapshotRetentionDays();
|
||||
this.resultsRetentionDays = job.getResultsRetentionDays();
|
||||
this.customSettings = job.getCustomSettings();
|
||||
this.modelSnapshotId = job.getModelSnapshotId();
|
||||
this.resultsIndexName = job.getResultsIndexName();
|
||||
this.deleted = job.isDeleted();
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
|
|
|
@ -95,6 +95,14 @@ public class DatafeedConfigTests extends AbstractSerializingTestCase<DatafeedCon
|
|||
return DatafeedConfig.PARSER.apply(parser, null).build();
|
||||
}
|
||||
|
||||
public void testCopyConstructor() {
|
||||
for (int i = 0; i < NUMBER_OF_TESTQUERIES; i++) {
|
||||
DatafeedConfig datafeedConfig = createTestInstance();
|
||||
DatafeedConfig copy = new DatafeedConfig.Builder(datafeedConfig).build();
|
||||
assertEquals(datafeedConfig, copy);
|
||||
}
|
||||
}
|
||||
|
||||
public void testFillDefaults() {
|
||||
DatafeedConfig.Builder expectedDatafeedConfig = new DatafeedConfig.Builder("datafeed1", "job1");
|
||||
expectedDatafeedConfig.setIndexes(Arrays.asList("index"));
|
||||
|
|
|
@ -195,6 +195,14 @@ public class JobTests extends AbstractSerializingTestCase<Job> {
|
|||
|
||||
// JobConfigurationVerifierTests:
|
||||
|
||||
public void testCopyConstructor() {
|
||||
for (int i = 0; i < NUMBER_OF_TESTQUERIES; i++) {
|
||||
Job job = createTestInstance();
|
||||
Job copy = new Job.Builder(job).build();
|
||||
assertEquals(job, copy);
|
||||
}
|
||||
}
|
||||
|
||||
public void testCheckValidId_IdTooLong() {
|
||||
Job.Builder builder = buildJobBuilder("foo");
|
||||
builder.setId("averyveryveryaveryveryveryaveryveryveryaveryveryveryaveryveryveryaveryveryverylongid");
|
||||
|
|
Loading…
Reference in New Issue