Skip to content
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

[2.18] Fix remaining integ tests #4851

Merged

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Oct 28, 2024

Description

This PR fixes integ tests that subclass AbstractApiIntegrationTest and are failing due to static initialization.

This PR introduces a new pattern for base class initialization that initializes once in the @Before block per base class and uses polymorphism to supply custom cluster settings for the tests in each base class.

This PR also mutes the flaky tests SecurityConfigurationTests.testParallelTenantPutRequests and only runs ResourceFocusedTests as a PR check. Ideally, ResourceFocusedTests are also run with release time integ tests, but I ran into issues with memory exhaustion on the github runners.

In a previous commit I had added memory to the integ tests, but I'd like to keep the defaults if possible.

tasks.named("integrationTest") {
    minHeapSize = "512m"
    maxHeapSize = "2g"
}
  • Category (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)

Test fix

Issues Resolved

Check List

  • New functionality includes testing
  • New functionality has been documented
  • New Roles/Permissions have a corresponding security dashboards plugin PR
  • API changes companion pull request created
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
@cwperks
Copy link
Member Author

cwperks commented Oct 28, 2024

2024-10-28T13:45:48.4969963Z > Task :jacocoTestReport
2024-10-28T13:45:48.4970705Z 
2024-10-28T13:45:48.4972088Z Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
2024-10-28T13:45:48.4973172Z 
2024-10-28T13:45:48.4974745Z You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
2024-10-28T13:45:48.4976261Z 
2024-10-28T13:45:48.4977611Z For more on this, please refer to https://docs.gradle.org/8.10.2/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
2024-10-28T13:45:48.4979197Z 
2024-10-28T13:45:48.4979654Z BUILD SUCCESSFUL in 9m 10s

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.86%. Comparing base (6bdaf0b) to head (aadefd4).
Report is 1 commits behind head on 2.18.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             2.18    #4851      +/-   ##
==========================================
+ Coverage   63.83%   63.86%   +0.02%     
==========================================
  Files         330      330              
  Lines       23091    23091              
  Branches     3741     3741              
==========================================
+ Hits        14741    14747       +6     
+ Misses       6519     6512       -7     
- Partials     1831     1832       +1     

see 2 files with indirect coverage changes

@cwperks
Copy link
Member Author

cwperks commented Oct 28, 2024

FYI The reason that the CI Check shows as green even when there are failing tests is because of the configuration here: https://github.com/opensearch-project/security/blob/main/build.gradle#L535-L541

if (System.getenv('CI_ENVIRONMENT') == 'normal') {
    retry {
        failOnPassedAfterRetry = false
        maxRetries = 2
        maxFailures = 10
    }
}

The tests do pass on retry so the CI check is green. This configuration may be hiding some flakiness so we may want to start gathering stats on flaky tests to try to get all tests to pass consistently on first run.

Copy link
Collaborator

@derek-ho derek-ho left a comment

Choose a reason for hiding this comment

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

LGTM

@willyborankin willyborankin merged commit c22e76b into opensearch-project:2.18 Oct 28, 2024
81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants