From 91944499c5808d5673c36c5b1f2540a0c925c973 Mon Sep 17 00:00:00 2001 From: Nick Kubala Date: Wed, 24 Jan 2018 10:44:14 -0800 Subject: [PATCH 1/2] overwrite image entrypoint when running tests --- drivers/docker_driver.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/docker_driver.go b/drivers/docker_driver.go index 2b2d4e50..15d426bd 100644 --- a/drivers/docker_driver.go +++ b/drivers/docker_driver.go @@ -245,6 +245,7 @@ func (d *DockerDriver) runAndCommit(t *testing.T, env []string, command []string Image: d.currentImage, Env: env, Cmd: command, + Entrypoint: []string{}, AttachStdout: true, AttachStderr: true, }, @@ -290,6 +291,7 @@ func (d *DockerDriver) exec(t *testing.T, env []string, command []string) (strin Image: d.currentImage, Env: env, Cmd: command, + Entrypoint: []string{}, AttachStdout: true, AttachStderr: true, }, From ff63be63512d0d47fee376434612985c6b22d3eb Mon Sep 17 00:00:00 2001 From: Nick Kubala Date: Thu, 25 Jan 2018 10:38:33 -0800 Subject: [PATCH 2/2] add note about entrypoint in README --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f0826ff..fd670c54 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,21 @@ commandTests: excludedError: [".*Inst.*Security.* | .*Security.*Inst.*"] ``` +### Image Entrypoint + +To avoid unexpected behavior and output when running commands in the +containers, **all entrypoints are overwritten by default.** If your +entrypoint is necessary for the structure of your container, use the +`setup` field to call any scripts or commands manually before running +the tests. + +```yaml +commandTests: + ... + setup: [["my_image_entrypoint.sh"]] + ... +``` + ### Intermediate Artifacts Each command test run creates either a container (with the `docker` driver) or tar artifact (with the `tar` driver). By default, these are deleted after the @@ -284,4 +299,4 @@ container_test( ) ``` -See this small [example repo](https://github.com/nkubala/structure-test-examples) for a full working example. +See this [example repo](https://github.com/nkubala/structure-test-examples) for a full working example.