Exemplo n.º 1
0
    def test_create_image_and_boot_instances(self, mock_boot_servers):
        image_service = self.mock_image.return_value

        fake_image = fakes.FakeImage()
        fake_servers = [mock.Mock() for i in range(5)]
        image_service.create_image.return_value = fake_image
        mock_boot_servers.return_value = fake_servers
        create_image_kwargs = {"fakeimagearg": "f"}
        boot_server_kwargs = {"fakeserverarg": "f"}
        call_args = {
            "container_format": "cf",
            "image_location": "url",
            "disk_format": "df",
            "fakeimagearg": "f"
        }

        images.CreateImageAndBootInstances(self.context).run(
            "cf",
            "url",
            "df",
            "fid",
            5,
            create_image_kwargs=create_image_kwargs,
            boot_server_kwargs=boot_server_kwargs)
        image_service.create_image.assert_called_once_with(**call_args)
        mock_boot_servers.assert_called_once_with("image-id-0", "fid", 5,
                                                  **boot_server_kwargs)
Exemplo n.º 2
0
    def test_create_image_and_boot_instances(self, mock_boot_servers):
        image_service = self.mock_image.return_value

        fake_image = fakes.FakeImage()
        fake_servers = [mock.Mock() for i in range(5)]
        image_service.create_image.return_value = fake_image
        mock_boot_servers.return_value = fake_servers
        boot_server_kwargs = {"fakeserverarg": "f"}
        properties = {"fakeprop": "fake"}
        call_args = {
            "container_format": "cf",
            "image_location": "url",
            "disk_format": "df",
            "visibility": "vs",
            "min_disk": 0,
            "min_ram": 0,
            "properties": properties
        }

        images.CreateImageAndBootInstances(self.context).run(
            "cf",
            "url",
            "df",
            "fid",
            5,
            visibility="vs",
            min_disk=0,
            min_ram=0,
            properties=properties,
            boot_server_kwargs=boot_server_kwargs)
        image_service.create_image.assert_called_once_with(**call_args)
        mock_boot_servers.assert_called_once_with("image-id-0", "fid", 5,
                                                  **boot_server_kwargs)
Exemplo n.º 3
0
    def test_create_image_and_boot_instances(self, mock_create_image,
                                             mock_boot_servers):
        fake_image = fakes.FakeImage()
        fake_servers = [mock.Mock() for i in range(5)]
        mock_create_image.return_value = fake_image
        mock_boot_servers.return_value = fake_servers
        kwargs = {"fakearg": "f"}

        images.CreateImageAndBootInstances(self.context).run(
            "cf", "url", "df", "fid", 5, **kwargs)
        mock_create_image.assert_called_once_with("cf", "url", "df")
        mock_boot_servers.assert_called_once_with("image-id-0", "fid", 5,
                                                  **kwargs)