Skip to content

Conversation

aman825
Copy link
Contributor

@aman825 aman825 commented Jul 27, 2025

Description

Updates the CLI command from run-test to run for OpenSearch Benchmark 2.0.0. Legacy command suggestions are maintained for users who might still try the old "execute-test" command, providing helpful guidance to use the new "run" command.

  • CLI command updated from 'run-test' to 'run'
  • Legacy 'execute-test' command shows helpful suggestion to use 'run'

Issues Resolved

#875

Testing

  • New functionality includes testing

Unit Tests: All 1317 unit tests pass, 5 skipped - confirms no regression in core functionality

Integration Tests: 15 out of 19 integration tests pass - core benchmark functionality working correctly (4 failures are infrastructure-related, not CLI-related)

End-to-End CLI Testing:
Verified opensearch-benchmark run --help works correctly
Verified opensearch-benchmark --help shows "run" as primary command
Verified legacy command suggestion: opensearch-benchmark execute-test shows "Did you mean 'run'?" message
Tested basic CLI functionality with workload listing and command parsing

Manual Testing: Confirmed CLI command structure is correct and user-friendly error messages are displayed for legacy commands


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

- CLI command updated from 'run-test' to 'run'
- Legacy 'execute-test' command shows helpful suggestion to use 'run'
- All unit tests pass (1317 passed, 5 skipped)
- Integration tests show core functionality working (15 passed)
- End-to-end CLI testing confirms proper functionality

Resolves: CLI command change from run-test to run for OSB 2.0.0
Signed-off-by: Aman Ahmad <[email protected]>
@aman825 aman825 marked this pull request as ready for review July 27, 2025 06:17
@aman825 aman825 changed the title feat: update CLI command from run-test to run for OSB 2.0.0 Change run-test to run Jul 27, 2025
Check for common command mistakes and provide helpful suggestions
Returns True if suggestion was provided, False otherwise
"""
if len(sys.argv) > 1 and sys.argv[1] == "execute-test":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good. One minor suggestion:
Since this method is for common command mistakes, it'd be nice to have a list of deprecated commands that this list can access. This would make the function more robust.

DEPRECATED_SUBCOMMANDS = ["execute-test", "execute"]

if len(sys.argv) > 1 and sys.argv[1] in DEPRECATED_SUBCOMMANDS:

@@ -1203,6 +1216,10 @@ def main():
# Early init of console output so we start to show everything consistently.
console.init(quiet=False)

# Handle command suggestions before argument parsing
if handle_command_suggestions():
return
Copy link
Collaborator

@IanHoang IanHoang Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: would replace return with sys.exit(1). While this works, sys.exit(1) is more suitable to clearly communicate to users and developers that this error prevents the tool from operating.

Copy link
Collaborator

@IanHoang IanHoang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aman825 Thanks for contributing this. This overall looks good. Just left a couple comments.

- Add DEPRECATED_SUBCOMMANDS list to handle_command_suggestions() for better maintainability
- Change condition from hardcoded 'execute-test' to use list membership check
- Replace return with sys.exit(1) for proper command-line error handling

This makes it easier to add new deprecated commands and provides clearer
program termination behavior with appropriate exit codes.

Signed-off-by: Aman Ahmad <[email protected]>
@aman825 aman825 requested a review from IanHoang July 28, 2025 16:36
@aman825
Copy link
Contributor Author

aman825 commented Jul 28, 2025

Added the suggested changes

Copy link
Collaborator

@IanHoang IanHoang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for contributing this!

@IanHoang IanHoang merged commit 622ddbe into opensearch-project:2.0-alpha Jul 28, 2025
10 checks passed
@aman825 aman825 deleted the feature/cli-command-run-test-to-run branch July 29, 2025 05:44
gkamat pushed a commit that referenced this pull request Aug 1, 2025
Signed-off-by: Aman Ahmad <[email protected]>
Co-authored-by: Aman Ahmad <[email protected]>
Signed-off-by: Ian Hoang <[email protected]>
gkamat pushed a commit to gkamat/opensearch-benchmark that referenced this pull request Aug 18, 2025
Signed-off-by: Aman Ahmad <[email protected]>
Co-authored-by: Aman Ahmad <[email protected]>
Signed-off-by: Ian Hoang <[email protected]>
gkamat pushed a commit to gkamat/opensearch-benchmark that referenced this pull request Aug 18, 2025
Signed-off-by: Aman Ahmad <[email protected]>
Co-authored-by: Aman Ahmad <[email protected]>
Signed-off-by: Ian Hoang <[email protected]>
gkamat pushed a commit that referenced this pull request Aug 19, 2025
Signed-off-by: Aman Ahmad <[email protected]>
Co-authored-by: Aman Ahmad <[email protected]>
Signed-off-by: Ian Hoang <[email protected]>
IanHoang pushed a commit that referenced this pull request Aug 20, 2025
Signed-off-by: Aman Ahmad <[email protected]>
Co-authored-by: Aman Ahmad <[email protected]>
Signed-off-by: Ian Hoang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants