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

Refactor TrainingJobRouteDecisionInfo test to use KNNTestCase #1374

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

jmazanec15
Copy link
Member

Description

Recently, we have seen that TrainingJobRouteDecisionInfoTransportActionTests has been having failures on Windows (for example: https://github.com/jmazanec15/k-NN-1/actions/runs/7415192445/job/20177850505). The failures are related to an unintialized cluster state tryiing to be accessed after calling training. Still not sure why the cluster state is null after the test starts, but this does not have anything to do with the test itself.

Most likely, the flakiness is the result of state sharing that happens with KNNSingleNodeTestCase. KNNSingleNodeTestCase inherits from OpenSearchSingleNodeTestCase which will start a node as a part of running each test. OpenSearchSingleNodeTestCase is unnecessary for this test case where we just want to validate that a transport action can read the correct job count on the node. This change refactors the class to use mocks and a lighter weight base class, KNNTestCase. In general, we should always prefer KNNTestCase over KNNSingleNodeTestCase.

Issues Resolved

#1368

Check List

  • New functionality includes testing.
    • All tests pass
  • Commits are signed as 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.

Recently, we have seen that
TrainingJobRouteDecisionInfoTransportActionTests has been having
failures on Windows. The failures are related to an unintialized cluster
state. This does not have anything to do with the test itself. Most
likely, it is the result of state dependence that happens with
KNNSingleNodeTestCase.

This change refactors the class to use mocks and a lighter weight base
class, KNNTestCase.

Signed-off-by: John Mazanec <[email protected]>
Copy link
Member

@ryanbogan ryanbogan left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

codecov bot commented Jan 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2dc3f61) 85.10% compared to head (63acc3c) 85.07%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1374      +/-   ##
============================================
- Coverage     85.10%   85.07%   -0.04%     
  Complexity     1254     1254              
============================================
  Files           163      163              
  Lines          5104     5104              
  Branches        477      477              
============================================
- Hits           4344     4342       -2     
- Misses          554      556       +2     
  Partials        206      206              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@heemin32 heemin32 left a comment

Choose a reason for hiding this comment

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

LGTM

@navneet1v
Copy link
Collaborator

Waiting for k-NN build to be completed.

@jmazanec15 jmazanec15 merged commit 5c24d99 into opensearch-project:main Jan 4, 2024
63 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 4, 2024
Recently, we have seen that
TrainingJobRouteDecisionInfoTransportActionTests has been having
failures on Windows. The failures are related to an unintialized cluster
state. This does not have anything to do with the test itself. Most
likely, it is the result of state dependence that happens with
KNNSingleNodeTestCase.

This change refactors the class to use mocks and a lighter weight base
class, KNNTestCase.

Signed-off-by: John Mazanec <[email protected]>
(cherry picked from commit 5c24d99)
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.

4 participants