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
API Mocks #1438
Comments
I don't think there was any discussion around this. Do you have examples of other libraries doing the same? I'm not against the idea 🤔 |
Hello @ArthurSens, Thanks for looking into my request. Here are a few examples:
Not all libraries include a mocks directory with pre-made mock implementations. However, many Go libraries follow a convention where they include mock implementations alongside their regular codebase, often in a mock directory or a similarly named one. |
+1 I was just looking for this |
👋🏽 Interesting topic. I am not immediately opposed, but wanted to give perspective on why generally maintaining mocks next to the backend API tend to be controversial topic:
Initially, when I started working with Go I was mocking fun. But with time, it's just not productive to mock everything and every detail, unless you write software for NASA. I would be more curious if a simple "Prometheus fake" would be a better use of our time e.g. where somebody could combine client_golang Prometheus API client with some code that allows injecting a simple array of series and PromQL responses. |
@bwplotka Those are good points. Fakes are indeed preferable to mocks when possible. |
Hello,
I am using this library to interact with Prometheus and realized the mocks are missing for the API interface.
Is there any plan to provide mocks so users can morally write tests?
Thanks,
The text was updated successfully, but these errors were encountered: