Skip to content

Commit

Permalink
Option track-revision should work with track-repository (#751)
Browse files Browse the repository at this point in the history
Option track-revision should work with track-repository but not
track-path
  • Loading branch information
ebadyano authored Aug 29, 2019
1 parent f918edc commit d34f31d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions esrally/rally.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def positive_number(v):
track_source_group.add_argument(
"--track-path",
help="Define the path to a track.")
track_source_group.add_argument(
p.add_argument(
"--track-revision",
help="Define a specific revision in the track repository that Rally should use.",
default=None)
Expand Down Expand Up @@ -607,21 +607,24 @@ def main():

cfg.add(config.Scope.applicationOverride, "race", "pipeline", args.pipeline)
cfg.add(config.Scope.applicationOverride, "race", "user.tag", args.user_tag)

cfg.add(config.Scope.applicationOverride, "track", "repository.revision", args.track_revision)

# We can assume here that if a track-path is given, the user did not specify a repository either (although argparse sets it to
# its default value)
if args.track_path:
cfg.add(config.Scope.applicationOverride, "track", "track.path", os.path.abspath(io.normalize_path(args.track_path)))
cfg.add(config.Scope.applicationOverride, "track", "repository.name", None)
cfg.add(config.Scope.applicationOverride, "track", "repository.revision", None)
if args.track_revision:
# stay as close as possible to argparse errors although we have a custom validation.
arg_parser.error("argument --track-revision not allowed with argument --track-path")
if args.track:
# stay as close as possible to argparse errors although we have a custom validation.
arg_parser.error("argument --track not allowed with argument --track-path")
# cfg.add(config.Scope.applicationOverride, "track", "track.name", None)
else:
# cfg.add(config.Scope.applicationOverride, "track", "track.path", None)
cfg.add(config.Scope.applicationOverride, "track", "repository.name", args.track_repository)
cfg.add(config.Scope.applicationOverride, "track", "repository.revision", args.track_revision)
# set the default programmatically because we need to determine whether the user has provided a value
chosen_track = args.track if args.track else "geonames"
cfg.add(config.Scope.applicationOverride, "track", "track.name", chosen_track)
Expand Down
2 changes: 2 additions & 0 deletions integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ function test_list {
esrally list elasticsearch-plugins --configuration-name="${cfg}"
info "test list tracks [${cfg}]"
esrally list tracks --configuration-name="${cfg}"
info "test list can use track revision together with track repository"
esrally list tracks --configuration-name="${cfg}" --track-repository=default --track-revision=4080dc9850d07e23b6fc7cfcdc7cf57b14e5168d
info "test list telemetry [${cfg}]"
esrally list telemetry --configuration-name="${cfg}"
}
Expand Down

0 comments on commit d34f31d

Please sign in to comment.