Skip to content

assertIngestDocument() is weaker than it appears #28492

Closed
@DaveCTurner

Description

@DaveCTurner

It seems that IngestDocumentMatcher#assertIngestDocument() does not look at the content of its arguments too carefully. The following test does not pass:

diff --git a/server/src/test/java/org/elasticsearch/ingest/IngestDocumentTests.java b/server/src/test/java/org/elasticsearch/ingest/IngestDocumentTests.java
index 9df2a38c6f..0ab5d79457 100644
--- a/server/src/test/java/org/elasticsearch/ingest/IngestDocumentTests.java
+++ b/server/src/test/java/org/elasticsearch/ingest/IngestDocumentTests.java
@@ -1021,4 +1021,13 @@ public class IngestDocumentTests extends ESTestCase {
         }
     }
 
+    public void testEqualityAssertion() {
+        Map<String, Object> sourceAndMetadata1 = new HashMap<>();
+        sourceAndMetadata1.put("foo", "bar");
+        IngestDocument document1 = new IngestDocument(sourceAndMetadata1, new HashMap<>());
+
+        IngestDocument document2 = new IngestDocument(new HashMap<>(), new HashMap<>());
+
+        expectThrows(AssertionError.class, () -> assertIngestDocument(document1, document2));
+    }
 }

Found during the course of #28476

Metadata

Metadata

Labels

:Data Management/Ingest NodeExecution or management of Ingest Pipelines including GeoIP>testIssues or PRs that are addressing/adding tests

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions