xintongsong commented on a change in pull request #11248: [FLINK-16299] Release
containers recovered from previous attempt in w…
URL: https://github.com/apache/flink/pull/11248#discussion_r385996792
##########
File path:
flink-yarn/src/test/java/org/apache/flink/yarn/YarnResourceManagerTest.java
##########
@@ -222,6 +222,10 @@ MainThreadExecutor getMainThreadExecutorForTesting() {
return super.getMainThreadExecutor();
}
+ void setTestingNMClientAsync(TestingNMClientAsync
testingNMClientAsync) {
+ this.testingNMClientAsync = testingNMClientAsync;
+ }
Review comment:
I'm not sure about setting the `TestingNMClientAsync` in this way.
It requires `setTestingNMClientAsync` get called before
`createAndStartNodeManagerClient`, in other words before RM is started, which
is implicit and hard to maintain.
I would suggest to overwrite the behavior of `TestingNMClientAsync`, rather
than overwriting the object it self. To be specific, we could do the following
changes.
1. Add a field `TestingNMClientAsync` in `Context`, so we can access it in
the test cases.
2. Create `TestingNMClientAsync` in `Context` and pass it into
`TestingYarnResourceManager`.
3. Make `Consumer` and `Function` in `TestingNMClientAsync` settable, so we
can define/change its behavior during tests.
In this way, it only requires to define the NM client behaviors before using
them, which I believe is more straightforward.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services