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