opensearch-project / performance-analyzer-commons

Apache License 2.0
4 stars 18 forks source link

test: add ThreadSchedTests #47

Closed kartva closed 10 months ago

kartva commented 11 months ago

Is your feature request related to a problem? Please provide an existing Issue # , or describe. Add tests for os/ThreadSched.java.

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.

➜  ~/opensearch/performance-analyzer-commons ./gradlew test --tests ThreadSchedTests                                   

> Task :test

org.opensearch.performanceanalyzer.commons.os.ThreadSchedTests > testMetrics STARTED

org.opensearch.performanceanalyzer.commons.os.ThreadSchedTests > testMetrics PASSED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.6.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 8s
ansjcy commented 11 months ago

Let's add the output of the unit test in the PR description as well.

kartva commented 11 months ago

@ansjcy

Let's add the output of the unit test in the PR description as well.

Running ./gradlew test --tests ThreadSchedTests gives me:

org.opensearch.performanceanalyzer.commons.os.ThreadSchedTests > testMetrics STARTED

org.opensearch.performanceanalyzer.commons.os.ThreadSchedTests > testMetrics PASSED

Is this what you meant by that? Or is it pasting the assertions that the unit test makes about the class being tested?

kartva commented 11 months ago

Alternatives to implementing equals on ThreadSched.SchedMetrics:

Out of which implementing equality seemed the simplest.


Turns out the test class does not meet the requirements to access a private member of ThreadSched.SchedMetrics, so using reflection seems infeasible.