Example #1
0
    def test_cleanup(self, mock_shutil, mock_exists):
        benchmark = tempest.Tempest(self.context)
        benchmark.verifier = mock.MagicMock()
        benchmark.results_dir = "/tmp/path"

        benchmark.cleanup()

        mock_shutil.rmtree.assert_called_once_with("/tmp/path")
Example #2
0
    def test_setup_with_no_configuration(
            self, mock_tempest_generate_config_file, mock_tempest_is_installed,
            mock_tempest_is_configured, mock_mkdir):

        benchmark = tempest.Tempest(self.context)
        benchmark.setup()
        self.assertEqual(1, mock_tempest_is_installed.call_count)
        self.assertEqual("/dev/null", benchmark.verifier.log_file_raw)
        self.assertEqual(1, mock_tempest_generate_config_file.call_count)
Example #3
0
    def test_setup_failure_on_tempest_configuration(
            self, mock_tempest_generate_config_file, mock_tempest_is_installed,
            mock_tempest_is_configured, mock_mkdir):
        mock_tempest_generate_config_file.side_effect = (
            config.TempestConfigCreationFailure())

        benchmark = tempest.Tempest(self.context)

        self.assertRaises(exceptions.BenchmarkSetupFailure, benchmark.setup)
        self.assertEqual(1, mock_tempest_is_configured.call_count)
Example #4
0
    def test_setup_failure_on_tempest_installation(
            self, mock_tempest_install, mock_tempest_is_installed,
            mock_tempest_is_configured, mock_mkdir):
        mock_tempest_install.side_effect = (
            tempest_verifier.TempestSetupFailure()
        )

        benchmark = tempest.Tempest(self.context)

        self.assertRaises(exceptions.BenchmarkSetupFailure, benchmark.setup)
        self.assertEqual(0, mock_tempest_is_configured.call_count)