YARN-3056. Add verification for containerLaunchDuration in
TestNodeManagerMetrics. Contributed by zhihai Xu
(cherry picked from commit b73e776abc
)
This commit is contained in:
parent
debd63f0b0
commit
c22dcdd191
|
@ -433,6 +433,9 @@ Release 2.7.0 - UNRELEASED
|
|||
|
||||
YARN-3113. Release audit warning for Sorting icons.psd. (stevel via kihwal)
|
||||
|
||||
YARN-3056. Add verification for containerLaunchDuration
|
||||
in TestNodeManagerMetrics. (zhihai xu via xgong)
|
||||
|
||||
Release 2.6.0 - 2014-11-18
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -17,17 +17,20 @@
|
|||
*/
|
||||
package org.apache.hadoop.yarn.server.nodemanager.metrics;
|
||||
|
||||
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
|
||||
import org.apache.hadoop.metrics2.MetricsRecordBuilder;
|
||||
import static org.apache.hadoop.test.MetricsAsserts.*;
|
||||
import org.apache.hadoop.yarn.api.records.Resource;
|
||||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestNodeManagerMetrics {
|
||||
static final int GiB = 1024; // MiB
|
||||
|
||||
@Test public void testNames() {
|
||||
DefaultMetricsSystem.initialize("NodeManager");
|
||||
NodeManagerMetrics metrics = NodeManagerMetrics.create();
|
||||
Resource total = Records.newRecord(Resource.class);
|
||||
total.setMemory(8*GiB);
|
||||
|
@ -61,7 +64,10 @@ public class TestNodeManagerMetrics {
|
|||
|
||||
metrics.initingContainer();
|
||||
metrics.runningContainer();
|
||||
|
||||
Assert.assertTrue(!metrics.containerLaunchDuration.changed());
|
||||
metrics.addContainerLaunchDuration(1);
|
||||
Assert.assertTrue(metrics.containerLaunchDuration.changed());
|
||||
|
||||
// availableGB is expected to be floored,
|
||||
// while allocatedGB is expected to be ceiled.
|
||||
|
|
Loading…
Reference in New Issue