-
Notifications
You must be signed in to change notification settings - Fork 75
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
Adding more unit tests for validation API and some model classes #335
Adding more unit tests for validation API and some model classes #335
Conversation
69c175d
to
15b53e1
Compare
Codecov Report
@@ Coverage Diff @@
## main #335 +/- ##
============================================
+ Coverage 77.54% 79.21% +1.66%
- Complexity 4018 4093 +75
============================================
Files 295 295
Lines 17188 17207 +19
Branches 1816 1826 +10
============================================
+ Hits 13329 13631 +302
+ Misses 3017 2676 -341
- Partials 842 900 +58
Flags with carried forward coverage won't be shown. Click here to find out more.
|
src/main/java/org/opensearch/ad/constant/CommonErrorMessages.java
Outdated
Show resolved
Hide resolved
int totalHits = 9; | ||
when(detectorResponse.getHits()).thenReturn(TestHelpers.createSearchHits(totalHits)); | ||
|
||
// extend NodeClient since its execute method is final and mockito does not allow to mock final methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this to use doAnswer instead of extending nodeClient
@@ -73,8 +75,10 @@ public static String getTooManyCategoricalFieldErr(int limit) { | |||
public static String HISTORICAL_ANALYSIS_CANCELLED = "Historical analysis cancelled by user"; | |||
public static String HC_DETECTOR_TASK_IS_UPDATING = "HC detector task is updating"; | |||
public static String NEGATIVE_TIME_CONFIGURATION = "should be non-negative"; | |||
public static String INVALID_TIME_CONFIGURATION_UNITS = "Timezone %s is not supported"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message seems not correct from the first release. Change to "Time unit %s is not supported" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch! Changed this.
Link Checker failed, can you check and fix? |
Seems like this check has failed for the past week. After doing some research seems like a lot of other repos using the link-checker action have dropped the quotations mark surrounding args. A new PR from lychee-action team was released to add support for extra inputs. The new code adds quotes to the arguments so need to remove quotes we pass into args from now. |
src/test/java/org/opensearch/ad/model/ADEntityTaskProfileTests.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/ad/model/DetectorInternalStateTests.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/ad/transport/ValidateAnomalyDetectorTransportActionTests.java
Outdated
Show resolved
Hide resolved
63d8b2c
to
51b3b1e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
2102227
to
fac80e5
Compare
…nsearch-project#335) Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
Description
Added more unit testing for validation API as well as for some model classes that either didn't have any tests or were missing a unit test.
Split PR into two separate ones. This first one has all the additional validation testing, including some additional model testing. Second PR will have more integration tests, more tests in ad.model package and other files.
Check List
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.