azagrebin commented on a change in pull request #12520:
URL: https://github.com/apache/flink/pull/12520#discussion_r436664120
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/util/config/memory/ProcessMemoryUtilsTestBase.java
##########
@@ -350,4 +368,35 @@ public MemorySize getTotalProcessMemorySize() {
throw new UnsupportedOperationException();
}
}
+
+ private static class DummyFlinkMemoryUtils implements
FlinkMemoryUtils<DummyFlinkMemory> {
+ @Override
+ public DummyFlinkMemory
deriveFromRequiredFineGrainedOptions(Configuration config) {
+ return new DummyFlinkMemory();
+ }
+
+ @Override
+ public DummyFlinkMemory
deriveFromTotalFlinkMemory(Configuration config, MemorySize
totalFlinkMemorySize) {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ private static class DummyFlinkMemory implements FlinkMemory {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public MemorySize getJvmHeapMemorySize() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public MemorySize getJvmDirectMemorySize() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public MemorySize getTotalFlinkMemorySize() {
+ throw new UnsupportedOperationException();
+ }
+ }
Review comment:
Indeed, the abstractions are not optimal now for the tests setup.
There is an issue planned for refactoring of memory utils tests:
[FLINK-16754](https://issues.apache.org/jira/browse/FLINK-16754). I think we
can make a better step towards it in this PR by abstracting only setting of the
internal memory. I changed the approach.
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/util/config/memory/ProcessMemoryUtilsTestBase.java
##########
@@ -350,4 +368,35 @@ public MemorySize getTotalProcessMemorySize() {
throw new UnsupportedOperationException();
}
}
+
+ private static class DummyFlinkMemoryUtils implements
FlinkMemoryUtils<DummyFlinkMemory> {
Review comment:
True, `FlinkMemory` JavaDocs can include its structure and relationships
between components. I am not sure whether the methods need any explanation
afterwards as they are just getters. The same thing applies to
`FlinkMemoryUtils`. Its JavaDocs can be improved. I will add a hot fix commit.
----------------------------------------------------------------
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]