HDDS-762. Fix unit test failure for TestContainerSQLCli & TestSCMMetrics.

Contributed by Mukul Kumar Singh.
This commit is contained in:
Anu Engineer 2018-10-30 19:16:52 -07:00
parent f747f5b06c
commit e33b61f335
4 changed files with 11 additions and 6 deletions

View File

@ -45,7 +45,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
<hdds.version>0.4.0-SNAPSHOT</hdds.version> <hdds.version>0.4.0-SNAPSHOT</hdds.version>
<!-- Apache Ratis version --> <!-- Apache Ratis version -->
<ratis.version>0.3.0-2272086-SNAPSHOT</ratis.version> <ratis.version>0.3.0-1d2ebee-SNAPSHOT</ratis.version>
<bouncycastle.version>1.60</bouncycastle.version> <bouncycastle.version>1.60</bouncycastle.version>

View File

@ -47,6 +47,7 @@ import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import static org.apache.ratis.rpc.SupportedRpcType.GRPC; import static org.apache.ratis.rpc.SupportedRpcType.GRPC;
import org.apache.ratis.protocol.RaftGroupId;
import org.apache.ratis.util.CheckedBiConsumer; import org.apache.ratis.util.CheckedBiConsumer;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
@ -104,7 +105,8 @@ public class TestCSMMetrics {
client.connect(); client.connect();
// Before Read Chunk/Write Chunk // Before Read Chunk/Write Chunk
MetricsRecordBuilder metric = getMetrics(CSMMetrics.SOURCE_NAME); MetricsRecordBuilder metric = getMetrics(CSMMetrics.SOURCE_NAME +
RaftGroupId.valueOf(pipeline.getId().getId()).toString());
assertCounter("NumWriteStateMachineOps", 0L, metric); assertCounter("NumWriteStateMachineOps", 0L, metric);
assertCounter("NumReadStateMachineOps", 0L, metric); assertCounter("NumReadStateMachineOps", 0L, metric);
assertCounter("NumApplyTransactionOps", 0L, metric); assertCounter("NumApplyTransactionOps", 0L, metric);
@ -120,7 +122,8 @@ public class TestCSMMetrics {
Assert.assertEquals(ContainerProtos.Result.SUCCESS, Assert.assertEquals(ContainerProtos.Result.SUCCESS,
response.getResult()); response.getResult());
metric = getMetrics(CSMMetrics.SOURCE_NAME); metric = getMetrics(CSMMetrics.SOURCE_NAME +
RaftGroupId.valueOf(pipeline.getId().getId()).toString());
assertCounter("NumWriteStateMachineOps", 1L, metric); assertCounter("NumWriteStateMachineOps", 1L, metric);
assertCounter("NumApplyTransactionOps", 1L, metric); assertCounter("NumApplyTransactionOps", 1L, metric);
@ -132,7 +135,8 @@ public class TestCSMMetrics {
Assert.assertEquals(ContainerProtos.Result.SUCCESS, Assert.assertEquals(ContainerProtos.Result.SUCCESS,
response.getResult()); response.getResult());
metric = getMetrics(CSMMetrics.SOURCE_NAME); metric = getMetrics(CSMMetrics.SOURCE_NAME +
RaftGroupId.valueOf(pipeline.getId().getId()).toString());
assertCounter("NumReadStateMachineOps", 1L, metric); assertCounter("NumReadStateMachineOps", 1L, metric);
assertCounter("NumApplyTransactionOps", 1L, metric); assertCounter("NumApplyTransactionOps", 1L, metric);
} finally { } finally {

View File

@ -33,7 +33,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
<hadoop.version>3.2.1-SNAPSHOT</hadoop.version> <hadoop.version>3.2.1-SNAPSHOT</hadoop.version>
<hdds.version>0.4.0-SNAPSHOT</hdds.version> <hdds.version>0.4.0-SNAPSHOT</hdds.version>
<ozone.version>0.4.0-SNAPSHOT</ozone.version> <ozone.version>0.4.0-SNAPSHOT</ozone.version>
<ratis.version>0.3.0-2272086-SNAPSHOT</ratis.version> <ratis.version>0.3.0-1d2ebee-SNAPSHOT</ratis.version>
<bouncycastle.version>1.60</bouncycastle.version> <bouncycastle.version>1.60</bouncycastle.version>
<ozone.release>Badlands</ozone.release> <ozone.release>Badlands</ozone.release>
<declared.ozone.version>${ozone.version}</declared.ozone.version> <declared.ozone.version>${ozone.version}</declared.ozone.version>

View File

@ -22,6 +22,7 @@ import org.apache.hadoop.hdds.scm.container.SCMContainerManager;
import org.apache.hadoop.hdds.scm.events.SCMEvents; import org.apache.hadoop.hdds.scm.events.SCMEvents;
import org.apache.hadoop.hdds.scm.node.NodeManager; import org.apache.hadoop.hdds.scm.node.NodeManager;
import org.apache.hadoop.hdds.scm.pipeline.PipelineManager; import org.apache.hadoop.hdds.scm.pipeline.PipelineManager;
import org.apache.hadoop.hdds.scm.pipeline.SCMPipelineManager;
import org.apache.hadoop.hdds.server.events.EventQueue; import org.apache.hadoop.hdds.server.events.EventQueue;
import org.apache.hadoop.ozone.MiniOzoneCluster; import org.apache.hadoop.ozone.MiniOzoneCluster;
import org.apache.hadoop.ozone.OzoneConfigKeys; import org.apache.hadoop.ozone.OzoneConfigKeys;
@ -122,7 +123,7 @@ public class TestContainerSQLCli {
eventQueue = new EventQueue(); eventQueue = new EventQueue();
nodeManager = cluster.getStorageContainerManager().getScmNodeManager(); nodeManager = cluster.getStorageContainerManager().getScmNodeManager();
PipelineManager pipelineManager = PipelineManager pipelineManager =
cluster.getStorageContainerManager().getPipelineManager(); new SCMPipelineManager(conf, nodeManager, eventQueue);
containerManager = new SCMContainerManager(conf, nodeManager, containerManager = new SCMContainerManager(conf, nodeManager,
pipelineManager, eventQueue); pipelineManager, eventQueue);
blockManager = new BlockManagerImpl( blockManager = new BlockManagerImpl(