-
Notifications
You must be signed in to change notification settings - Fork 25.8k
assertIngestDocument() is weaker than it appears #28492
Copy link
Copy link
Closed
Labels
:Distributed/Ingest NodeExecution or management of Ingest PipelinesExecution or management of Ingest Pipelines>testIssues or PRs that are addressing/adding testsIssues or PRs that are addressing/adding tests
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
:Distributed/Ingest NodeExecution or management of Ingest PipelinesExecution or management of Ingest Pipelines>testIssues or PRs that are addressing/adding testsIssues or PRs that are addressing/adding tests
Type
Fields
Give feedbackNo fields configured for issues without a type.