-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When an image has an ENTRYPOINT defined, we should be honoring it. The problem is described in issue #321. Also, added buildah binary to test runtimes for testing entrypoint and will also allow us to test podman build as well. Signed-off-by: baude <bbaude@redhat.com> Closes: #322 Approved by: rhatdan
- Loading branch information
1 parent
773aa61
commit d262666
Showing
8 changed files
with
161 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package integration | ||
|
||
import ( | ||
"os" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("Podman run entrypoint", func() { | ||
var ( | ||
tempdir string | ||
err error | ||
podmanTest PodmanTest | ||
) | ||
|
||
BeforeEach(func() { | ||
tempdir, err = CreateTempDirInTempDir() | ||
if err != nil { | ||
os.Exit(1) | ||
} | ||
podmanTest = PodmanCreate(tempdir) | ||
podmanTest.RestoreArtifact(ALPINE) | ||
}) | ||
|
||
AfterEach(func() { | ||
podmanTest.Cleanup() | ||
|
||
}) | ||
|
||
It("podman run entrypoint", func() { | ||
dockerfile := `FROM docker.io/library/alpine:latest | ||
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"] | ||
` | ||
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest") | ||
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"}) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session.ExitCode()).To(Equal(0)) | ||
Expect(len(session.OutputToStringArray())).To(Equal(3)) | ||
}) | ||
|
||
It("podman run entrypoint with cmd", func() { | ||
dockerfile := `FROM docker.io/library/alpine:latest | ||
CMD [ "-v"] | ||
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"] | ||
` | ||
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest") | ||
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"}) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session.ExitCode()).To(Equal(0)) | ||
Expect(len(session.OutputToStringArray())).To(Equal(5)) | ||
}) | ||
|
||
It("podman run entrypoint with user cmd overrides image cmd", func() { | ||
dockerfile := `FROM docker.io/library/alpine:latest | ||
CMD [ "-v"] | ||
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"] | ||
` | ||
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest") | ||
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "-i"}) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session.ExitCode()).To(Equal(0)) | ||
Expect(len(session.OutputToStringArray())).To(Equal(6)) | ||
}) | ||
|
||
It("podman run entrypoint with user cmd no image cmd", func() { | ||
dockerfile := `FROM docker.io/library/alpine:latest | ||
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"] | ||
` | ||
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest") | ||
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "-i"}) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session.ExitCode()).To(Equal(0)) | ||
Expect(len(session.OutputToStringArray())).To(Equal(6)) | ||
}) | ||
|
||
It("podman run user entrypoint overrides image entrypoint and image cmd", func() { | ||
dockerfile := `FROM docker.io/library/alpine:latest | ||
CMD ["-i"] | ||
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"] | ||
` | ||
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest") | ||
session := podmanTest.Podman([]string{"run", "--entrypoint=uname", "foobar.com/entrypoint:latest"}) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session.ExitCode()).To(Equal(0)) | ||
Expect(session.LineInOuputStartsWith("Linux")).To(BeTrue()) | ||
}) | ||
|
||
It("podman run user entrypoint with command overrides image entrypoint and image cmd", func() { | ||
dockerfile := `FROM docker.io/library/alpine:latest | ||
CMD ["-i"] | ||
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"] | ||
` | ||
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest") | ||
session := podmanTest.Podman([]string{"run", "--entrypoint=uname", "foobar.com/entrypoint:latest", "-r"}) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session.ExitCode()).To(Equal(0)) | ||
Expect(session.LineInOuputStartsWith("Linux")).To(BeFalse()) | ||
}) | ||
}) |