Feature: Support adding new stubs dynamically
Expected behaviour
I can POST an imposter.
Additionally I can add more stubs to the existing imposter by sending a PATCH request with new stubs.
Actual behaviour
Once I POST an imposter I'm unable to modify the stubs unless I DELETE the imposter.
Then I'll have to POST a new imposter containing the new stubs.
This will cause me to lose stubs that I used in the first POST request.
This is an issue due to our tests running via pytest-xdist in a distributed manner. Once an imposter is created, it should not be deleted since another thread might currently query it.
Are there any plans to implement this / reasons for not doing this? I would be happy to contribute.
@bbyars what do you think?
Hi there, Sorry for the slow response - I've been under water these past couple weeks. I've always been a little nervous of changing the state of an imposter for a few reasons, but in this case, it sounds like you're really just wanting to add stubs, not change existing ones. If that's true, I don't have any objections.
From a usability standpoint, it might make more sense to make it a POST to /imposters/{port}/stubs rather than a PATCH. The problem with a PATCH is that the semantics are hard to guess; POST ing to a collection is a pretty common pattern to create a new entity.
Happy to let you jump in if you've an interest in implementing it; it's likely to get done sooner that way. Let me know if you need any tips getting started; I can point you in the right places. -Brandon
👍 this would be a big win for me! To expand on it a little bit... you may want to both POST new stubs to an imposter as well as PUT updates to an existing imposter. That might require support for stub identifiers? Perhaps we could support a stub ID or generate one? DELETE might be a good idea too for test cleanup.
For example, my use case would involve out-of-process component testing https://martinfowler.com/articles/microservice-testing/#testing-component-out-of-process-diagram where mountebank runs in a container alongside the component (ie. micro-service) in test. Instead of using fixtures, my test harness will use generative data tools and will test varying sizes of result sets for identical queries. I've done some prototyping with mountebank in the past, but it required restarting imposters between test suites with a unsavory "wait for the imposter to become available."
@bbyars, if you guide a design that would be acceptable, I might have time to implement.
We would also like to have such feature.
Considering that PUT errase ALL existing imposters, it is very hard to share the same mb server with other teams. So far, with the little 1week experience I have with this tool, I believe each team will need to have their own docker running their mb server. We will not be able to have one server, organisation wide, hosting multiple dockers mb servers, each having their imposter on their respective port assigned to specific teams.
Even deleting a specific imposter and recreating it with the new stubs using POST will somehow end up risking a downtime within a team using this imposter.
Yes , this would be a life saver. Any timeline..looks like it's been pushed a few times?
I'll push to the top of the queue for v1.18. I'm in the middle of issue #174 for the v1.17 release, which is a significant re-architecture.
Hi guys. Yes, this feature is very necessary. We also need to update imposters dynamically.
I see that this feature request has been open since 2017.
I would also like to see this functionality incorporated into Mountebank. It seems it was added to v1.18.0 in the Roadmap. Considering Mountebank is currently on 2.0.0, is this feature already released or is it currently in development?
Thanks!
v.18.0 is the new 2.1.0 (what was going to be v.17.0 became v2.0.0 instead). I'll update the versions on the roadmap, but this is in the next release. -Brandon
On Fri, Mar 22, 2019 at 8:24 AM Jesse Pai [email protected] wrote:
I see that this feature request has been open since 2017.
I would also like to see this functionality incorporated into Mountebank. It seems it was added to v1.18.0 in the Roadmap. Considering Mountebank is currently on 2.0.0, is this feature already released or in development?
Thanks!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bbyars/mountebank/issues/297#issuecomment-475619423, or mute the thread https://github.com/notifications/unsubscribe-auth/AAESv7D6auMZ9WLOfgL2GE0EEOW0JYMJks5vZNmqgaJpZM4PvEdS .
Sounds great. I look forward to checking it out!
@bbyars Do you have a rough ETA on when 2.1.0 will be released?
@bbyars any idea when 2.1.0 will be released ?