Skip to content

Add assertWarnings capabilities to base token stream test case #113619

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

Conversation

benwtrent
Copy link
Member

We need to be able to assert various warnings and check for such in typical token stream tests. This adds that capability.

@benwtrent benwtrent added >test Issues or PRs that are addressing/adding tests :Search/Search Search-related issues that do not fall into other categories auto-backport-and-merge v8.16.0 v9.0.0 labels Sep 26, 2024
@benwtrent benwtrent requested a review from cbuescher September 26, 2024 14:50
@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label Sep 26, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@benwtrent
Copy link
Member Author

@elasticmachine update branch

elasticmachine and others added 3 commits September 26, 2024 18:56
…github.com:benwtrent/elasticsearch into refactor/add-assert-warnings-to-token-stream-tests
@cbuescher
Copy link
Member

cbuescher commented Sep 26, 2024

I agree we should be able to assert warnings in tests extending ESTokenStreamTestCase. I ran into this in #113614 as well.

However I see disadvantages in copying the warnings-related code from ESTestCase here, because it is basically code duplication. The solution I suggested in #113614 is changing ESTokenStreamTestCase to extend ESTestCase instead of BaseTokenStreamTestCase. By that we get all the test infrastructure we are used to from other tests. BaseTokenStreamTestCase doesn't give us anything other than static helper methods that can be imported in a one-liner if needed. I would argue that's better than carrying two copies of the warning header test infra around.

@benwtrent
Copy link
Member Author

Eh, code duplication ain't that big of a deal, but let me see the impact of doing a switch (in isolation) as you suggest. Maybe its just as simple.

@benwtrent
Copy link
Member Author

@cbuescher did it your way, not a huge change actually.

Copy link
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making that change, LGTM.

@benwtrent benwtrent added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Sep 26, 2024
@benwtrent
Copy link
Member Author

@elasticmachine update branch

@benwtrent
Copy link
Member Author

@elasticmachine update branch

@elasticsearchmachine elasticsearchmachine merged commit 986cb02 into elastic:main Sep 27, 2024
15 checks passed
@benwtrent benwtrent deleted the refactor/add-assert-warnings-to-token-stream-tests branch September 27, 2024 13:15
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.x

benwtrent added a commit to benwtrent/elasticsearch that referenced this pull request Sep 27, 2024
…ic#113619)

We need to be able to assert various warnings and check for such in
typical token stream tests. This adds that capability.
elasticsearchmachine pushed a commit that referenced this pull request Oct 1, 2024
…113619) (#113688)

* Add assertWarnings capabilities to base token stream test case (#113619)

We need to be able to assert various warnings and check for such in
typical token stream tests. This adds that capability.

* fixing test

---------

Co-authored-by: Elastic Machine <[email protected]>
matthewabbott pushed a commit to matthewabbott/elasticsearch that referenced this pull request Oct 4, 2024
…ic#113619)

We need to be able to assert various warnings and check for such in
typical token stream tests. This adds that capability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team >test Issues or PRs that are addressing/adding tests v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants