You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by sh...@apache.org on 2021/02/08 11:05:34 UTC

[ozone] branch HDDS-2823 updated: HDDS-4804. Fix TestReconContainerManager after merge master to HDDS-2823 (#1905)

This is an automated email from the ASF dual-hosted git repository.

shashikant pushed a commit to branch HDDS-2823
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/HDDS-2823 by this push:
     new 56bf321  HDDS-4804. Fix TestReconContainerManager after merge master to HDDS-2823 (#1905)
56bf321 is described below

commit 56bf321a98fa809c6a0b3e5acbb6140ff2f7aa21
Author: GlenGeng <gl...@tencent.com>
AuthorDate: Mon Feb 8 19:05:20 2021 +0800

    HDDS-4804. Fix TestReconContainerManager after merge master to HDDS-2823 (#1905)
---
 .../ozone/recon/scm/TestReconContainerManager.java | 23 +++++++++-------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/scm/TestReconContainerManager.java b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/scm/TestReconContainerManager.java
index 3b09989..4da43d8 100644
--- a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/scm/TestReconContainerManager.java
+++ b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/scm/TestReconContainerManager.java
@@ -51,9 +51,6 @@ import org.junit.Test;
  */
 public class TestReconContainerManager
     extends AbstractReconContainerManagerTest {
-
-  private Pipeline pipeline =  getRandomPipeline();
-
   @Test
   public void testAddNewOpenContainer() throws IOException {
     ContainerWithPipeline containerWithPipeline =
@@ -154,7 +151,7 @@ public class TestReconContainerManager
         getContainerManager().getContainer(containerID).getState());
   }
 
-  ContainerInfo newContainerInfo(long containerId) {
+  ContainerInfo newContainerInfo(long containerId, Pipeline pipeline) {
     return new ContainerInfo.Builder()
         .setContainerID(containerId)
         .setReplicationType(HddsProtos.ReplicationType.RATIS)
@@ -166,15 +163,6 @@ public class TestReconContainerManager
         .build();
   }
 
-  void putContainerInfos(ReconContainerManager containerManager, int num)
-      throws IOException {
-    for (int i = 1; i <= num; i++) {
-      final ContainerInfo info = newContainerInfo(i);
-      containerManager.addNewContainer(i,
-          new ContainerWithPipeline(info, pipeline));
-    }
-  }
-
   @Test
   public void testUpdateAndRemoveContainerReplica() throws IOException {
     // Sanity checking updateContainerReplica and ContainerReplicaHistory
@@ -198,7 +186,14 @@ public class TestReconContainerManager
     Assert.assertEquals(0, repHistMap.size());
 
     // Put a replica info and call updateContainerReplica
-    putContainerInfos(containerManager, 10);
+    Pipeline pipeline = getRandomPipeline();
+    getPipelineManager().addPipeline(pipeline);
+    for (int i = 1; i <= 10; i++) {
+      final ContainerInfo info = newContainerInfo(i, pipeline);
+      containerManager.addNewContainer(i,
+          new ContainerWithPipeline(info, pipeline));
+    }
+
     containerManager.updateContainerReplica(containerID1, containerReplica1);
     // Should have 1 container entry in the replica history map
     Assert.assertEquals(1, repHistMap.size());


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org