YARN-3412. RM tests should use MockRM where possible. (kasha)
This commit is contained in:
parent
859cab2f22
commit
79f7f2aabf
|
@ -119,6 +119,8 @@ Release 2.8.0 - UNRELEASED
|
||||||
YARN-3400. [JDK 8] Build Failure due to unreported exceptions in
|
YARN-3400. [JDK 8] Build Failure due to unreported exceptions in
|
||||||
RPCUtil (rkanter)
|
RPCUtil (rkanter)
|
||||||
|
|
||||||
|
YARN-3412. RM tests should use MockRM where possible. (kasha)
|
||||||
|
|
||||||
Release 2.7.0 - UNRELEASED
|
Release 2.7.0 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -52,8 +52,7 @@ public class TestMoveApplication {
|
||||||
FifoSchedulerWithMove.class);
|
FifoSchedulerWithMove.class);
|
||||||
conf.set(YarnConfiguration.YARN_ADMIN_ACL, " ");
|
conf.set(YarnConfiguration.YARN_ADMIN_ACL, " ");
|
||||||
conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
||||||
resourceManager = new ResourceManager();
|
resourceManager = new MockRM(conf);
|
||||||
resourceManager.init(conf);
|
|
||||||
resourceManager.getRMContext().getContainerTokenSecretManager().rollMasterKey();
|
resourceManager.getRMContext().getContainerTokenSecretManager().rollMasterKey();
|
||||||
resourceManager.getRMContext().getNMTokenSecretManager().rollMasterKey();
|
resourceManager.getRMContext().getNMTokenSecretManager().rollMasterKey();
|
||||||
resourceManager.start();
|
resourceManager.start();
|
||||||
|
|
|
@ -212,9 +212,8 @@ public class TestResourceManager {
|
||||||
public void testResourceManagerInitConfigValidation() throws Exception {
|
public void testResourceManagerInitConfigValidation() throws Exception {
|
||||||
Configuration conf = new YarnConfiguration();
|
Configuration conf = new YarnConfiguration();
|
||||||
conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, -1);
|
conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, -1);
|
||||||
resourceManager = new ResourceManager();
|
|
||||||
try {
|
try {
|
||||||
resourceManager.init(conf);
|
resourceManager = new MockRM(conf);
|
||||||
fail("Exception is expected because the global max attempts" +
|
fail("Exception is expected because the global max attempts" +
|
||||||
" is negative.");
|
" is negative.");
|
||||||
} catch (YarnRuntimeException e) {
|
} catch (YarnRuntimeException e) {
|
||||||
|
@ -229,9 +228,8 @@ public class TestResourceManager {
|
||||||
Configuration conf = new YarnConfiguration();
|
Configuration conf = new YarnConfiguration();
|
||||||
conf.setLong(YarnConfiguration.RM_NM_EXPIRY_INTERVAL_MS, 1000);
|
conf.setLong(YarnConfiguration.RM_NM_EXPIRY_INTERVAL_MS, 1000);
|
||||||
conf.setLong(YarnConfiguration.RM_NM_HEARTBEAT_INTERVAL_MS, 1001);
|
conf.setLong(YarnConfiguration.RM_NM_HEARTBEAT_INTERVAL_MS, 1001);
|
||||||
resourceManager = new ResourceManager();;
|
|
||||||
try {
|
try {
|
||||||
resourceManager.init(conf);
|
resourceManager = new MockRM(conf);
|
||||||
} catch (YarnRuntimeException e) {
|
} catch (YarnRuntimeException e) {
|
||||||
// Exception is expected.
|
// Exception is expected.
|
||||||
if (!e.getMessage().startsWith("Nodemanager expiry interval should be no"
|
if (!e.getMessage().startsWith("Nodemanager expiry interval should be no"
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.server.resourcemanager.monitor;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
|
import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.ProportionalCapacityPreemptionPolicy;
|
import org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.ProportionalCapacityPreemptionPolicy;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -35,7 +36,7 @@ public class TestSchedulingMonitor {
|
||||||
conf.set(YarnConfiguration.RM_SCHEDULER_MONITOR_POLICIES,
|
conf.set(YarnConfiguration.RM_SCHEDULER_MONITOR_POLICIES,
|
||||||
ProportionalCapacityPreemptionPolicy.class.getCanonicalName());
|
ProportionalCapacityPreemptionPolicy.class.getCanonicalName());
|
||||||
|
|
||||||
ResourceManager rm = new ResourceManager();
|
ResourceManager rm = new MockRM();
|
||||||
try {
|
try {
|
||||||
rm.init(conf);
|
rm.init(conf);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.yarn.server.resourcemanager.recovery;
|
package org.apache.hadoop.yarn.server.resourcemanager.recovery;
|
||||||
|
|
||||||
|
import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
@ -224,8 +225,7 @@ public class TestZKRMStateStore extends RMStateStoreTestBase {
|
||||||
|
|
||||||
Configuration conf1 = createHARMConf("rm1,rm2", "rm1", 1234);
|
Configuration conf1 = createHARMConf("rm1,rm2", "rm1", 1234);
|
||||||
conf1.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
|
conf1.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
|
||||||
ResourceManager rm1 = new ResourceManager();
|
ResourceManager rm1 = new MockRM(conf1);
|
||||||
rm1.init(conf1);
|
|
||||||
rm1.start();
|
rm1.start();
|
||||||
rm1.getRMContext().getRMAdminService().transitionToActive(req);
|
rm1.getRMContext().getRMAdminService().transitionToActive(req);
|
||||||
assertEquals("RM with ZKStore didn't start",
|
assertEquals("RM with ZKStore didn't start",
|
||||||
|
@ -236,8 +236,7 @@ public class TestZKRMStateStore extends RMStateStoreTestBase {
|
||||||
|
|
||||||
Configuration conf2 = createHARMConf("rm1,rm2", "rm2", 5678);
|
Configuration conf2 = createHARMConf("rm1,rm2", "rm2", 5678);
|
||||||
conf2.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
|
conf2.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
|
||||||
ResourceManager rm2 = new ResourceManager();
|
ResourceManager rm2 = new MockRM(conf2);
|
||||||
rm2.init(conf2);
|
|
||||||
rm2.start();
|
rm2.start();
|
||||||
rm2.getRMContext().getRMAdminService().transitionToActive(req);
|
rm2.getRMContext().getRMAdminService().transitionToActive(req);
|
||||||
assertEquals("RM with ZKStore didn't start",
|
assertEquals("RM with ZKStore didn't start",
|
||||||
|
|
|
@ -117,8 +117,7 @@ public class TestFairScheduler extends FairSchedulerTestBase {
|
||||||
public void setUp() throws IOException {
|
public void setUp() throws IOException {
|
||||||
scheduler = new FairScheduler();
|
scheduler = new FairScheduler();
|
||||||
conf = createConfiguration();
|
conf = createConfiguration();
|
||||||
resourceManager = new ResourceManager();
|
resourceManager = new MockRM(conf);
|
||||||
resourceManager.init(conf);
|
|
||||||
|
|
||||||
// TODO: This test should really be using MockRM. For now starting stuff
|
// TODO: This test should really be using MockRM. For now starting stuff
|
||||||
// that is needed at a bare minimum.
|
// that is needed at a bare minimum.
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
@ -48,8 +49,7 @@ public class TestFairSchedulerEventLog {
|
||||||
|
|
||||||
// All tests assume only one assignment per node update
|
// All tests assume only one assignment per node update
|
||||||
conf.set(FairSchedulerConfiguration.ASSIGN_MULTIPLE, "false");
|
conf.set(FairSchedulerConfiguration.ASSIGN_MULTIPLE, "false");
|
||||||
resourceManager = new ResourceManager();
|
resourceManager = new MockRM(conf);
|
||||||
resourceManager.init(conf);
|
|
||||||
((AsyncDispatcher)resourceManager.getRMContext().getDispatcher()).start();
|
((AsyncDispatcher)resourceManager.getRMContext().getDispatcher()).start();
|
||||||
scheduler.init(conf);
|
scheduler.init(conf);
|
||||||
scheduler.start();
|
scheduler.start();
|
||||||
|
|
|
@ -116,11 +116,10 @@ public class TestFifoScheduler {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
resourceManager = new ResourceManager();
|
|
||||||
conf = new Configuration();
|
conf = new Configuration();
|
||||||
conf.setClass(YarnConfiguration.RM_SCHEDULER,
|
conf.setClass(YarnConfiguration.RM_SCHEDULER,
|
||||||
FifoScheduler.class, ResourceScheduler.class);
|
FifoScheduler.class, ResourceScheduler.class);
|
||||||
resourceManager.init(conf);
|
resourceManager = new MockRM(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
|
Loading…
Reference in New Issue