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

Fluent test framework #12215

Merged
merged 10 commits into from
Feb 6, 2024
Merged

Conversation

gortiz
Copy link
Contributor

@gortiz gortiz commented Jan 3, 2024

I found very difficult to understand most of the tests Pinot has. Some of them need to be complex given they are testing different service topologies or casuistics, but sometimes we just want to test a simple operator and in order to do so we need to create new classes that derive from BaseQueriesTest, which are usually not easy to read. Specially when the data the test will use is defined in csvs or other files.

This PR adds a fluent framework on top of BaseQueriesTest so we can define different tests in the same class in a fluent way that are close to the usual When-Given-Then tests.

This PR includes an example in pinot-core/src/test/java/org/apache/pinot/core/query/aggregation/function/CountAggregationFunctionTest.java, although I think we can improve that test before merging this PR.

I think a framework like would be easier to read and I plan to use it to cover most of the aggregation operations in order to feel confident once I modify them to support nullHandlingEnabled.

@gortiz gortiz marked this pull request as draft January 3, 2024 16:04
@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (041e040) 61.73% compared to head (d9eb755) 61.76%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #12215      +/-   ##
============================================
+ Coverage     61.73%   61.76%   +0.03%     
+ Complexity     1152      207     -945     
============================================
  Files          2424     2424              
  Lines        132526   132526              
  Branches      20483    20483              
============================================
+ Hits          81810    81850      +40     
+ Misses        44720    44675      -45     
- Partials       5996     6001       +5     
Flag Coverage Δ
custom-integration1 <0.01% <ø> (ø)
integration <0.01% <ø> (ø)
integration1 <0.01% <ø> (ø)
integration2 0.00% <ø> (ø)
java-11 61.68% <ø> (+0.01%) ⬆️
java-21 61.64% <ø> (+0.03%) ⬆️
skip-bytebuffers-false 61.73% <ø> (+0.02%) ⬆️
skip-bytebuffers-true 61.60% <ø> (+0.01%) ⬆️
temurin 61.76% <ø> (+0.03%) ⬆️
unittests 61.75% <ø> (+0.03%) ⬆️
unittests1 46.94% <ø> (+0.02%) ⬆️
unittests2 27.71% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@gortiz gortiz marked this pull request as ready for review January 5, 2024 14:25
import org.testng.annotations.BeforeClass;


public class AbstractAggregationFunctionTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public class AbstractAggregationFunctionTest {
public abstract class BaseAggregationFunctionTest {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Couldn't we just use abstract? We use that name pattern in several places (AbstractMetric, AbstractRule, AbstractCommand, AbstractPlanNode...) and it is also a common name in JDK (AbstractList, AbstractChronology...)

What I'm actually going to add for sure is the abstract class qualifier.

@Jackie-Jiang Jackie-Jiang merged commit e996843 into apache:master Feb 6, 2024
19 checks passed
suyashpatel98 pushed a commit to suyashpatel98/pinot that referenced this pull request Feb 28, 2024
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.

5 participants