[ 
https://issues.apache.org/jira/browse/FLINK-5679?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15847551#comment-15847551
 ] 

Andrew Efimov commented on FLINK-5679:
--------------------------------------

I agree. Recently, I checked approach that allows to reuse cluster across 
multiple test classes. {{StreamingMultipleProgramsTestBase}} using enables the 
reusing cluster across test methods belonging to the single test class.
In {{StreamingMultipleProgramsTestBase}} we can implement {{@ClassRule 
ExternalResource externalResource}} like:
{noformat}
        @ClassRule
        public static ExternalResource externalResource =
                new ExternalResource() {
                        private int refCount = 0;

                        @Override
                        protected void before() throws Throwable {
                                if (refCount == 0) {
                                        setup();
                                }
                                refCount++;
                        }

                        @Override
                        protected void after() {
                                refCount--;
                                if (refCount == 0) {
                                        try {
                                                teardown();
                                        } catch (Exception e) {
                                                throw new RuntimeException(e);
                                        }
                                }
                        }
                };
{noformat}

Firstly, {{ExternalResource}} it is right way to provide resource as mentioned 
in junit java docs.
This approach allows to execute tests of {{StreamingMultipleProgramsTestBase}} 
inheritors independently as it is now running on a dedicated cluster
but also we will be able to specify test suite:
{noformat}
@RunWith(Suite.class)
@Suite.SuiteClasses({ StreamCheckpointNotifierITCase.class, 
StreamCheckpointingITCase.class })
public final class CheckpointITCaseSuite extends 
StreamingMultipleProgramsTestBase 
{noformat}
that feature enables dedicated cluster reusing across multiple particular test 
classes.

I think about the question and that feature. Cluster reusing can significantly 
speed up the execution of tests. But there is a question for which tests can 
reuse cluster, an obvious answer is those which do not break a cluster.
it could be first step to improve test framework. What do you think about this 
idea?

> Refactor  *CheckpointedITCase tests to speed up
> -----------------------------------------------
>
>                 Key: FLINK-5679
>                 URL: https://issues.apache.org/jira/browse/FLINK-5679
>             Project: Flink
>          Issue Type: Test
>          Components: Tests
>            Reporter: Andrew Efimov
>            Assignee: Andrew Efimov
>              Labels: test-framework
>             Fix For: 1.3.0
>
>
> Tests refactoring to speed up:
> {noformat}
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 40.193 sec - 
> in org.apache.flink.test.checkpointing.StreamCheckpointingITCasee
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 119.063 sec - 
> in org.apache.flink.test.checkpointing.UdfStreamOperatorCheckpointingITCase
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 47.525 sec - 
> in org.apache.flink.test.checkpointing.PartitionedStateCheckpointingITCase
> Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 40.355 sec - 
> in org.apache.flink.test.checkpointing.EventTimeAllWindowCheckpointingITCase
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 51.615 sec - 
> in org.apache.flink.test.checkpointing.StateCheckpointedITCase
> {noformat}
> Tests could be adjusted in a similar way to save some time (some may actually 
> even be redundant by now)  
> https://github.com/StephanEwen/incubator-flink/commit/0dd7ae693f30585283d334a1d65b3d8222b7ca5c



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to