Skip to content

Commit

Permalink
fix Settings equality test which broke the PipelineConfig equality (e…
Browse files Browse the repository at this point in the history
  • Loading branch information
colinsurprenant authored Jun 11, 2020
1 parent 2b0ae1a commit 757bf6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public boolean equals(Object other) {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void describeTo(Description description) {
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 =
Expand Down Expand Up @@ -126,6 +126,10 @@ public void testObjectEqualityOnConfigHashAndPipelineId() {
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);

Expand Down

0 comments on commit 757bf6b

Please sign in to comment.