-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hook to skip asserting x-content equivalence #33114
Add hook to skip asserting x-content equivalence #33114
Conversation
This commit adds a hook to AbstractSerializingTestCase to enable skipping asserting that the x-content of the test instance and an instance parsed from the x-content of the test instance are the same. While we usually expect these to be the same, they will not be the same when exceptions are involved because the x-content there is lossy.
Pinging @elastic/es-core-infra |
this::createParser, | ||
this::doParseInstance, | ||
this::assertEqualInstances, | ||
assertToXContentEquivalence(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the key change, from true
to use the assertToXContentEquivalence
hook. This is why I like long parameter lists on a single line per parameter. 😇
Were this method already formatted on a single line per parameter, the diff would have made this change obvious:
diff --git a/test/framework/src/main/java/org/elasticsearch/test/AbstractSerializingTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/AbstractSerializingTestCase.java
index 7e945a8414c..5aeb30bfdbd 100644
--- a/test/framework/src/main/java/org/elasticsearch/test/AbstractSerializingTestCase.java
+++ b/test/framework/src/main/java/org/elasticsearch/test/AbstractSerializingTestCase.java
@@ -44,7 +44,7 @@ public abstract class AbstractSerializingTestCase<T extends ToXContent & Writeab
this::createParser,
this::doParseInstance,
this::assertEqualInstances,
- true,
+ assertToXContentEquivalence(),
getToXContentParams());
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This commit adds a hook to AbstractSerializingTestCase to enable skipping asserting that the x-content of the test instance and an instance parsed from the x-content of the test instance are the same. While we usually expect these to be the same, they will not be the same when exceptions are involved because the x-content there is lossy.
Thanks for reviewing @javanna and @martijnvg. |
* master: Add hook to skip asserting x-content equivalence (#33114) Muted testListenersThrowingExceptionsDoNotCauseOtherListenersToBeSkipped [Rollup] Move getMetadata() methods out of rollup config objects (#32579) Muted testEmptyAuthorizedIndicesSearchForAllDisallowNoIndices Update Google Cloud Storage Library for Java (#32940) Remove unsupported Version.V_5_* (#32937)
* ccr: Add hook to skip asserting x-content equivalence (elastic#33114) Muted testListenersThrowingExceptionsDoNotCauseOtherListenersToBeSkipped [Rollup] Move getMetadata() methods out of rollup config objects (elastic#32579) fixed not returning response instance Muted testEmptyAuthorizedIndicesSearchForAllDisallowNoIndices Update Google Cloud Storage Library for Java (elastic#32940) Remove unsupported Version.V_5_* (elastic#32937)
* ccr: (71 commits) Make CCR QA tests build again (elastic#33113) Add hook to skip asserting x-content equivalence (elastic#33114) Muted testListenersThrowingExceptionsDoNotCauseOtherListenersToBeSkipped [Rollup] Move getMetadata() methods out of rollup config objects (elastic#32579) fixed not returning response instance Muted testEmptyAuthorizedIndicesSearchForAllDisallowNoIndices Update Google Cloud Storage Library for Java (elastic#32940) Remove unsupported Version.V_5_* (elastic#32937) Required changes after merging in master branch. [DOCS] Add docs for Application Privileges (elastic#32635) Add versions 5.6.12 and 6.4.1 Do NOT allow termvectors on nested fields (elastic#32728) [Rollup] Return empty response when aggs are missing (elastic#32796) [TEST] Add some ACL yaml tests for Rollup (elastic#33035) Move non duplicated actions back into xpack core (elastic#32952) Test fix - GraphExploreResponseTests should not randomise array elements Closes elastic#33086 Use `addIfAbsent` instead of checking if an element is contained TESTS: Fix Random Fail in MockTcpTransportTests (elastic#33061) HLRC: Fix Compile Error From Missing Throws (elastic#33083) [DOCS] Remove reload password from docs cf. elastic#32889 ...
This commit adds a hook to AbstractSerializingTestCase to enable skipping asserting that the x-content of the test instance and an instance parsed from the x-content of the test instance are the same. While we usually expect these to be the same, they will not be the same when exceptions are involved because the x-content there is lossy.
This commit adds a hook to AbstractSerializingTestCase to enable skipping asserting that the x-content of the test instance and an instance parsed from the x-content of the test instance are the same. While we usually expect these to be the same, they will not be the same when exceptions are involved because the x-content there is lossy.