YARN-6359. TestRM#testApplicationKillAtAcceptedState fails rarely due to race condition. Contributed by Robert Kanter
(cherry picked from commit bea8f8190f036375981ef4ceda409f9199730740) Conflicts: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java
This commit is contained in:
parent
ca3ede5fda
commit
b1f0bde5dc
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.yarn.server.resourcemanager;
|
package org.apache.hadoop.yarn.server.resourcemanager;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
|
import org.apache.hadoop.test.GenericTestUtils;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import static org.mockito.Matchers.argThat;
|
import static org.mockito.Matchers.argThat;
|
||||||
import static org.mockito.Mockito.doNothing;
|
import static org.mockito.Mockito.doNothing;
|
||||||
@ -593,9 +595,9 @@ protected Dispatcher createDispatcher() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// test metrics
|
// test metrics
|
||||||
QueueMetrics metrics = rm.getResourceScheduler().getRootQueueMetrics();
|
final QueueMetrics metrics = rm.getResourceScheduler().getRootQueueMetrics();
|
||||||
int appsKilled = metrics.getAppsKilled();
|
final int appsKilled = metrics.getAppsKilled();
|
||||||
int appsSubmitted = metrics.getAppsSubmitted();
|
final int appsSubmitted = metrics.getAppsSubmitted();
|
||||||
|
|
||||||
rm.start();
|
rm.start();
|
||||||
|
|
||||||
@ -633,7 +635,13 @@ protected Dispatcher createDispatcher() {
|
|||||||
rm.waitForState(application.getApplicationId(), RMAppState.KILLED);
|
rm.waitForState(application.getApplicationId(), RMAppState.KILLED);
|
||||||
|
|
||||||
// test metrics
|
// test metrics
|
||||||
metrics = rm.getResourceScheduler().getRootQueueMetrics();
|
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public Boolean get() {
|
||||||
|
return appsKilled + 1 == metrics.getAppsKilled()
|
||||||
|
&& appsSubmitted + 1 == metrics.getAppsSubmitted();
|
||||||
|
}
|
||||||
|
}, 100, 10000);
|
||||||
Assert.assertEquals(appsKilled + 1, metrics.getAppsKilled());
|
Assert.assertEquals(appsKilled + 1, metrics.getAppsKilled());
|
||||||
Assert.assertEquals(appsSubmitted + 1, metrics.getAppsSubmitted());
|
Assert.assertEquals(appsSubmitted + 1, metrics.getAppsSubmitted());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user