This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch integration-test-cleanup
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git
The following commit(s) were added to refs/heads/integration-test-cleanup by
this push:
new 093b506 Delete TestRatisPipelineProvider integration test, which was
fixed and moved to unit tests in HDDS-2365, but HDDS-2034 brought it back.
093b506 is described below
commit 093b506209392e3c88c6666cdcf452421b15f5c9
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Thu Dec 26 10:15:04 2019 +0100
Delete TestRatisPipelineProvider integration test, which was fixed and
moved to unit tests in HDDS-2365, but HDDS-2034 brought it back.
---
.../scm/pipeline/TestRatisPipelineProvider.java | 210 ---------------------
1 file changed, 210 deletions(-)
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestRatisPipelineProvider.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestRatisPipelineProvider.java
deleted file mode 100644
index 8b8c64f..0000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestRatisPipelineProvider.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hdds.scm.pipeline;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.hadoop.hdds.HddsConfigKeys;
-import org.apache.hadoop.hdds.conf.OzoneConfiguration;
-import org.apache.hadoop.hdds.protocol.DatanodeDetails;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
-import org.apache.hadoop.hdds.scm.TestUtils;
-import org.apache.hadoop.hdds.scm.container.MockNodeManager;
-import org.apache.hadoop.hdds.scm.node.NodeManager;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Test for RatisPipelineProvider.
- */
-public class TestRatisPipelineProvider {
-
- private NodeManager nodeManager;
- private PipelineProvider provider;
- private PipelineStateManager stateManager;
-
- @Before
- public void init() throws Exception {
- nodeManager = new MockNodeManager(true, 10);
- OzoneConfiguration conf = new OzoneConfiguration();
- conf.setBoolean(HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION, false);
- stateManager = new PipelineStateManager(conf);
- provider = new MockRatisPipelineProvider(nodeManager,
- stateManager, new OzoneConfiguration());
- }
-
- private void createPipelineAndAssertions(
- HddsProtos.ReplicationFactor factor) throws IOException {
- Pipeline pipeline = provider.create(factor);
- stateManager.addPipeline(pipeline);
- Assert.assertEquals(pipeline.getType(), HddsProtos.ReplicationType.RATIS);
- Assert.assertEquals(pipeline.getFactor(), factor);
- Assert.assertEquals(Pipeline.PipelineState.ALLOCATED,
- pipeline.getPipelineState());
- Assert.assertEquals(pipeline.getNodes().size(), factor.getNumber());
- Pipeline pipeline1 = provider.create(factor);
- stateManager.addPipeline(pipeline1);
- // New pipeline should not overlap with the previous created pipeline
- Assert.assertTrue(
- CollectionUtils.intersection(pipeline.getNodes(), pipeline1.getNodes())
- .isEmpty());
- Assert.assertEquals(pipeline1.getType(), HddsProtos.ReplicationType.RATIS);
- Assert.assertEquals(pipeline1.getFactor(), factor);
- Assert.assertEquals(Pipeline.PipelineState.ALLOCATED,
- pipeline1.getPipelineState());
- Assert.assertEquals(pipeline1.getNodes().size(), factor.getNumber());
- }
-
- @Test
- public void testCreatePipelineWithFactor() throws IOException {
- HddsProtos.ReplicationFactor factor = HddsProtos.ReplicationFactor.THREE;
- Pipeline pipeline = provider.create(factor);
- stateManager.addPipeline(pipeline);
- Assert.assertEquals(pipeline.getType(), HddsProtos.ReplicationType.RATIS);
- Assert.assertEquals(pipeline.getFactor(), factor);
- Assert.assertEquals(Pipeline.PipelineState.ALLOCATED,
- pipeline.getPipelineState());
- Assert.assertEquals(pipeline.getNodes().size(), factor.getNumber());
-
- factor = HddsProtos.ReplicationFactor.ONE;
- Pipeline pipeline1 = provider.create(factor);
- stateManager.addPipeline(pipeline1);
- // New pipeline should overlap with the previous created pipeline,
- // and one datanode should overlap between the two types.
- Assert.assertEquals(
- CollectionUtils.intersection(pipeline.getNodes(),
- pipeline1.getNodes()).size(), 1);
- Assert.assertEquals(pipeline1.getType(), HddsProtos.ReplicationType.RATIS);
- Assert.assertEquals(pipeline1.getFactor(), factor);
- Assert.assertEquals(Pipeline.PipelineState.ALLOCATED,
- pipeline1.getPipelineState());
- Assert.assertEquals(pipeline1.getNodes().size(), factor.getNumber());
- }
-
- @Test
- public void testCreatePipelineWithFactorThree() throws IOException {
- createPipelineAndAssertions(HddsProtos.ReplicationFactor.THREE);
- }
-
- @Test
- public void testCreatePipelineWithFactorOne() throws IOException {
- createPipelineAndAssertions(HddsProtos.ReplicationFactor.ONE);
- }
-
- private List<DatanodeDetails> createListOfNodes(int nodeCount) {
- List<DatanodeDetails> nodes = new ArrayList<>();
- for (int i = 0; i < nodeCount; i++) {
- nodes.add(TestUtils.randomDatanodeDetails());
- }
- return nodes;
- }
-
- @Test
- public void testCreatePipelineWithNodes() {
- HddsProtos.ReplicationFactor factor = HddsProtos.ReplicationFactor.THREE;
- Pipeline pipeline =
- provider.create(factor, createListOfNodes(factor.getNumber()));
- Assert.assertEquals(pipeline.getType(), HddsProtos.ReplicationType.RATIS);
- Assert.assertEquals(pipeline.getFactor(), factor);
- Assert.assertEquals(
- pipeline.getPipelineState(), Pipeline.PipelineState.OPEN);
- Assert.assertEquals(pipeline.getNodes().size(), factor.getNumber());
-
- factor = HddsProtos.ReplicationFactor.ONE;
- pipeline = provider.create(factor, createListOfNodes(factor.getNumber()));
- Assert.assertEquals(pipeline.getType(), HddsProtos.ReplicationType.RATIS);
- Assert.assertEquals(pipeline.getFactor(), factor);
- Assert.assertEquals(pipeline.getPipelineState(),
- Pipeline.PipelineState.OPEN);
- Assert.assertEquals(pipeline.getNodes().size(), factor.getNumber());
- }
-
- @Test
- public void testCreatePipelinesDnExclude() throws IOException {
-
- // We need 9 Healthy DNs in MockNodeManager.
- NodeManager mockNodeManager = new MockNodeManager(true, 12);
- PipelineStateManager stateManagerMock =
- new PipelineStateManager(new OzoneConfiguration());
- PipelineProvider providerMock = new MockRatisPipelineProvider(
- mockNodeManager, stateManagerMock, new OzoneConfiguration());
-
- // Use up first 3 DNs for an open pipeline.
- List<DatanodeDetails> openPiplineDns = mockNodeManager.getAllNodes()
- .subList(0, 3);
- HddsProtos.ReplicationFactor factor = HddsProtos.ReplicationFactor.THREE;
-
- Pipeline openPipeline = Pipeline.newBuilder()
- .setType(HddsProtos.ReplicationType.RATIS)
- .setFactor(factor)
- .setNodes(openPiplineDns)
- .setState(Pipeline.PipelineState.OPEN)
- .setId(PipelineID.randomId())
- .build();
-
- stateManagerMock.addPipeline(openPipeline);
-
- // Use up next 3 DNs also for an open pipeline.
- List<DatanodeDetails> moreOpenPiplineDns = mockNodeManager.getAllNodes()
- .subList(3, 6);
- Pipeline anotherOpenPipeline = Pipeline.newBuilder()
- .setType(HddsProtos.ReplicationType.RATIS)
- .setFactor(factor)
- .setNodes(moreOpenPiplineDns)
- .setState(Pipeline.PipelineState.OPEN)
- .setId(PipelineID.randomId())
- .build();
- stateManagerMock.addPipeline(anotherOpenPipeline);
-
- // Use up next 3 DNs also for a closed pipeline.
- List<DatanodeDetails> closedPiplineDns = mockNodeManager.getAllNodes()
- .subList(6, 9);
- Pipeline anotherClosedPipeline = Pipeline.newBuilder()
- .setType(HddsProtos.ReplicationType.RATIS)
- .setFactor(factor)
- .setNodes(closedPiplineDns)
- .setState(Pipeline.PipelineState.CLOSED)
- .setId(PipelineID.randomId())
- .build();
- stateManagerMock.addPipeline(anotherClosedPipeline);
-
- Pipeline pipeline = providerMock.create(factor);
- Assert.assertEquals(pipeline.getType(), HddsProtos.ReplicationType.RATIS);
- Assert.assertEquals(pipeline.getFactor(), factor);
- Assert.assertEquals(Pipeline.PipelineState.ALLOCATED,
- pipeline.getPipelineState());
- Assert.assertEquals(pipeline.getNodes().size(), factor.getNumber());
- List<DatanodeDetails> pipelineNodes = pipeline.getNodes();
-
- // Pipline nodes cannot be from open pipelines.
- Assert.assertTrue(
- pipelineNodes.parallelStream().filter(dn ->
- (openPiplineDns.contains(dn) || moreOpenPiplineDns.contains(dn)))
- .count() == 0);
-
- // Since we have only 9 Healthy DNs, at least 1 pipeline node should have
- // been from the closed pipeline DN list.
- Assert.assertTrue(pipelineNodes.parallelStream().filter(
- closedPiplineDns::contains).count() > 0);
- }
-}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]