Closed mmcmurray-lw closed 2 years ago
On re-read of the docs I can see this is my mistake and I can see why I made it.
From the mbtest docs: http://www.mbtest.org/docs/commandLine#replay
The replay command is a convenience that removes all proxies, effectively switching from record mode to replay mode. Assuming mountebank is running on port 3000, you would run the following command:
mb replay --port 3000
In the book 3000 is used as the assumed imposter port.
So cross referencing between mbtest and the book I confused 3000 on mbtest as the imposter port rather than mountebank port.
Expected behaviour
I start mb using the following command:
mb start --datadir /home/mountebank --configfile /app/proxy-imposters.json --loglevel debug
Where the data dir is empty and
proxy-imposters.json
is:The imposter works as expected, allowing me to run some tests and record the traffic. I then use the following command:
mb replay --port 3001
I get the following result back:
Given this result I would expect the proxy to have been removed and the imposter to be purely in replay mode.
Actual behaviour
Once the command is called I can see in debug logs
GET /imposters?replayable=true&removeProxies=true
is passed on through the proxying imposter to the service I am trying to mock, which as expected returns a 404 not found message which is then added to the predicate file.Future requests sent to the imposter continue to be proxied to
my-service:8080
as the proxyAlways stub is still present in the datadir. I can manually remove this stub to achieve my desired result but I would like to be able to do it in an automated fashion.Steps to reproduce
proxyAlways
modemb replay --port P
Software versions used
Log contents in mb.log when running mb --loglevel debug