Attila Doroszlai created HDDS-13485:
---------------------------------------

             Summary: Reduce duplication between ContainerSafeModeRule tests
                 Key: HDDS-13485
                 URL: https://issues.apache.org/jira/browse/HDDS-13485
             Project: Apache Ozone
          Issue Type: Sub-task
          Components: test
    Affects Versions: 2.1.0
            Reporter: Attila Doroszlai


The goal of this task is to reduce duplication between 
TestECContainerSafeModeRule and TestRatisContainerSafeModeRule.  Test steps are 
the same, the only difference is the container type being used.

Example:

{code}
  48   │    @Test
  49   │ -  public void testRefreshInitializeECContainers() {
  50   │ +  public void testRefreshInitializeRatisContainers() {
  51   │      List<ContainerInfo> containers = Arrays.asList(
  52   │ -        mockECContainer(LifeCycleState.CLOSED, 1L),
  53   │ -        mockECContainer(LifeCycleState.OPEN, 2L)
  54   │ +        mockRatisContainer(LifeCycleState.CLOSED, 1L),
  55   │ +        mockRatisContainer(LifeCycleState.OPEN, 2L)
  56   │      );
  57   │  
  58   │ -    
when(containerManager.getContainers(ReplicationType.EC)).thenReturn(containers);
  59   │ +    
when(containerManager.getContainers(ReplicationType.RATIS)).thenReturn(containers);
  60   │  
  61   │      rule.refresh(false);
{code}

Some test cases (e.g. testDuplicateContainerIdsInReports) for EC mock a few 
extra calls, but I think these would be safe to do for both types.

Please extract an abstract parent class, and let subclasses implement the real 
differences.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to