Backport #12009 to 7.x branch, bugfix in pipeline reload

fix Settings equality test which broke the PipelineConfig equality
This commit is contained in:
Colin Surprenant 2020-06-10 22:12:12 -04:00 committed by J.A.R.V.I.S. - an Elastic git bot
parent 41272371a5
commit 659ef33f72
2 changed files with 6 additions and 2 deletions

View file

@ -126,7 +126,7 @@ public final class PipelineConfig {
PipelineConfig cother = (PipelineConfig) other;
return configHash().equals(cother.configHash()) &&
this.pipelineId.equals(cother.pipelineId) &&
this.settings.eql(cother.settings);
this.settings.equals(cother.settings);
}
@Override

View file

@ -44,7 +44,7 @@ public class PipelineConfigTest extends RubyEnvTestCase {
private final static RubyObject SETTINGS = (RubyObject) RubyUtil.RUBY.evalScriptlet(
"require 'logstash/environment'\n" + // this is needed to register "pipeline.system" setting
"require 'logstash/settings'\n" +
"LogStash::SETTINGS");;
"LogStash::SETTINGS");
private PipelineConfig sut;
private SourceWithMetadata[] orderedConfigParts;
public static final String PIPELINE_CONFIG_PART_2 =
@ -101,6 +101,10 @@ public class PipelineConfigTest extends RubyEnvTestCase {
PipelineConfig anotherExactPipeline = new PipelineConfig(source, pipelineIdSym, toRubyArray(orderedConfigParts), SETTINGS);
assertEquals(anotherExactPipeline, sut);
final RubyObject CLONED_SETTINGS = (RubyObject)SETTINGS.callMethod("clone");
PipelineConfig anotherExactPipelineWithClonedSettings = new PipelineConfig(source, pipelineIdSym, toRubyArray(orderedConfigParts), CLONED_SETTINGS);
assertEquals(anotherExactPipelineWithClonedSettings, sut);
PipelineConfig notMatchingPipeline = new PipelineConfig(source, pipelineIdSym, RubyArray.newEmptyArray(RubyUtil.RUBY), SETTINGS);
assertNotEquals(notMatchingPipeline, sut);