-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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 tests for the tsdb cli tool #5864
Add tests for the tsdb cli tool #5864
Comments
Hey @krasi-georgiev, I would like to work on this feature. Before I stumpled upon this issue I was actually thinking about writing my own little CLI tool that will send a request to the Prometheus API, create a snapshot and then send it to S3 or something. :) This would be my first contribution to the project and I couldn't find any documentation on how to use the CLI tool for snapshots but I assume with |
Prometheus itself has an api to create snapshots: |
sorry I didn't read your comment properly. Yes feel free to ping me on #prometheus-dev irc channel |
I think you can use https://golang.org/pkg/testing/#hdr-Examples |
Hey @krasi-georgiev I've tried setting up
I'm not too familiar with the inner workings of those I'm gonna try to capture the output in a different way, but the whole table writer formatting / tab-style formatting makes it extra-hard to test for the whole string. I'm gonna play around a bit and see if I can get it right. Although I might be missing something, please let me know if you have any feedback/ideas. |
Another way I can think of is passing a logger to these funcs so when you test them you can pass some mock logger that can than be used to test the output. |
That's a good idea. I'll be busy the next couple days but I hope to make some progress next week. |
So I think I've found a way that is not too bad:
One very annoying thing is that I have a created a WIP PR (#673) so you can see all my changes, maybe we can continue the discussion over there on how to proceed with this issue? |
not relevant as the tsdb tool has been merged with the promtool |
can start with simple test for the ls, analyze and dump commands.
createBlock()
The text was updated successfully, but these errors were encountered: