Esempio n. 1
0
    def test_docker_vars(self, total_memory):
        total_memory.return_value = convert.gb_to_bytes(64)
        tmp = tempfile.gettempdir()

        docker = provisioner.DockerProvisioner("defaults", "39200", tmp, "5.0.0", "../../")

        self.assertEqual({
            "es_java_opts": "",
            "container_memory_gb": "32g",
            "es_data_dir": "%s/data" % tmp,
            "es_version": "5.0.0",
            "http_port": "39200"
        }, docker.docker_vars)
Esempio n. 2
0
    def test_docker_vars(self, total_memory):
        total_memory.return_value = convert.gb_to_bytes(64)
        tmp = tempfile.gettempdir()

        rally_root = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../esrally"))

        docker = provisioner.DockerProvisioner("defaults", {"indices.query.bool.max_clause_count": 5000}, "39200", tmp, "5.0.0", rally_root)

        self.assertEqual({
            "es_java_opts": "",
            "container_memory_gb": "32g",
            "es_data_dir": "%s/data" % tmp,
            "es_version": "5.0.0",
            "http_port": "39200",
            "cluster_settings": {
                "indices.query.bool.max_clause_count": 5000
            }
        }, docker.docker_vars)

        docker_cfg = docker._render_template_from_file(docker.docker_vars)
        self.assertEqual(
"""version: '2'
services:
  elasticsearch1:
    cap_add:
      - IPC_LOCK
    environment:
      - discovery.zen.minimum_master_nodes=1
      - bootstrap.memory_lock=true
      - xpack.security.enabled=false
      - "ES_JAVA_OPTS="
      - indices.query.bool.max_clause_count=5000
    image: "docker.elastic.co/elasticsearch/elasticsearch:5.0.0"
    mem_limit: 32g
    ports:
      - 39200:9200
      - 9300
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    volumes:
      - esdata1:%s/data
volumes:
  esdata1:
    driver: local""" % tmp
, docker_cfg
        )
Esempio n. 3
0
    def test_provisioning(self, uuid4, total_memory):
        total_memory.return_value = convert.gb_to_bytes(64)
        uuid4.return_value = "9dbc682e-d32a-4669-8fbe-56fb77120dd4"
        node_root_dir = tempfile.gettempdir()
        log_dir = os.path.join(node_root_dir, "logs", "server")
        data_dir = "%s/data/9dbc682e-d32a-4669-8fbe-56fb77120dd4" % node_root_dir

        rally_root = os.path.normpath(
            os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         "../../esrally"))

        c = team.Car("unit-test-car",
                     "/tmp",
                     variables={"xpack.security.enabled": False})

        docker = provisioner.DockerProvisioner(
            car=c,
            node_name="rally-node-0",
            cluster_settings={"indices.query.bool.max_clause_count": 5000},
            ip="10.17.22.33",
            http_port=39200,
            node_root_dir=node_root_dir,
            distribution_version="5.0.0",
            rally_root=rally_root,
            preserve=False)

        self.assertEqual(
            {
                "cluster_name": "rally-benchmark",
                "node_name": "rally-node-0",
                "data_paths": ["/usr/share/elasticsearch/data"],
                "log_path": "/var/log/elasticsearch",
                "network_host": "0.0.0.0",
                "http_port": "39200-39300",
                "transport_port": "39300-39400",
                "node_count_per_host": 1,
                "cluster_settings": {
                    "xpack.security.enabled": "false",
                    "xpack.ml.enabled": "false",
                    "xpack.monitoring.enabled": "false",
                    "xpack.watcher.enabled": "false",
                    "indices.query.bool.max_clause_count": 5000
                },
                "xpack.security.enabled": False
            }, docker.config_vars)

        self.assertEqual(
            {
                "es_data_dir": data_dir,
                "es_log_dir": log_dir,
                "es_version": "5.0.0",
                "http_port": 39200,
                "mounts": {}
            }, docker.docker_vars(mounts={}))

        docker_cfg = docker._render_template_from_file(
            docker.docker_vars(mounts={}))

        self.assertEqual(
            """version: '2'
services:
  elasticsearch1:
    cap_add:
      - IPC_LOCK
    image: "docker.elastic.co/elasticsearch/elasticsearch:5.0.0"
    ports:
      - 39200:39200
      - 9300
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - %s:/usr/share/elasticsearch/data
      - %s:/var/log/elasticsearch""" % (data_dir, log_dir), docker_cfg)
    def test_provisioning(self, total_memory):
        total_memory.return_value = convert.gb_to_bytes(64)
        node_root_dir = tempfile.gettempdir()
        log_dir = os.path.join(node_root_dir, "logs", "server")

        rally_root = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../esrally"))

        c = team.Car("unit-test-car", "/tmp", variables={
            "xpack.security.enabled": False
        })

        docker = provisioner.DockerProvisioner(car=c,
                                               node_name="rally-node-0",
                                               cluster_settings={"indices.query.bool.max_clause_count": 5000},
                                               ip="10.17.22.33",
                                               http_port=39200,
                                               node_root_dir=node_root_dir,
                                               distribution_version="5.0.0",
                                               rally_root=rally_root,
                                               preserve=False)

        self.assertEqual({
            "cluster_name": "rally-benchmark",
            "node_name": "rally-node-0",
            "data_paths": ["/usr/share/elasticsearch/data"],
            "log_path": "/var/log/elasticsearch",
            "network_host": "0.0.0.0",
            "http_port": "39200-39300",
            "transport_port": "39300-39400",
            "node_count_per_host": 1,
            "cluster_settings": {
                "xpack.security.enabled": "false",
                "xpack.ml.enabled": "false",
                "xpack.monitoring.enabled": "false",
                "xpack.watcher.enabled": "false",
                "indices.query.bool.max_clause_count": 5000
            },
            "xpack.security.enabled": False
        }, docker.config_vars)

        self.assertEqual({
            "es_data_dir": "%s/install/data" % node_root_dir,
            "es_log_dir": log_dir,
            "es_version": "5.0.0",
            "http_port": 39200,
            "mounts": {}
        }, docker.docker_vars(mounts={}))

        docker_cfg = docker._render_template_from_file(docker.docker_vars(mounts={}))

        self.assertEqual(
"""version: '2'
services:
  elasticsearch1:
    cap_add:
      - IPC_LOCK
    image: "docker.elastic.co/elasticsearch/elasticsearch:5.0.0"
    ports:
      - 39200:39200
      - 9300
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - %s/install/data:/usr/share/elasticsearch/data
      - %s:/var/log/elasticsearch""" % (node_root_dir, log_dir), docker_cfg)