xintongsong commented on a change in pull request #11916: URL: https://github.com/apache/flink/pull/11916#discussion_r415529655
########## File path: flink-yarn/src/test/java/org/apache/flink/yarn/WorkerSpecContainerResourceAdapterTest.java ########## @@ -194,6 +198,41 @@ public void testMaxLimit() { assertFalse(adapter.tryComputeContainerResource(workerSpec2).isPresent()); } + @Test + public void testMatchResourceWithDifferentImplementation() { + final WorkerSpecContainerResourceAdapter.MatchingStrategy strategy = + WorkerSpecContainerResourceAdapter.MatchingStrategy.IGNORE_VCORE; + final int minMemMB = 1; + final int minVcore = 1; + + final WorkerSpecContainerResourceAdapter adapter = + new WorkerSpecContainerResourceAdapter( + getConfigProcessSpecEqualsWorkerSpec(), + minMemMB, + minVcore, + Integer.MAX_VALUE, + Integer.MAX_VALUE); + + final WorkerResourceSpec workerSpec = new WorkerResourceSpec.Builder() + .setCpuCores(1.0) + .setTaskHeapMemoryMB(100) + .setTaskOffHeapMemoryMB(200) + .setNetworkMemoryMB(300) + .setManagedMemoryMB(400) + .build(); + + Optional<Resource> resourceOpt = adapter.tryComputeContainerResource(workerSpec); + assertTrue(resourceOpt.isPresent()); + Resource resourceImpl1 = resourceOpt.get(); + + Resource resourceImpl2 = new TestingResourceImpl( + resourceImpl1.getMemory(), + resourceImpl1.getVirtualCores() + 1); Review comment: I think it's just for getting a typical non-identical resource as an argument for `getEquivalentContainerResource`. ---------------------------------------------------------------- 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: us...@infra.apache.org