-
Notifications
You must be signed in to change notification settings - Fork 21
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
'unmock' binaries? #6
Comments
Hi corps, thank you for using Bach Testing Framework. If you want to check if If you want to grab the output of Just a reminder, that we must explicitly mock all commands in a pipeline command. Otherwise, this test case may be fail due to the random order of these commands. Mock the last command of a pipeline command to get the output. |
Really cool project, love the approach and simplicity.
As I understand it, when you run a test, all commands are mocked, including those found on the path, by default.
This is great 99% of the time, but there is a case where I do want the original command to be fully run within the script I am testing.
Here is my situation.
I am testing some docker script automation. I used @mock to mock the docker scripts with fixtures pulled from real execution of docker. Now, I want to test that piping those fixtures from the mocked docker into my script's
grep
andjq
produces the expected results. In this case, I need the script being tested to actually rungrep
andjq
.I know I can execute
@real grep
or even@grep
within a test, but I cannot wire the script subject I am testing to include@real
at the front of all its binary calls. Basically, I want a configurably mixed mode of mocks and real command executions.I tried creating a function
grep
and functionjq
that executes@real grep $@
but this does not seem to work, as the piping of stdin and stdout and processing of args does not work exactly right.@unmock
only reverses a mock, it does not seem to make an executable 'available' to be run within the target script.Is there a technique that can be used to allow scripts being tested to actually execute certain commands using PATH and no mock interactions?
The text was updated successfully, but these errors were encountered: