Skip to content

Commit

Permalink
Fix home directory paths in provisioner_test. (elastic#699)
Browse files Browse the repository at this point in the history
* Fix home directory paths in provisioner_test.
  • Loading branch information
drawlerr authored May 30, 2019
1 parent cc689df commit 9e4c1d3
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions tests/mechanic/provisioner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
import unittest.mock as mock
from unittest import TestCase

from esrally.mechanic import provisioner, team
from esrally.utils import convert
from esrally import exceptions
from esrally.mechanic import provisioner, team

HOME_DIR = os.path.expanduser("~")


class BareProvisionerTests(TestCase):
Expand All @@ -40,11 +41,11 @@ def null_apply_config(source_root_path, target_root_path, config_vars):
team.Car(
names="unit-test-car",
root_path=None,
config_paths=["~/.rally/benchmarks/teams/default/my-car"],
config_paths=[HOME_DIR + "/.rally/benchmarks/teams/default/my-car"],
variables={"heap": "4g"}),
java_home="/usr/local/javas/java8",
node_name="rally-node-0",
node_root_dir="~/.rally/benchmarks/races/unittest",
node_root_dir=HOME_DIR + "/.rally/benchmarks/races/unittest",
all_node_ips=["10.17.22.22", "10.17.22.23"],
ip="10.17.22.23",
http_port=9200)
Expand All @@ -63,7 +64,7 @@ def null_apply_config(source_root_path, target_root_path, config_vars):
self.assertEqual(1, len(apply_config_calls))
source_root_path, target_root_path, config_vars = apply_config_calls[0]

self.assertEqual("~/.rally/benchmarks/teams/default/my-car", source_root_path)
self.assertEqual(HOME_DIR + "/.rally/benchmarks/teams/default/my-car", source_root_path)
self.assertEqual("/opt/elasticsearch-5.0.0", target_root_path)
self.assertEqual({
"cluster_settings": {
Expand All @@ -73,8 +74,8 @@ def null_apply_config(source_root_path, target_root_path, config_vars):
"cluster_name": "rally-benchmark",
"node_name": "rally-node-0",
"data_paths": ["/opt/elasticsearch-5.0.0/data"],
"log_path": "~/.rally/benchmarks/races/unittest/logs/server",
"heap_dump_path": "~/.rally/benchmarks/races/unittest/heapdump",
"log_path": HOME_DIR + "/.rally/benchmarks/races/unittest/logs/server",
"heap_dump_path": HOME_DIR + "/.rally/benchmarks/races/unittest/heapdump",
"node_ip": "10.17.22.23",
"network_host": "10.17.22.23",
"http_port": "9200-9300",
Expand Down Expand Up @@ -145,11 +146,11 @@ def null_apply_config(source_root_path, target_root_path, config_vars):
team.Car(
names="unit-test-car",
root_path=None,
config_paths=["~/.rally/benchmarks/teams/default/my-car"],
config_paths=[HOME_DIR + "/.rally/benchmarks/teams/default/my-car"],
variables={"heap": "4g"}),
java_home="/usr/local/javas/java8",
node_name="rally-node-0",
node_root_dir="~/.rally/benchmarks/races/unittest",
node_root_dir=HOME_DIR + "/.rally/benchmarks/races/unittest",
all_node_ips=["10.17.22.22", "10.17.22.23"],
ip="10.17.22.23",
http_port=9200)
Expand All @@ -173,7 +174,7 @@ def null_apply_config(source_root_path, target_root_path, config_vars):
self.assertEqual(1, len(apply_config_calls))
source_root_path, target_root_path, config_vars = apply_config_calls[0]

self.assertEqual("~/.rally/benchmarks/teams/default/my-car", source_root_path)
self.assertEqual(HOME_DIR + "/.rally/benchmarks/teams/default/my-car", source_root_path)
self.assertEqual("/opt/elasticsearch-5.0.0", target_root_path)

self.maxDiff = None
Expand All @@ -187,8 +188,8 @@ def null_apply_config(source_root_path, target_root_path, config_vars):
"cluster_name": "rally-benchmark",
"node_name": "rally-node-0",
"data_paths": ["/opt/elasticsearch-5.0.0/data"],
"log_path": "~/.rally/benchmarks/races/unittest/logs/server",
"heap_dump_path": "~/.rally/benchmarks/races/unittest/heapdump",
"log_path": HOME_DIR + "/.rally/benchmarks/races/unittest/logs/server",
"heap_dump_path": HOME_DIR + "/.rally/benchmarks/races/unittest/heapdump",
"node_ip": "10.17.22.23",
"network_host": "10.17.22.23",
"http_port": "9200-9300",
Expand Down Expand Up @@ -222,11 +223,11 @@ def null_apply_config(source_root_path, target_root_path, config_vars):
team.Car(
names="unit-test-car",
root_path=None,
config_paths=["~/.rally/benchmarks/teams/default/my-car"],
config_paths=[HOME_DIR + "/.rally/benchmarks/teams/default/my-car"],
variables={"heap": "4g"}),
java_home="/usr/local/javas/java8",
node_name="rally-node-0",
node_root_dir="~/.rally/benchmarks/races/unittest",
node_root_dir=HOME_DIR + "/.rally/benchmarks/races/unittest",
all_node_ips=["10.17.22.22", "10.17.22.23"],
ip="10.17.22.23",
http_port=9200)
Expand All @@ -250,7 +251,7 @@ def null_apply_config(source_root_path, target_root_path, config_vars):
self.assertEqual(1, len(apply_config_calls))
source_root_path, target_root_path, config_vars = apply_config_calls[0]

self.assertEqual("~/.rally/benchmarks/teams/default/my-car", source_root_path)
self.assertEqual(HOME_DIR + "/.rally/benchmarks/teams/default/my-car", source_root_path)
self.assertEqual("/opt/elasticsearch-6.3.0", target_root_path)

self.maxDiff = None
Expand All @@ -264,8 +265,8 @@ def null_apply_config(source_root_path, target_root_path, config_vars):
"cluster_name": "rally-benchmark",
"node_name": "rally-node-0",
"data_paths": ["/opt/elasticsearch-6.3.0/data"],
"log_path": "~/.rally/benchmarks/races/unittest/logs/server",
"heap_dump_path": "~/.rally/benchmarks/races/unittest/heapdump",
"log_path": HOME_DIR + "/.rally/benchmarks/races/unittest/logs/server",
"heap_dump_path": HOME_DIR + "/.rally/benchmarks/races/unittest/heapdump",
"node_ip": "10.17.22.23",
"network_host": "10.17.22.23",
"http_port": "9200-9300",
Expand Down Expand Up @@ -305,7 +306,7 @@ def test_cleanup_nothing_on_preserve(self, mock_path_exists, mock_rm):
all_node_ips={"127.0.0.1"},
ip="127.0.0.1",
http_port=9200,
node_root_dir="~/.rally/benchmarks/races/unittest")
node_root_dir=HOME_DIR + "/.rally/benchmarks/races/unittest")
installer.cleanup(preserve=True)

self.assertEqual(0, mock_path_exists.call_count)
Expand All @@ -325,7 +326,7 @@ def test_cleanup(self, mock_path_exists, mock_rm):
all_node_ips={"127.0.0.1"},
ip="127.0.0.1",
http_port=9200,
node_root_dir="~/.rally/benchmarks/races/unittest")
node_root_dir=HOME_DIR + "/.rally/benchmarks/races/unittest")
installer.cleanup(preserve=True)

expected_dir_calls = [mock.call("/tmp/some/data-path-dir"), mock.call("/rally-root/track/challenge/es-bin")]
Expand All @@ -345,7 +346,7 @@ def test_prepare_default_data_paths(self, mock_rm, mock_ensure_dir, mock_decompr
all_node_ips=["10.17.22.22", "10.17.22.23"],
ip="10.17.22.23",
http_port=9200,
node_root_dir="~/.rally/benchmarks/races/unittest")
node_root_dir=HOME_DIR + "/.rally/benchmarks/races/unittest")

installer.install("/data/builds/distributions")
self.assertEqual(installer.es_home_path, "/install/elasticsearch-5.0.0-SNAPSHOT")
Expand All @@ -354,8 +355,8 @@ def test_prepare_default_data_paths(self, mock_rm, mock_ensure_dir, mock_decompr
"cluster_name": "rally-benchmark",
"node_name": "rally-node-0",
"data_paths": ["/install/elasticsearch-5.0.0-SNAPSHOT/data"],
"log_path": "~/.rally/benchmarks/races/unittest/logs/server",
"heap_dump_path": "~/.rally/benchmarks/races/unittest/heapdump",
"log_path": HOME_DIR + "/.rally/benchmarks/races/unittest/logs/server",
"heap_dump_path": HOME_DIR + "/.rally/benchmarks/races/unittest/heapdump",
"node_ip": "10.17.22.23",
"network_host": "10.17.22.23",
"http_port": "9200-9300",
Expand Down

0 comments on commit 9e4c1d3

Please sign in to comment.