Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for -type runAll as described in documentation #28

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

geschke
Copy link

@geschke geschke commented Mar 12, 2025

Hello!

Thanks for this nice MongoDB benchmarking tool!

Just a minor thing — while testing, I noticed an inconsistency in the documentation (README). The implemented parameter is -runAll, but the README mentions -type runAll. When using the latter, it results in an unclear error message:

./mongo-bench -threads 10 -docs 10000  -uri mongodb://<mongodb-url>:27017 -type runAll
2025/03/12 19:47:48 Starting runAll test...
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
main.DocCountTestingStrategy.runTest({}, {0x9f8cb0, 0xc0000561c8}, {0x7ffcbccf453a, 0x6}, {0xa, 0x2710, 0x0, 0x0, 0x1}, ...)
        /home/geschke/tmp/mongodb-bench/docs_testing_strategy.go:172 +0x11f6
main.main()
        /home/geschke/tmp/mongodb-bench/main.go:68 +0x642

The small changes fix the issue so that both the -runAll parameter and -type runAll are supported. Additionally, an error message is now displayed for an unknown -type parameter, which I find more user-friendly than exiting with a panic.

Oh, and the order of the imports was automatically adjusted by Visual Studio Code (or rather, the Go extension). :-)

Thanks again! I'd appreciate if you could merge this PR.

Kind regards,
Ralf

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.

1 participant