Skip to content

Add a way to read and initialize mocks from a directory Β #217

@FelipeEmerim

Description

@FelipeEmerim

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:

smocker --mocks-directory=/opt/mocks

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:

  • In case smocker already has some data you could create a new session and add the mocks in --mocks-directory to it?
  • You could have another cli argument indicating if we should wipe the data on startup
  • Just wipe the data if --mocks-directory has a value.

Thank you for your time!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions