def test_client_create_snapshot_not_available(self): clt = self.client vol = self.volume name = utils.random_name() description = utils.random_name() cli_exc = exc.ClientException(409, "Request conflicts with in-progress") vol._snapshot_manager.create = Mock(side_effect=cli_exc) self.assertRaises(exc.VolumeNotAvailable, clt.create_snapshot, vol, name=name, description=description)
def test_client_create_snapshot_not_409(self): clt = self.client vol = self.volume name = utils.random_unicode() description = utils.random_unicode() cli_exc = exc.ClientException(420, "FAKE") sav = BaseManager.create BaseManager.create = Mock(side_effect=cli_exc) self.assertRaises(exc.ClientException, clt.create_snapshot, vol, name=name, description=description) BaseManager.create = sav
def test_snapshot_delete_retry(self): snap = self.snapshot snap.manager.delete = Mock(side_effect=exc.ClientException( "Request conflicts with in-progress 'DELETE")) pyrax.cloudblockstorage.RETRY_INTERVAL = 0.1 self.assertRaises(exc.ClientException, snap.delete)