Exemplo n.º 1
0
 def test_no_clb_steps(self):
     """
     Returns same steps when there are no CLB steps passed
     """
     steps = [
         CreateServer(server_config=pmap({"name": "server"})),
         DeleteServer(server_id="abc")
     ]
     self.assertEqual(list(one_clb_step(steps)), steps)
Exemplo n.º 2
0
 def test_no_clb_steps(self):
     """
     Returns same steps when there are no CLB steps passed
     """
     steps = [
         CreateServer(server_config=pmap({"name": "server"})),
         DeleteServer(server_id="abc")
     ]
     self.assertEqual(list(one_clb_step(steps)), steps)
Exemplo n.º 3
0
 def test_mixed(self):
     """
     When there are multiple steps of same CLB then first step of each CLB
     is returned
     """
     steps = [
         CreateServer(server_config=pmap({"name": "server"})),
         DeleteServer(server_id="abc"),
         AddNodesToCLB(
             lb_id='5',
             address_configs=s(('1.1.1.1',
                                CLBDescription(lb_id='5', port=80)))),
         RemoveNodesFromCLB(lb_id='5', node_ids=s('1')),
         RemoveNodesFromCLB(lb_id='6', node_ids=s('3')),
         AddNodesToCLB(
             lb_id='6',
             address_configs=s(('2.1.1.1',
                                CLBDescription(lb_id='6', port=80)))),
         ChangeCLBNode(
             lb_id='7',
             node_id='9',
             condition=CLBNodeCondition.ENABLED,
             weight=10,
             type=CLBNodeType.PRIMARY),
         RemoveNodesFromCLB(lb_id='7', node_ids=s('4')),
         AddNodesToCLB(
             lb_id='7',
             address_configs=s(('3.1.1.1',
                                CLBDescription(lb_id='9', port=80)))),
         ChangeCLBNode(
             lb_id='5',
             node_id='11',
             condition=CLBNodeCondition.ENABLED,
             weight=10,
             type=CLBNodeType.PRIMARY)
     ]
     self.assertEqual(
         list(one_clb_step(steps)),
         (steps[:3] +    # Non-CLB steps and 1 step for CLB 5
          [steps[4]] +   # One step for CLB 6
          [steps[6]])    # One step for CLB 7
     )
Exemplo n.º 4
0
 def test_mixed(self):
     """
     When there are multiple steps of same CLB then first step of each CLB
     is returned
     """
     steps = [
         CreateServer(server_config=pmap({"name": "server"})),
         DeleteServer(server_id="abc"),
         AddNodesToCLB(lb_id='5',
                       address_configs=s(
                           ('1.1.1.1', CLBDescription(lb_id='5',
                                                      port=80)))),
         RemoveNodesFromCLB(lb_id='5', node_ids=s('1')),
         RemoveNodesFromCLB(lb_id='6', node_ids=s('3')),
         AddNodesToCLB(lb_id='6',
                       address_configs=s(
                           ('2.1.1.1', CLBDescription(lb_id='6',
                                                      port=80)))),
         ChangeCLBNode(lb_id='7',
                       node_id='9',
                       condition=CLBNodeCondition.ENABLED,
                       weight=10,
                       type=CLBNodeType.PRIMARY),
         RemoveNodesFromCLB(lb_id='7', node_ids=s('4')),
         AddNodesToCLB(lb_id='7',
                       address_configs=s(
                           ('3.1.1.1', CLBDescription(lb_id='9',
                                                      port=80)))),
         ChangeCLBNode(lb_id='5',
                       node_id='11',
                       condition=CLBNodeCondition.ENABLED,
                       weight=10,
                       type=CLBNodeType.PRIMARY)
     ]
     self.assertEqual(
         list(one_clb_step(steps)),
         (
             steps[:3] +  # Non-CLB steps and 1 step for CLB 5
             [steps[4]] +  # One step for CLB 6
             [steps[6]])  # One step for CLB 7
     )