YARN-10672. All testcases in TestReservations are flaky. Contributed by Szilard Nemeth.

This commit is contained in:
Peter Bacsko 2021-03-08 14:32:13 +01:00
parent 0d032d7b68
commit 0b8bfc50c6
1 changed files with 3 additions and 3 deletions

View File

@ -106,7 +106,6 @@ public class TestReservations {
CapacityScheduler spyCs = new CapacityScheduler(); CapacityScheduler spyCs = new CapacityScheduler();
cs = spy(spyCs); cs = spy(spyCs);
rmContext = TestUtils.getMockRMContext(); rmContext = TestUtils.getMockRMContext();
} }
private void setup(CapacitySchedulerConfiguration csConf) throws Exception { private void setup(CapacitySchedulerConfiguration csConf) throws Exception {
@ -115,6 +114,9 @@ public class TestReservations {
private void setup(CapacitySchedulerConfiguration csConf, private void setup(CapacitySchedulerConfiguration csConf,
boolean addUserLimits) throws Exception { boolean addUserLimits) throws Exception {
//All stub calls on the spy object of the 'cs' field should happen
//before cs.start() is invoked. See YARN-10672 for more details.
when(cs.getNumClusterNodes()).thenReturn(3);
csConf.setBoolean(CapacitySchedulerConfiguration.ENABLE_USER_METRICS, true); csConf.setBoolean(CapacitySchedulerConfiguration.ENABLE_USER_METRICS, true);
final String newRoot = "root" + System.currentTimeMillis(); final String newRoot = "root" + System.currentTimeMillis();
@ -157,8 +159,6 @@ public class TestReservations {
cs.setRMContext(spyRMContext); cs.setRMContext(spyRMContext);
cs.init(csConf); cs.init(csConf);
cs.start(); cs.start();
when(cs.getNumClusterNodes()).thenReturn(3);
} }
private static final String A = "a"; private static final String A = "a";