Skip to content

Commit

Permalink
Revert "Add support for listing nested tracks (#1319)" (#1320)
Browse files Browse the repository at this point in the history
This reverts commit 17c55a1.
  • Loading branch information
Rick Boyd authored Sep 2, 2021
1 parent 17c55a1 commit 7225fca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 32 deletions.
8 changes: 1 addition & 7 deletions esrally/track/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,7 @@ def __init__(self, cfg, fetch, update, repo_class=repo.RallyRepository):

@property
def track_names(self):
retval = []
# + 1 to capture trailing slash
fully_qualified_path_length = len(self.repo.repo_dir) + 1
for root_dir, _, files in os.walk(self.repo.repo_dir):
if "track.json" in files:
retval.append(root_dir[fully_qualified_path_length:])
return retval
return filter(lambda p: os.path.exists(self.track_file(p)), next(os.walk(self.repo.repo_dir))[1])

def track_dir(self, track_name):
return os.path.join(self.repo.repo_dir, track_name)
Expand Down
27 changes: 2 additions & 25 deletions tests/track/loader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,30 +121,7 @@ def __init__(self, remote_url, root_dir, repo_name, resource_name, offline, fetc
@mock.patch("os.path.exists")
@mock.patch("os.walk")
def test_track_from_existing_repo(self, walk, exists):
"""
simulates scanning track repositories with the following structure:
<root>/
unittest/
track.json
unittest2/
track.json
unittest3/
nested/
track.json
track.json
src/
utils.py
"""
walk.return_value = iter(
[
("/tmp/tracks/default", ["unittest", "unittest2", "unittest3", "src"], []),
("/tmp/tracks/default/unittest", [], ["track.json"]),
("/tmp/tracks/default/unittest2", [], ["track.json"]),
("/tmp/tracks/default/unittest3", ["nested"], ["track.json"]),
("/tmp/tracks/default/unittest3/nested", [], ["track.json"]),
("/tmp/tracks/src", [], ["utils.py"]),
]
)
walk.return_value = iter([(".", ["unittest", "unittest2", "unittest3"], [])])
exists.return_value = True
cfg = config.Config()
cfg.add(config.Scope.application, "track", "track.name", "unittest")
Expand All @@ -156,7 +133,7 @@ def test_track_from_existing_repo(self, walk, exists):
repo = loader.GitTrackRepository(cfg, fetch=False, update=False, repo_class=GitRepositoryTests.MockGitRepo)

self.assertEqual("unittest", repo.track_name)
self.assertEqual(["unittest", "unittest2", "unittest3", "unittest3/nested"], list(repo.track_names))
self.assertEqual(["unittest", "unittest2", "unittest3"], list(repo.track_names))
self.assertEqual("/tmp/tracks/default/unittest", repo.track_dir("unittest"))
self.assertEqual("/tmp/tracks/default/unittest/track.json", repo.track_file("unittest"))

Expand Down

0 comments on commit 7225fca

Please sign in to comment.