コード例 #1
0
ファイル: provisioner_test.py プロジェクト: up1/rally
    def test_prepare(self, mock_path_exists, mock_rm, mock_ensure_dir,
                     mock_decompress, mock_open):
        mock_path_exists.return_value = True

        cfg = config.Config()
        cfg.add(config.Scope.application, "system", "env.name", "unittest")
        cfg.add(config.Scope.application, "system", "challenge.root.dir",
                "/rally-root/track/challenge")
        cfg.add(config.Scope.application, "benchmarks", "car", "defaults")
        cfg.add(config.Scope.application, "builder", "candidate.bin.path",
                "/data/builds/distributions/")
        cfg.add(config.Scope.application, "provisioning", "local.install.dir",
                "es-bin")
        cfg.add(config.Scope.application, "provisioning", "install.preserve",
                False)
        cfg.add(config.Scope.application, "provisioning", "datapaths",
                ["/var/elasticsearch"])
        cfg.add(config.Scope.application, "provisioning", "node.http.port",
                39200)

        p = provisioner.Provisioner(cfg)
        p.prepare()

        self.assertEqual(cfg.opts("provisioning", "local.binary.path"),
                         "/install/elasticsearch-5.0.0-SNAPSHOT")
        self.assertEqual(cfg.opts("provisioning", "local.data.paths"),
                         ["/var/elasticsearch/data"])
コード例 #2
0
ファイル: mechanic.py プロジェクト: monk-ee/rally
 def __init__(self, cfg):
     self._config = cfg
     self._supplier = supplier.Supplier(cfg, supplier.GitRepository(cfg))
     self._builder = builder.Builder(cfg)
     self._provisioner = provisioner.Provisioner(cfg)
     self._launcher = launcher.InProcessLauncher(cfg)
     self._metrics_store = None
コード例 #3
0
    def test_prepare(self, mock_path_exists, mock_rm, mock_ensure_dir, mock_decompress, mock_open):
        mock_path_exists.return_value = True

        cfg = config.Config()
        cfg.add(config.Scope.application, "mechanic", "car.name", "defaults")
        cfg.add(config.Scope.application, "mechanic", "preserve.install", False)
        cfg.add(config.Scope.application, "mechanic", "node.datapaths", ["/var/elasticsearch"])

        p = provisioner.Provisioner(cfg, install_dir="es-bin", single_machine=True)
        p.prepare("/data/builds/distributions/")

        self.assertEqual(p.binary_path, "/install/elasticsearch-5.0.0-SNAPSHOT")
        self.assertEqual(p.data_paths, ["/var/elasticsearch/data"])
コード例 #4
0
    def test_cleanup_nothing_on_preserve(self, mock_path_exists, mock_rm):
        mock_path_exists.return_value = False

        cfg = config.Config()
        cfg.add(config.Scope.application, "mechanic", "car.name", "defaults")
        cfg.add(config.Scope.application, "mechanic", "preserve.install", True)
        cfg.add(config.Scope.application, "mechanic", "node.datapaths", ["/tmp/some/data-path-dir"])

        p = provisioner.Provisioner(cfg, install_dir="es-bin", single_machine=True)
        p.cleanup()

        mock_path_exists.assert_not_called()
        mock_rm.assert_not_called()
コード例 #5
0
ファイル: provisioner_test.py プロジェクト: dakrone/rally
    def test_cleanup_nothing(self, mock_path_exists, mock_rm):
        mock_path_exists.return_value = False

        cfg = config.Config()
        cfg.add(config.Scope.application, "system", "challenge.root.dir", "/rally-root/track/challenge")
        cfg.add(config.Scope.application, "provisioning", "local.install.dir", "es-bin")
        cfg.add(config.Scope.application, "provisioning", "install.preserve", False)

        p = provisioner.Provisioner(cfg)
        p.cleanup()

        mock_path_exists.assert_called_once_with("/rally-root/track/challenge/es-bin")
        mock_rm.assert_not_called()
コード例 #6
0
ファイル: provisioner_test.py プロジェクト: dakrone/rally
    def test_cleanup_nothing_on_preserve(self, mock_path_exists, mock_rm):
        mock_path_exists.return_value = False

        cfg = config.Config()
        cfg.add(config.Scope.application, "system", "challenge.root.dir", "/rally-root/track/challenge")
        cfg.add(config.Scope.application, "provisioning", "local.install.dir", "es-bin")
        cfg.add(config.Scope.application, "provisioning", "install.preserve", True)
        cfg.add(config.Scope.application, "provisioning", "datapaths", ["/tmp/some/data-path-dir"])

        p = provisioner.Provisioner(cfg)
        p.cleanup()

        mock_path_exists.assert_not_called()
        mock_rm.assert_not_called()
コード例 #7
0
    def test_cleanup(self, mock_path_exists, mock_rm):
        mock_path_exists.return_value = True

        cfg = config.Config()
        cfg.add(config.Scope.application, "mechanic", "preserve.install", False)
        cfg.add(config.Scope.application, "mechanic", "car.name", "defaults")
        cfg.add(config.Scope.application, "mechanic", "node.datapaths", ["/tmp/some/data-path-dir"])

        p = provisioner.Provisioner(cfg, install_dir="es-bin", single_machine=True)
        p.data_paths = ["/tmp/some/data-path-dir"]
        p.cleanup()

        expected_dir_calls = [mock.call("/tmp/some/data-path-dir"), mock.call("/rally-root/track/challenge/es-bin")]
        mock_path_exists.mock_calls = expected_dir_calls
        mock_rm.mock_calls = expected_dir_calls
コード例 #8
0
ファイル: provisioner_test.py プロジェクト: dakrone/rally
    def test_cleanup(self, mock_path_exists, mock_rm):
        mock_path_exists.return_value = True

        cfg = config.Config()
        cfg.add(config.Scope.application, "system", "challenge.root.dir", "/rally-root/track/challenge")
        cfg.add(config.Scope.application, "provisioning", "local.install.dir", "es-bin")
        cfg.add(config.Scope.application, "provisioning", "install.preserve", False)
        cfg.add(config.Scope.application, "provisioning", "datapaths", ["/tmp/some/data-path-dir"])

        p = provisioner.Provisioner(cfg)
        p.cleanup()

        expected_dir_calls = [mock.call("/tmp/some/data-path-dir"), mock.call("/rally-root/track/challenge/es-bin")]
        mock_path_exists.mock_calls = expected_dir_calls
        mock_rm.mock_calls = expected_dir_calls
コード例 #9
0
ファイル: mechanic.py プロジェクト: fengshao0907/rally
    def __init__(self, cfg):
        self._config = cfg
        self._supplier = supplier.Supplier(cfg)
        self._builder = builder.Builder(cfg)
        self._provisioner = provisioner.Provisioner(cfg)
        self._launcher = launcher.InProcessLauncher(cfg)
        self._metrics_store = None

        # TODO dm module refactoring: just moved it to the right place. Simplify (this should actually not be needed at all. It's just there
        # to ensure we don't mix ES installs)
        track_name = self._config.opts("system", "track")
        challenge_name = self._config.opts("benchmarks", "challenge")
        race_paths = paths.Paths(self._config)
        self._config.add(config.Scope.challenge, "system",
                         "challenge.root.dir",
                         race_paths.challenge_root(track_name, challenge_name))
        self._config.add(config.Scope.challenge, "system", "challenge.log.dir",
                         race_paths.challenge_logs(track_name, challenge_name))
コード例 #10
0
ファイル: provisioner_test.py プロジェクト: monk-ee/rally
    def test_prepare(self, mock_path_exists, mock_rm, mock_ensure_dir,
                     mock_unzip, mock_open):
        mock_path_exists.return_value = True

        cfg = config.Config()
        cfg.add(config.Scope.application, "system", "env.name", "unittest")
        cfg.add(config.Scope.application, "system", "track.setup.root.dir",
                "/rally-root/track/track-setup")
        cfg.add(config.Scope.application, "builder", "candidate.bin.path",
                "/data/builds/distributions/")
        cfg.add(config.Scope.application, "provisioning", "local.install.dir",
                "es-bin")
        cfg.add(config.Scope.application, "provisioning", "datapaths", [])

        track_setup = track.TrackSetup("test-track", "Description")

        p = provisioner.Provisioner(cfg)
        p.prepare(track_setup)

        self.assertEqual(cfg.opts("provisioning", "local.binary.path"),
                         "/install/elasticsearch-3.0.0-SNAPSHOT")
コード例 #11
0
ファイル: provisioner_test.py プロジェクト: cominvent/rally
    def test_prepare(self, mock_path_exists, mock_rm, mock_ensure_dir, mock_decompress, mock_open):
        mock_path_exists.return_value = True

        cfg = config.Config()
        cfg.add(config.Scope.application, "mechanic", "car.name", "defaults")
        cfg.add(config.Scope.application, "mechanic", "preserve.install", False)
        cfg.add(config.Scope.application, "mechanic", "node.datapaths", ["/var/elasticsearch"])

        p = provisioner.Provisioner(cfg,
                                    cluster_settings={"indices.query.bool.max_clause_count": 5000},
                                    install_dir="es-bin",
                                    single_machine=True)
        p.prepare("/data/builds/distributions/")

        self.assertEqual(p.binary_path, "/install/elasticsearch-5.0.0-SNAPSHOT")
        self.assertEqual(p.data_paths, ["/var/elasticsearch/data"])
        self.assertEqual(
"""
cluster.name: rally-benchmark
node.max_local_storage_nodes: 1
path.data: /var/elasticsearch/data
http.port: 39200-39300
transport.tcp.port: 39300-39400
indices.query.bool.max_clause_count: 5000""", p._node_configuration())