Exemplo n.º 1
0
    def install(self):
        if not self.is_installed():
            try:
                if not os.path.exists(Tempest.tempest_base_path):
                    Tempest._clone()

                if not os.path.exists(self.tempest_path):
                    shutil.copytree(Tempest.tempest_base_path,
                                    self.tempest_path)
                    subprocess.check_call(
                        "git checkout master; "
                        "git remote update; "
                        "git pull",
                        shell=True,
                        cwd=os.path.join(self.tempest_path, "tempest"))
                self._install_venv()
                self._initialize_testr()
            except subprocess.CalledProcessError as e:
                self.uninstall()
                raise exceptions.TempestSetupFailure("failed cmd: '%s'", e.cmd)
            else:
                print("Tempest has been successfully installed!")

        else:
            print("Tempest is already installed")
Exemplo n.º 2
0
    def test_setup_failure_on_tempest_installation(self, mock_install,
                                                   mock_is_installed,
                                                   mock_is_cfg, mock_mkdir):
        mock_install.side_effect = exceptions.TempestSetupFailure()

        benchmark = tempest.Tempest(self.context)

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