コード例 #1
0
    def test_create_snapshot_get_volume_not_found(self):
        volume = self._prepare_mocks_for_create_snapshot()
        self.client_mock.create_volume.return_value = volume
        self.client_mock.get_volume.side_effect = NotFound("404")

        with self.assertRaises(array_errors.ObjectNotFoundError):
            self.array.create_snapshot("volume_id", "target_volume", pool=self.volume_response.pool)
コード例 #2
0
 def test_delete_snapshot_failed_with_not_found(self):
     self.client_mock.get_volume.side_effect = NotFound("404")
     with self.assertRaises(array_errors.ObjectNotFoundError):
         self.array.delete_snapshot("fake_id")
     self.client_mock.get_volume.side_effect = [self.snapshot_response]
     self.client_mock.get_flashcopies_by_volume.return_value = [self.flashcopy_response]
     with self.assertRaises(array_errors.ObjectNotFoundError):
         self.array.delete_snapshot("fake_id")
コード例 #3
0
 def test_expand_volume_extend_volume_not_found_error(self):
     self.client_mock.get_volume.side_effect = [
         self.volume_response, self.volume_response
     ]
     self.client_mock.extend_volume.side_effect = [
         NotFound("404", message="BE7A0001")
     ]
     with self.assertRaises(array_errors.ObjectNotFoundError):
         self.array.expand_volume(volume_id="test_id", required_bytes=10)
コード例 #4
0
    def test_create_snapshot_get_volume_not_found(self):
        self.client_mock.create_volume = Mock()
        self.client_mock.get_volume.side_effect = NotFound("404")

        with self.assertRaises(array_errors.ObjectNotFoundError):
            self.array.create_snapshot("volume_id",
                                       "target_volume",
                                       space_efficiency=None,
                                       pool=self.volume_response.pool)
コード例 #5
0
    def test_get_snapshot_get_fcrel_not_exist_raise_error(self):
        target_vol = self._get_volume_with_flashcopy_relationship()
        self.client_mock.get_volumes_by_pool.return_value = [target_vol]
        self.client_mock.get_flashcopies.side_effect = NotFound(
            "404", message="BE7A0001")

        with self.assertRaises(NotFound):
            self.array.get_snapshot("test_name",
                                    volume_context={
                                        config.CONTEXT_POOL:
                                        self.volume_response.pool
                                    })
コード例 #6
0
 def test_get_object_by_id_return_none(self):
     self.client_mock.get_volume.side_effect = NotFound("404")
     return_value = self.array.get_object_by_id("", "volume")
     self.assertEqual(return_value, None)
コード例 #7
0
 def test_copy_to_existing_volume_raise_not_found(self):
     self._test_copy_to_existing_volume_raise_errors(
         client_method=self.client_mock.extend_volume,
         client_error=NotFound("404"),
         expected_error=array_errors.ObjectNotFoundError)
コード例 #8
0
 def test_unmap_volume_already_unmapped(self):
     self.client_mock.get_host_mappings.side_effect = NotFound(
         "404", message='BE7A001F')
     with self.assertRaises(array_errors.VolumeAlreadyUnmappedError):
         self.array.unmap_volume("fake_name", "fake_host")
コード例 #9
0
 def test_unmap_volume_host_not_found(self):
     self.client_mock.get_host_mappings.side_effect = NotFound(
         "404", message='BE7A0016')
     with self.assertRaises(array_errors.HostNotFoundError):
         self.array.unmap_volume("fake_name", "fake_host")
コード例 #10
0
 def test_map_volume_host_not_found(self):
     self.client_mock.map_volume_to_host.side_effect = NotFound("404")
     with self.assertRaises(array_errors.HostNotFoundError):
         self.array.map_volume("fake_name", "fake_host",
                               "fake_connectivity_type")
コード例 #11
0
 def test_delete_volume_fail_with_NotFound(self):
     self.client_mock.delete_volume.side_effect = NotFound("404")
     with self.assertRaises(array_errors.ObjectNotFoundError):
         self.array.delete_volume("fake_id")
コード例 #12
0
 def test_create_volume_fail_with_pool_not_found(self):
     self.client_mock.create_volume.side_effect = NotFound(
         "404", message="BE7A0001")
     with self.assertRaises(array_errors.PoolDoesNotExist):
         self.array.create_volume("fake_name", 1, 'thin', "fake_pool")
コード例 #13
0
 def test_copy_to_existing_volume_raise_not_found(self):
     self._prepare_mocks_for_copy_to_existing_volume()
     self.client_mock.extend_volume.side_effect = NotFound("404")
     with self.assertRaises(array_errors.ObjectNotFoundError):
         self.array.copy_to_existing_volume_from_source(
             "test_name", "source_name", 3, 2, "fake_pool")
コード例 #14
0
 def test_create_volume_failed_with_incorrect_id(self):
     self.client_mock.get_volumes_by_pool.side_effect = NotFound(
         "500", message="BE7A0005")
     with self.assertRaises(array_errors.PoolDoesNotExist):
         self.array.create_volume("fake_name", 1, {}, "fake_pool")
コード例 #15
0
 def test_delete_snapshot_failed_with_NotFound(self):
     self.client_mock.get_volume.side_effect = NotFound("404")
     with self.assertRaises(array_errors.SnapshotNotFoundError):
         self.array.delete_snapshot("fake_name")