-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
[FLINK-6397] MultipleProgramsTestBase does not reset ContextEnvironment #3810
Conversation
switch(mode){ | ||
case CLUSTER: | ||
new TestEnvironment(cluster, 4).setAsContext(); | ||
testEnvironment = new TestEnvironment(cluster, 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest moving this into an @Before
method and calling unsetAsContext
in a @After
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you try this instead: junit-team/junit4#45 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
I would suggest to use for |
@StephanEwen |
I think Till has implemented a static unsetAsContext method in TestEnvironment recently. I rebased the implementation from master, and recommit the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bar some minor comments this looks good to merge.
@@ -49,7 +49,7 @@ public JobExecutionResult execute(String jobName) throws Exception { | |||
return result; | |||
} | |||
|
|||
protected void setAsContext() { | |||
public void setAsContext() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this change?
@@ -97,6 +105,12 @@ public MultipleProgramsTestBase(TestExecutionMode mode) { | |||
} | |||
} | |||
|
|||
@After | |||
public void teardownEnvironment() { | |||
TestEnvironment.unsetAsContext(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could add another switch here, instead of calling both methods every time.
Hi, I updated this review. I don't know why there is no reminding in jira and email. |
We don't get notifications about pushed commits in general, only for comments and created/closed pull requests. |
OK, got it. Thank you for explanation. Is there any more problems with this pull request? |
Not quite; the
This is more or less a problem of the cassandra test; it shouldn't actually run any jobs at all. Let me fix that, then we'll get back to this PR. Besides that i don't see any problems right now. |
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. |
…before and after method.
Nice work! |
merging. |
Reset ContextEnvironment when finished testing in MultipleProgramsTestBase.java and some other ITCases.
Remove some useless importing.
Add unsetContext method in TestEnvironment.java.