[ML][Data Frame] have DataFrameTransformConfigUpdate#apply set Version (#45391) (#45400)

This commit is contained in:
Benjamin Trent 2019-08-09 14:32:49 -05:00 committed by GitHub
parent bf4da6c6ad
commit fac1a6f8e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -447,6 +447,11 @@ public class DataFrameTransformConfig extends AbstractDiffable<DataFrameTransfor
return this;
}
Builder setVersion(Version version) {
this.transformVersion = version;
return this;
}
public DataFrameTransformConfig build() {
return new DataFrameTransformConfig(id,
source,

View File

@ -7,6 +7,7 @@
package org.elasticsearch.xpack.core.dataframe.transforms;
import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.Version;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
@ -248,6 +249,7 @@ public class DataFrameTransformConfigUpdate implements Writeable, ToXContentObje
if (headers != null) {
builder.setHeaders(headers);
}
builder.setVersion(Version.CURRENT);
return builder.build();
}
}

View File

@ -87,7 +87,7 @@ public class DataFrameTransformConfigUpdateTests extends AbstractSerializingData
PivotConfigTests.randomPivotConfig(),
randomBoolean() ? null : randomAlphaOfLengthBetween(1, 1000),
randomBoolean() ? null : Instant.now(),
randomBoolean() ? null : Version.CURRENT.toString());
randomBoolean() ? null : Version.V_7_2_0.toString());
DataFrameTransformConfigUpdate update = new DataFrameTransformConfigUpdate(null, null, null, null, null);
assertThat(config, equalTo(update.apply(config)));
@ -108,6 +108,7 @@ public class DataFrameTransformConfigUpdateTests extends AbstractSerializingData
assertThat(updatedConfig.getSyncConfig(), equalTo(syncConfig));
assertThat(updatedConfig.getDescription(), equalTo(newDescription));
assertThat(updatedConfig.getHeaders(), equalTo(headers));
assertThat(updatedConfig.getVersion(), equalTo(Version.CURRENT));
}
public void testApplyWithSyncChange() {