Skip to content

Conversation

jdyer1
Copy link
Contributor

@jdyer1 jdyer1 commented Oct 7, 2025

This fixes the CloudHttp2SolrClientTest#testHttpCspPerf by increasing the Cluster State Provider's cache timeout.

jdyer1 added 3 commits October 7, 2025 11:14
- create staic constant for sys prop (will cause test compile errors if removed in future)
- cleanup sys prop in @afterclass in ClusterStateProviderTest
- set sys prop to very high number in testHttpCspPerf to prevent spurious CLUSTERSTATUS requests
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a flaky test CloudHttp2SolrClientTest#testHttpCspPerf by refactoring the system property used to control the Cluster State Provider's cache timeout and properly managing its lifecycle in tests.

  • Extracts the hardcoded system property string into a constant for better maintainability
  • Adds proper cleanup of system properties in test classes to prevent test pollution
  • Sets an extremely high cache timeout in the performance test to prevent background cache refreshes from interfering

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
BaseHttpClusterStateProvider.java Defines constant for cache timeout system property and uses it instead of hardcoded string
ClusterStateProviderTest.java Uses the new constant and adds proper cleanup of system property after tests
CloudHttp2SolrClientTest.java Uses the new constant and wraps test with try-finally to ensure system property cleanup

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}
}
} finally {
System.clearProperty(SYS_PROP_CACHE_TIMEOUT_SECONDS);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't bother clearing system properties in tests. We've got some nice test infrastructure that makes doing so needless, and here causing you to do a needless try-finally.

@jdyer1 jdyer1 merged commit 20d8107 into apache:main Oct 10, 2025
4 checks passed
@jdyer1 jdyer1 deleted the feature/SOLR-17945 branch October 10, 2025 15:08
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.

2 participants