-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
ESRestTestCase - assertWarnings does not work #36251
Comments
Pinging @elastic/es-core-features |
I don't really like |
HLRC APIs currently return either existing "XxxxResponse" classes used in |
After talking with Luca we came up with what looks like a better approach that works for LLRC and HLRC clients - see #36307 |
I closed #36307 which assumes single-version clusters. |
… and current-version-only clusters. This is supported by a new VersionSpecificWarningsHandler class with associated unit test. Closes elastic#36251
When we deprecate a server endpoint, REST test clients start failing and there's no way to write tests that check the particular warnings issued.
Rest tests currently have a stark choice:
What we'd ideally like is to be able to write tests that check the deprecated calls we make produce the warnings we'd expect and the ESTestCase base class already has a method to do just this:
assertWarnings
.Sadly,
assertWarnings
currently only works in server-side tests. It relies on ThreadLocals populated by calls to DeprecationLogger deep down in the server call stack. These warnings do not get materialised in remote clients like ESRestTestCase. Ideally the Rest client would be able to take the HTTP warning headers it already knows about inResponse.getWarnings()
and make them available for checks in ESTestCase.assertWarnings. Maybe we could achieve that by also having a form of DeprecationLogger on the client? At the very least,assertWarnings
should throw an Unsupported exception in ESRestTestCase if we don't have the means to propagate warnings.Related: @nik9000 has #36126 in flight for LLRC which helps shift the failure strictness from a class level to a method level but I don't think that helps fulfil the goal of making EsRestTestCase.assertWarnings work as expected.
The text was updated successfully, but these errors were encountered: