[
https://issues.apache.org/jira/browse/FLINK-14694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16971143#comment-16971143
]
godfrey he commented on FLINK-14694:
------------------------------------
The reason is test classes (excluding `ListAggWsWithRetractAggFunctionTest `
and `ListAggWithRetractAggFunctionTest `) are abstract class, and will be
ignored. So only `ListAggWsWithRetractAggFunctionTest` and
`ListAggWithRetractAggFunctionTest` are executed.
My solution is introducing
[Enclosed|https://junit.org/junit4/javadoc/4.12/org/junit/experimental/runners/Enclosed.html]
runner, and moving the abstract class as an inner class, and making sure the
outer class is a non-abstract class.
The original class pattern is:
{code:java}
public abstract class MaxWithRetractAggFunctionTest<T> extends
AggFunctionTestBase<T, MaxWithRetractAccumulator<T>> {
@Override
protected Class<?> getAccClass() {
return MaxWithRetractAccumulator.class;
}
@Override
protected Method getRetractFunc() throws NoSuchMethodException {
return getAggregator().getClass().getMethod("retract",
getAccClass(), Object.class);
}
public static class StringMaxWithRetractAggFunctionTest extends
MaxWithRetractAggFunctionTest<BinaryString> { ... }
public static class TimestampMaxWithRetractAggFunctionTest extends
MaxWithRetractAggFunctionTest<Timestamp> { ... }
...
}
{code}
new class pattern is:
{code:java}
@RunWith(Enclosed.class)
public class MaxWithRetractAggFunctionTest {
/**
* The base test class for MaxWithRetractAggFunction.
*/
public abstract static class MaxWithRetractAggFunctionTestBase<T>
extends AggFunctionTestBase<T, MaxWithRetractAccumulator<T>> {
@Override
protected Class<?> getAccClass() {
return MaxWithRetractAccumulator.class;
}
@Override
protected Method getRetractFunc() throws NoSuchMethodException {
return getAggregator().getClass().getMethod("retract",
getAccClass(), Object.class);
}
public static class StringMaxWithRetractAggFunctionTest extends
MaxWithRetractAggFunctionTestBase<BinaryString> { ... }
public static class TimestampMaxWithRetractAggFunctionTest extends
MaxWithRetractAggFunctionTestBase<Timestamp> { ... }
...
}
{code}
> Most tests from package o.a.f.table.planner.functions.aggfunctions are not
> executed during mvn test
> ---------------------------------------------------------------------------------------------------
>
> Key: FLINK-14694
> URL: https://issues.apache.org/jira/browse/FLINK-14694
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner, Tests
> Reporter: Kurt Young
> Assignee: godfrey he
> Priority: Blocker
> Fix For: 1.10.0
>
>
> Only `ListAggWsWithRetractAggFunctionTest` and
> `ListAggWithRetractAggFunctionTest` are executed.
> And if we run the ignored tests from IDE, some of them will fail.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)