Skip to content
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

ReadOnly mode #662

Open
chrbala opened this issue Jan 6, 2022 · 1 comment
Open

ReadOnly mode #662

chrbala opened this issue Jan 6, 2022 · 1 comment

Comments

@chrbala
Copy link

chrbala commented Jan 6, 2022

Expected behaviour

I would like a way to:

  1. hydrate the mountebank imposters data stored externally
  2. start an ephemeral mountebank server (i.e. one that exists for the duration of a CI build)
  3. guarantee that proxies don't hit the network

The broader context here is that I would like to have separate jobs for generating mocks and consuming them. The mock generation will use proxyOnce and persist the mocks somewhere. Then, test runs will download and hydrate these mocks. I would like to have confidence that the test runs are in fact using the mocks. To accomplish this, I want the mock server to only return persisted mocks, and not pass any requests through to the proxied server in this mode.

Actual behaviour

  • Using --datadir results in a PUT when the server is turned on, which erases all the old values.
  • There is no easy way to guarantee that proxies aren't being used.

Steps to reproduce

  1. Start a new server that proxies requests and uses a datadir
  2. Pass some requests to that server
  3. Restart the server
  4. Observe as the imposters have been deleted

Software versions used

OS         : OSX 11.6
mountebank : 2.5.0
node.js    : v14.18.1
Installation method : npm
@bbyars
Copy link
Owner

bbyars commented Mar 14, 2022

Hi there,
I realize it's a two step process, but it seems to me that mb replay do the trick for you. See http://www.mbtest.org/docs/commandLine#replay

So the idea, on the second job, to do an mb start followed by an mb replay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants