Example #1
0
 def test__wait_for_ping(self):
     vm_scenario = utils.VMScenario(self.context)
     vm_scenario._ping_ip_address = mock.Mock(return_value=True)
     vm_scenario._wait_for_ping(netaddr.IPAddress("1.2.3.4"))
     self.mock_wait_for_status.mock.assert_called_once_with(
         utils.Host("1.2.3.4"),
         ready_statuses=[utils.Host.ICMP_UP_STATUS],
         update_resource=utils.Host.update_status,
         timeout=CONF.openstack.vm_ping_timeout,
         check_interval=CONF.openstack.vm_ping_poll_interval)
Example #2
0
    def test__ping_ip_address_other_os_ipv6(self, mock_popen, mock_sys):
        mock_popen.return_value.returncode = 0
        mock_sys.platform = "freebsd10"

        host = utils.Host("1ce:c01d:bee2:15:a5:900d:a5:11fe")
        self.assertEqual(utils.Host.ICMP_UP_STATUS,
                         utils.Host.update_status(host).status)

        mock_popen.assert_called_once_with(
            ["ping6", "-c1", str(host.ip)],
            stderr=subprocess.PIPE, stdout=subprocess.PIPE)
        mock_popen.return_value.wait.assert_called_once_with()
Example #3
0
    def test__ping_ip_address_linux(self, mock_popen, mock_sys):
        mock_popen.return_value.returncode = 0
        mock_sys.platform = "linux2"

        host = utils.Host("1.2.3.4")
        self.assertEqual(utils.Host.ICMP_UP_STATUS,
                         utils.Host.update_status(host).status)

        mock_popen.assert_called_once_with(
            ["ping", "-c1", "-w1", str(host.ip)],
            stderr=subprocess.PIPE, stdout=subprocess.PIPE)
        mock_popen.return_value.wait.assert_called_once_with()