Skip to content

add tests to validate timeout overrides #3362

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kotman12
Copy link
Contributor

https://issues.apache.org/jira/browse/SOLR-XXXXX

Description

Please provide a short description of the changes you're making with this pull request.

Solution

Please provide a short description of the approach taken to implement your solution.

Tests

Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide

@@ -69,7 +69,7 @@ public void testTimeout() throws Exception {
client.query(q, SolrRequest.METHOD.GET);
fail("No exception thrown.");
} catch (SolrServerException e) {
assertTrue(e.getMessage().contains("timeout") || e.getMessage().contains("Timeout"));
assertTrue(isTimeout(e));
Copy link
Contributor

@mlbiscoc mlbiscoc May 22, 2025

Choose a reason for hiding this comment

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

For asserting on Exceptions could we assertThrows instead? Then assert that it was a timeout after? I like that over asserting on a catch on all these tests and the ones you updated below. Kind of like this

Suggested change
assertTrue(isTimeout(e));
SolrServerException exception = assertThrows("Expected an exception but no expcetion thrown", SolrServerException.class, () -> {
// Run your logic to throw an excpetion
});
assertTrue("Expected a timeout exception but got: " + exception.getMessage(), isTimeout(exception));

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed.

@kotman12 kotman12 marked this pull request as draft May 22, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants