You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ep...@apache.org on 2020/01/08 17:31:08 UTC
[hadoop] branch trunk updated: YARN-10072:
TestCSAllocateCustomResource failures. Contributed by Jim Brennan
(Jim_Brennan)
This is an automated email from the ASF dual-hosted git repository.
epayne pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 6899be5 YARN-10072: TestCSAllocateCustomResource failures. Contributed by Jim Brennan (Jim_Brennan)
6899be5 is described below
commit 6899be5a1729e49cff45090acd2cf4f54aeac089
Author: Eric E Payne <er...@verizonmedia.com>
AuthorDate: Wed Jan 8 17:29:56 2020 +0000
YARN-10072: TestCSAllocateCustomResource failures. Contributed by Jim Brennan (Jim_Brennan)
---
.../capacity/TestCSAllocateCustomResource.java | 34 ++++++----------------
1 file changed, 9 insertions(+), 25 deletions(-)
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCSAllocateCustomResource.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCSAllocateCustomResource.java
index 3a817e6..65473b9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCSAllocateCustomResource.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCSAllocateCustomResource.java
@@ -19,7 +19,6 @@
package org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity;
import org.apache.commons.io.FileUtils;
-import org.apache.hadoop.yarn.LocalConfigurationProvider;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
@@ -28,10 +27,8 @@ import org.apache.hadoop.yarn.server.resourcemanager.MockNM;
import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
import org.apache.hadoop.yarn.server.resourcemanager.MockRMAppSubmissionData;
import org.apache.hadoop.yarn.server.resourcemanager.MockRMAppSubmitter;
-import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.NullRMNodeLabelsManager;
import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager;
-import org.apache.hadoop.yarn.server.resourcemanager.placement.PlacementManager;
import org.apache.hadoop.yarn.server.resourcemanager.resource.TestResourceProfiles;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
@@ -52,9 +49,6 @@ import java.io.IOException;
import java.util.ArrayList;
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.MAXIMUM_ALLOCATION_MB;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
/**
* Test case for custom resource container allocation.
@@ -165,37 +159,27 @@ public class TestCSAllocateCustomResource {
resourceTypesFile = new File(source.getParent(), "resource-types.xml");
FileUtils.copyFile(source, resourceTypesFile);
- CapacityScheduler cs = new CapacityScheduler();
- CapacityScheduler spyCS = spy(cs);
- CapacitySchedulerConfiguration csConf =
+ CapacitySchedulerConfiguration newConf =
(CapacitySchedulerConfiguration) TestUtils
.getConfigurationWithMultipleQueues(conf);
- csConf.setClass(CapacitySchedulerConfiguration.RESOURCE_CALCULATOR_CLASS,
+ newConf.setClass(CapacitySchedulerConfiguration.RESOURCE_CALCULATOR_CLASS,
DominantResourceCalculator.class, ResourceCalculator.class);
- spyCS.setConf(csConf);
-
- RMNodeLabelsManager nodeLabelsManager = new NullRMNodeLabelsManager();
- nodeLabelsManager.init(csConf);
- PlacementManager pm = new PlacementManager();
- RMContext mockContext = mock(RMContext.class);
- when(mockContext.getConfigurationProvider()).thenReturn(
- new LocalConfigurationProvider());
- mockContext.setNodeLabelManager(nodeLabelsManager);
- when(mockContext.getNodeLabelManager()).thenReturn(nodeLabelsManager);
- when(mockContext.getQueuePlacementManager()).thenReturn(pm);
- spyCS.setRMContext(mockContext);
+ //start RM
+ MockRM rm = new MockRM(newConf);
+ rm.start();
- spyCS.init(csConf);
+ CapacityScheduler cs = (CapacityScheduler) rm.getResourceScheduler();
// Ensure the method can get custom resource type from
// CapacitySchedulerConfiguration
Assert.assertNotEquals(0,
ResourceUtils
- .fetchMaximumAllocationFromConfig(spyCS.getConfiguration())
+ .fetchMaximumAllocationFromConfig(cs.getConfiguration())
.getResourceValue("yarn.io/gpu"));
// Ensure custom resource type exists in queue's maximumAllocation
Assert.assertNotEquals(0,
- spyCS.getMaximumResourceCapability("a")
+ cs.getMaximumResourceCapability("a")
.getResourceValue("yarn.io/gpu"));
+ rm.close();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org