-
Notifications
You must be signed in to change notification settings - Fork 62
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 a way to read and initialize mocks from a directory #217
Comments
Thanks <3
Yes. We're currently in the middle of a rework that will change Smocker internals (#210) but after that we'll look into adding this feature. Note however that the already existing
We'll need to think about that for sure, I don't have a preferred solution yet |
Thank you for the detailed response! Glad to hear Smocker is being actively improved :) I saw |
Yeah this is because of an issue on our side, we accidentally overwrote the docker latest with the |
Docker latest is fixed, it now correctly aliases 0.16.4, you can try again with the persistence directory :) |
Wow, that was really fast! Thank you! I will try it later today! |
Sorry for the late reply, I tested it today, it did generate yaml files the files contain internal metadata and some fields slightly changed. Either way I managed to a docker-compose volume to sync those files to my filesystem and used the UI to manage the mocks. |
Firstly I just wanted to second the praise that Felipe gave for the project and to thank you for all the work that's been put into it. I am just curious if there is any update on whether Smocker will include a means to load mocks from a directory on startup without having to compile a session.yml in the persistence directory? hoping to use smocker for E2E testing and this feature would be incredibly useful |
I have the same question than @OJOMB. Why nothing move on this subject ? |
Because Smocker was not designed to load mocks at start. The idiomatic way of using Smocker is to setup it before your tests (like a databases, or a cache), set a new session with mocks at the start of every test suite then dump the sessions and trash it with the rest of your service dependencies. We use it every day for automated E2E tests without needing to put mocks at start. Smocker was created to be ephemeral. That's why all is stored in memory and everything is immuatable. What is the point of setup mocks at start when your automated tests are doing clean insert strategy ? What about mocks modification where everything should be executed in an automated way ? We know that some people want to use it as a persistant reverse proxy with mock supports but we do not use it this way so this is not a priority for us because we need to rework the way the sessions are stored (a database) which will make it harder to start and use it locally. For me the best way to unite the two ways is to allow to use a sqlite database for local environment + a postgres one for a persistant instance. This is not a little evoluton and then what about current persistence system ? |
Thanks a lot for this very clear explanation. |
Hi,
First of all, I really liked your project. Compared to similar solutions like Wiremock, this tool seems much more modern and easy to use. We are considering to use it in our microservices architecture to replace third-party services with a mock implementation on dev/qa environments to save money and make testing easier.
We want to be able to make a Docker image containing our mocks. To do that we would need Smocker to read mocks from a directory on initialization, like Wiremock does. I see #214 contains exactly what we need. Are there any plans to implementing this feature?
I saw in another ticket that someone suggested using the API to import the mocks, but that is not practical to us since we are in a k8s environment, ideally Smocker would load the mocks from a folder on startup and the environment would be ready to serve the mock requests.
Here is what I imagine:
A problem may arise in cases where smocker already has some data and we want to import from
--mocks-directory
, for example, a crash restart where Smocker will attempt to import the mocks again. I think you could do one of the following:--mocks-directory
to it?--mocks-directory
has a value.Thank you for your time!
The text was updated successfully, but these errors were encountered: