You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by ifndef-SleePy <gi...@git.apache.org> on 2017/05/02 15:34:41 UTC

[GitHub] flink pull request #3810: [Flink-6397] MultipleProgramsTestBase does not res...

GitHub user ifndef-SleePy opened a pull request:

    https://github.com/apache/flink/pull/3810

    [Flink-6397] MultipleProgramsTestBase does not reset ContextEnvironment

    Reset ContextEnvironment when finished testing in MultipleProgramsTestBase.java and some other ITCase.
    Remove some useless importing.
    Add unsetContext method in TestEnvironment.java.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/alibaba/flink FLINK-6397

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/3810.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3810
    
----
commit 0932dcdf0d78a783b2921fa26ae80a6a4889c3ca
Author: biao.liub <bi...@alibaba-inc.com>
Date:   2017-05-02T08:07:34Z

    [FLINK-6397] Unset context when integration test is finished.

commit d0becf4331c7649b0711ec37154501fc39a7177b
Author: biao.liub <bi...@alibaba-inc.com>
Date:   2017-05-02T11:01:47Z

    [FLINK-6397] Fix test cases.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3810: [Flink-6397] MultipleProgramsTestBase does not reset Cont...

Posted by StephanEwen <gi...@git.apache.org>.
Github user StephanEwen commented on the issue:

    https://github.com/apache/flink/pull/3810
  
    I would suggest to use for `TestEnvionment` the same approach as in `TestStreamEnvironment` (a static unset method). Then you don't need to ever remember a reference to the environment, which makes the changes much smaller.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3810: [FLINK-6397] MultipleProgramsTestBase does not res...

Posted by ifndef-SleePy <gi...@git.apache.org>.
Github user ifndef-SleePy commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3810#discussion_r115170542
  
    --- Diff: flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MultipleProgramsTestBase.java ---
    @@ -80,29 +80,36 @@
     	
     	protected final TestExecutionMode mode;
     
    -	
    +	private TestEnvironment testEnvironment;
    +
    +	private CollectionTestEnvironment collectionTestEnvironment;
    +
     	public MultipleProgramsTestBase(TestExecutionMode mode) {
     		this.mode = mode;
    -		
    +
     		switch(mode){
     			case CLUSTER:
    -				new TestEnvironment(cluster, 4).setAsContext();
    +				testEnvironment = new TestEnvironment(cluster, 4);
    --- End diff --
    
    Thank you for responding. Last my comment is not correct. Actually what I want to say is that we can not move these code to \@BeforeClass and \@AfterClass. But we can move them to \@Before and \@After, however it will bring a little overhead since \@Before and \@After will be called for each test method. I pushed a new commit using \@Before and \@After.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3810: [FLINK-6397] MultipleProgramsTestBase does not res...

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3810#discussion_r115274563
  
    --- Diff: flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MultipleProgramsTestBase.java ---
    @@ -97,6 +105,12 @@ public MultipleProgramsTestBase(TestExecutionMode mode) {
     		}
     	}
     
    +	@After
    +	public void teardownEnvironment() {
    +		TestEnvironment.unsetAsContext();
    --- End diff --
    
    you could add another switch here, instead of calling both methods every time.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3810: [Flink-6397] MultipleProgramsTestBase does not res...

Posted by ifndef-SleePy <gi...@git.apache.org>.
Github user ifndef-SleePy commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3810#discussion_r114693043
  
    --- Diff: flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MultipleProgramsTestBase.java ---
    @@ -80,29 +80,36 @@
     	
     	protected final TestExecutionMode mode;
     
    -	
    +	private TestEnvironment testEnvironment;
    +
    +	private CollectionTestEnvironment collectionTestEnvironment;
    +
     	public MultipleProgramsTestBase(TestExecutionMode mode) {
     		this.mode = mode;
    -		
    +
     		switch(mode){
     			case CLUSTER:
    -				new TestEnvironment(cluster, 4).setAsContext();
    +				testEnvironment = new TestEnvironment(cluster, 4);
    --- End diff --
    
    Sounds reasonable.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3810: [FLINK-6397] MultipleProgramsTestBase does not reset Cont...

Posted by ifndef-SleePy <gi...@git.apache.org>.
Github user ifndef-SleePy commented on the issue:

    https://github.com/apache/flink/pull/3810
  
    OK, got it. Thank you for explanation. Is there any more problems with this pull request?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3810: [Flink-6397] MultipleProgramsTestBase does not res...

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3810#discussion_r114498745
  
    --- Diff: flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MultipleProgramsTestBase.java ---
    @@ -80,29 +80,36 @@
     	
     	protected final TestExecutionMode mode;
     
    -	
    +	private TestEnvironment testEnvironment;
    +
    +	private CollectionTestEnvironment collectionTestEnvironment;
    +
     	public MultipleProgramsTestBase(TestExecutionMode mode) {
     		this.mode = mode;
    -		
    +
     		switch(mode){
     			case CLUSTER:
    -				new TestEnvironment(cluster, 4).setAsContext();
    +				testEnvironment = new TestEnvironment(cluster, 4);
    --- End diff --
    
    I would suggest moving this into an `@Before` method and calling `unsetAsContext` in a `@After` method.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3810: [FLINK-6397] MultipleProgramsTestBase does not reset Cont...

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:

    https://github.com/apache/flink/pull/3810
  
    merging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3810: [FLINK-6397] MultipleProgramsTestBase does not reset Cont...

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:

    https://github.com/apache/flink/pull/3810
  
    I've fixed the cassandra tests, would be great if you could rebase this PR. You should be able to discard all changes to the cassandra tests in this PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3810: [FLINK-6397] MultipleProgramsTestBase does not res...

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3810#discussion_r115274387
  
    --- Diff: flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/CollectionTestEnvironment.java ---
    @@ -49,7 +49,7 @@ public JobExecutionResult execute(String jobName) throws Exception {
     		return result;
     	}
     
    -	protected void setAsContext() {
    +	public void setAsContext() {
    --- End diff --
    
    do we still need this change?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3810: [FLINK-6397] MultipleProgramsTestBase does not res...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/flink/pull/3810


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3810: [FLINK-6397] MultipleProgramsTestBase does not reset Cont...

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:

    https://github.com/apache/flink/pull/3810
  
    Not quite; the `CassandraConnectorITCase` was broken in the process. This test contains both batch and streaming jobs that rely on different TestEnvironments. When the batch `TestEnvironment` is set as the context the streaming tests will fail.
    
    `StreamExecutionEnvironment#getExecutionEnvironment()` doesn't account for this case, and tries to create a `LocalStreamEnvironment` which however fails since no explicit environment may be create when a context environment was set.
    
    This is more or less a problem of the cassandra test; it shouldn't actually run any streaming jobs. Let me fix that, then we'll get back to this PR.
    
    Besides that i don't see any problems right now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3810: [FLINK-6397] MultipleProgramsTestBase does not reset Cont...

Posted by ifndef-SleePy <gi...@git.apache.org>.
Github user ifndef-SleePy commented on the issue:

    https://github.com/apache/flink/pull/3810
  
    Nice work!
    I have rebased master.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3810: [FLINK-6397] MultipleProgramsTestBase does not res...

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3810#discussion_r115137365
  
    --- Diff: flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MultipleProgramsTestBase.java ---
    @@ -80,29 +80,36 @@
     	
     	protected final TestExecutionMode mode;
     
    -	
    +	private TestEnvironment testEnvironment;
    +
    +	private CollectionTestEnvironment collectionTestEnvironment;
    +
     	public MultipleProgramsTestBase(TestExecutionMode mode) {
     		this.mode = mode;
    -		
    +
     		switch(mode){
     			case CLUSTER:
    -				new TestEnvironment(cluster, 4).setAsContext();
    +				testEnvironment = new TestEnvironment(cluster, 4);
    --- End diff --
    
    Could you try this instead: https://github.com/junit-team/junit4/issues/45#issuecomment-6422143


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3810: [FLINK-6397] MultipleProgramsTestBase does not reset Cont...

Posted by ifndef-SleePy <gi...@git.apache.org>.
Github user ifndef-SleePy commented on the issue:

    https://github.com/apache/flink/pull/3810
  
    Hi, I updated this review. I don't know why there is no reminding in jira and email.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3810: [FLINK-6397] MultipleProgramsTestBase does not res...

Posted by ifndef-SleePy <gi...@git.apache.org>.
Github user ifndef-SleePy commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3810#discussion_r115133175
  
    --- Diff: flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MultipleProgramsTestBase.java ---
    @@ -80,29 +80,36 @@
     	
     	protected final TestExecutionMode mode;
     
    -	
    +	private TestEnvironment testEnvironment;
    +
    +	private CollectionTestEnvironment collectionTestEnvironment;
    +
     	public MultipleProgramsTestBase(TestExecutionMode mode) {
     		this.mode = mode;
    -		
    +
     		switch(mode){
     			case CLUSTER:
    -				new TestEnvironment(cluster, 4).setAsContext();
    +				testEnvironment = new TestEnvironment(cluster, 4);
    --- End diff --
    
    @zentol I just found that I can not move these codes into \@Before method, because it will not work with JUnit Parameterized. I proposal to keep these codes in constructor. What do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3810: [FLINK-6397] MultipleProgramsTestBase does not reset Cont...

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:

    https://github.com/apache/flink/pull/3810
  
    We don't get notifications about pushed commits in general, only for comments and created/closed pull requests.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3810: [Flink-6397] MultipleProgramsTestBase does not reset Cont...

Posted by ifndef-SleePy <gi...@git.apache.org>.
Github user ifndef-SleePy commented on the issue:

    https://github.com/apache/flink/pull/3810
  
    @StephanEwen 
    I agree that a static unset method would be a much easier implementation. Do you think it's acceptable that the unset method is static but set method is not static in TestEnvironment? Or we can implement the set method as static too, but that will make more changes. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3810: [FLINK-6397] MultipleProgramsTestBase does not reset Cont...

Posted by ifndef-SleePy <gi...@git.apache.org>.
Github user ifndef-SleePy commented on the issue:

    https://github.com/apache/flink/pull/3810
  
    I think Till has implemented a static unsetAsContext method in TestEnvironment recently. I rebased the implementation from master, and recommit the pull request.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---