-
Notifications
You must be signed in to change notification settings - Fork 198
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
Inconsistent behaviour with ENTRYPOINT #37
Comments
Hey @goffinf, thanks for reporting this one. Looks like there are a number of issues here. First off, the issue with the entrypoint: as it stands right now, running command tests in a container with an entrypoint will always run the entrypoint BEFORE running the command the user is trying to test. I don't think we want to do this, because if we're testing a command in a container we want that to be the only thing that's run. I'll fix this soon. I know that sometimes entrypoint scripts are used as "setup" in a container before it's ever actually run; in this case, I'd say just call your entrypoint script directly in the The second issue I see here is that the regexes you're using the match the output for your first three commands are matching the outputs as expected, but they're also matching the prefixed The last issue is that your first 3 commands seemed to run the entrypoint script correctly (they all output Printing out shell variables using |
Hey Nick, thanks for the feedback. Do you know I saw the stdout: Terraform v0.10.8 for each test and I didn't twig it was running a terraform command that would return the version (apart from the first one where I ask it to do that in the test itself). Actually the entrypoint command (script) runs terraform init with a few options which interesting shouldn't support -v but somehow, because -v is included in the other commands I am running for the first 3 tests, seems to pick that up and emits the terraform version output (wierd). If I change -v in say the second test to -w an error occurs because the entrypoint is using that instead and its invalid. Anyway, if at some future point you intend to update the code to skip the entrypoint or otherwise ensure that only the command in the test is run, that will sort that out. This is a slightly unusual use case in the sense that the container I am testing is a build tool (terraform) and as such is intended to simply run the terraform command (plan, apply destroy, whatever) and then exit. Perhaps I should have chosen a more main-stream example, but nonetheless it was what I was doing at the time so ... why not. Anyway, I really like what you have done here and will be showing it to the team later this week. I anticipate the 'groan' when I tell them I am looking for them to follow TDD for containers from now on :-) |
Not sure if this utility (which is excellent BTW) is capable of working with images/containers which have a defined ENTRYPOINT, or whether there's is anything additional to define if the image being used has one ?
I have an image which executes Terraform and uses an ENTRYPOINT script. I created some simple command tests for other binaries that are present within the image and they ran successfully:
however, if I add something like checking that the HTTP_PROXY env var is set to what I expect
That test FAILS ... it is trying to run Terraform not the test:
NOTE: I did notice the metadataTests section in the docs but I couldn't get these to run (raised a separate issue for that), so treat the above as a simple example of any command I might want to run 'echo' in this case
Is it possible to run such a test when the image has an ENTRYPOINT (the tests before all worked happily enough) ?
Kind Regards
Fraser.
The text was updated successfully, but these errors were encountered: