コード例 #1
0
ファイル: test_volumes.py プロジェクト: zhangdelong/rally
    def test_create_and_extend_volume(self):
        mock_service = self.mock_cinder.return_value

        scenario = volumes.CreateAndExtendVolume(self._get_context())
        scenario.sleep_between = mock.MagicMock()

        scenario.run(1, 2, 10, 20, fakearg="f")
        mock_service.create_volume.assert_called_once_with(1, fakearg="f")
        mock_service.extend_volume.assert_called_once_with(
            mock_service.create_volume.return_value, new_size=2)
        scenario.sleep_between.assert_called_once_with(10, 20)
        mock_service.delete_volume.assert_called_once_with(
            mock_service.create_volume.return_value)
コード例 #2
0
ファイル: test_volumes.py プロジェクト: 1990ajay/rally
    def test_create_and_extend_volume(self):
        fake_volume = mock.MagicMock()

        scenario = volumes.CreateAndExtendVolume(self.context)
        scenario._create_volume = mock.MagicMock(return_value=fake_volume)
        scenario._extend_volume = mock.MagicMock(return_value=fake_volume)
        scenario.sleep_between = mock.MagicMock()
        scenario._delete_volume = mock.MagicMock()

        scenario.run(1, 2, 10, 20, fakearg="f")
        scenario._create_volume.assert_called_once_with(1, fakearg="f")
        self.assertTrue(scenario._extend_volume.called)
        scenario.sleep_between.assert_called_once_with(10, 20)
        scenario._delete_volume.assert_called_once_with(fake_volume)