def test_excludes_all_ips_success(self):
     """
     :class:`ExcludesAllIPs` succeeds when the nodes do not contain any of
     the IPs given.
     """
     matcher = ExcludesAllIPs(['10.0.0.1', '10.0.0.1'])
     mismatch = matcher.match([
         {'id': i, 'address': '10.0.0.{0}'.format(i)}
         for i in (2, 3)
     ])
     self.assertEqual(None, mismatch)
Exemplo n.º 2
0
 def test_excludes_all_ips_success(self):
     """
     :class:`ExcludesAllIPs` succeeds when the nodes do not contain any of
     the IPs given.
     """
     matcher = ExcludesAllIPs(['10.0.0.1', '10.0.0.1'])
     mismatch = matcher.match([{
         'id': i,
         'address': '10.0.0.{0}'.format(i)
     } for i in (2, 3)])
     self.assertEqual(None, mismatch)
 def test_excludes_all_ips_failure(self):
     """
     :class:`ExcludesAllIPs` fails when the nodes contain any or all of
     the IPs given.
     """
     matcher = ExcludesAllIPs(['10.0.0.1', '10.0.0.2'])
     self.assertNotEqual(
         None,
         matcher.match([{'id': i, 'address': '10.0.0.{0}'.format(i)}
                        for i in (1, 2)]),
         "Complete match succeeds when none should be present."
     )
     self.assertNotEqual(
         None,
         matcher.match([{'id': 1, 'address': '10.0.0.1'}]),
         "Partial match succeeds when none should be present."
     )
Exemplo n.º 4
0
 def test_excludes_all_ips_failure(self):
     """
     :class:`ExcludesAllIPs` fails when the nodes contain any or all of
     the IPs given.
     """
     matcher = ExcludesAllIPs(['10.0.0.1', '10.0.0.2'])
     self.assertNotEqual(
         None,
         matcher.match([{
             'id': i,
             'address': '10.0.0.{0}'.format(i)
         } for i in (1, 2)]),
         "Complete match succeeds when none should be present.")
     self.assertNotEqual(
         None, matcher.match([{
             'id': 1,
             'address': '10.0.0.1'
         }]), "Partial match succeeds when none should be present.")
Exemplo n.º 5
0
    def test_changing_disowned_server_is_not_converged_1(self):
        """
        Moving a disowned autoscale server to a different CLB and converging
        will not move the disowned server back on its intended CLB.

        1. Create an AS group with CLB and 2 servers.
        2. Disown 1 server.
        3. Remove both servers from group CLB and add to a different CLB.
        4. Converge group.
        5. Assert that the group's server is back on its CLB and it is not
           removed from other CLB. Disowned server remains on the other CLB.
        """
        group, clb_as, clb_other, gone_ip, stay_ip = (
            yield self._disown_change_and_converge(True))

        yield gatherResults([
            clb_as.wait_for_nodes(self.rcs,
                                  MatchesAll(ExcludesAllIPs([gone_ip]),
                                             ContainsAllIPs([stay_ip]),
                                             HasLength(1)),
                                  timeout=timeout_default),
            clb_other.wait_for_nodes(self.rcs,
                                     MatchesAll(
                                         ContainsAllIPs([stay_ip, gone_ip]),
                                         HasLength(2)),
                                     timeout=timeout_default),
            group.wait_for_state(self.rcs,
                                 MatchesAll(
                                     ContainsDict({
                                         'pendingCapacity': Equals(0),
                                         'desiredCapacity': Equals(1),
                                         'status': Equals('ACTIVE'),
                                         'active': HasLength(1)
                                     })),
                                 timeout=timeout_default),
        ])