mirror of
https://github.com/containers/podman.git
synced 2025-06-25 20:26:51 +08:00
use lookaside storage for remote tests
in an effort to speed up the remote testing, we should be using lookaside storage to avoid pull images as well as importing multiple images into the RW store. one test was removed and added into system test by Ed in #8325 Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
@ -27,7 +27,6 @@ var _ = Describe("Podman build", func() {
|
||||
}
|
||||
podmanTest = PodmanTestCreate(tempdir)
|
||||
podmanTest.Setup()
|
||||
podmanTest.RestoreAllArtifacts()
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
@ -39,32 +38,33 @@ var _ = Describe("Podman build", func() {
|
||||
// Let's first do the most simple build possible to make sure stuff is
|
||||
// happy and then clean up after ourselves to make sure that works too.
|
||||
It("podman build and remove basic alpine", func() {
|
||||
session := podmanTest.PodmanNoCache([]string{"build", "build/basicalpine"})
|
||||
podmanTest.AddImageToRWStore(ALPINE)
|
||||
session := podmanTest.Podman([]string{"build", "build/basicalpine"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
iid := session.OutputToStringArray()[len(session.OutputToStringArray())-1]
|
||||
|
||||
// Verify that OS and Arch are being set
|
||||
inspect := podmanTest.PodmanNoCache([]string{"inspect", iid})
|
||||
inspect := podmanTest.Podman([]string{"inspect", iid})
|
||||
inspect.WaitWithDefaultTimeout()
|
||||
data := inspect.InspectImageJSON()
|
||||
Expect(data[0].Os).To(Equal(runtime.GOOS))
|
||||
Expect(data[0].Architecture).To(Equal(runtime.GOARCH))
|
||||
|
||||
session = podmanTest.PodmanNoCache([]string{"rmi", "alpine"})
|
||||
session = podmanTest.Podman([]string{"rmi", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman build with logfile", func() {
|
||||
logfile := filepath.Join(podmanTest.TempDir, "logfile")
|
||||
session := podmanTest.PodmanNoCache([]string{"build", "--tag", "test", "--logfile", logfile, "build/basicalpine"})
|
||||
session := podmanTest.Podman([]string{"build", "--tag", "test", "--logfile", logfile, "build/basicalpine"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
// Verify that OS and Arch are being set
|
||||
inspect := podmanTest.PodmanNoCache([]string{"inspect", "test"})
|
||||
inspect := podmanTest.Podman([]string{"inspect", "test"})
|
||||
inspect.WaitWithDefaultTimeout()
|
||||
data := inspect.InspectImageJSON()
|
||||
Expect(data[0].Os).To(Equal(runtime.GOOS))
|
||||
@ -74,7 +74,7 @@ var _ = Describe("Podman build", func() {
|
||||
Expect(err).To(BeNil())
|
||||
Expect(st.Size()).To(Not(Equal(0)))
|
||||
|
||||
session = podmanTest.PodmanNoCache([]string{"rmi", "alpine"})
|
||||
session = podmanTest.Podman([]string{"rmi", "alpine"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
@ -82,7 +82,7 @@ var _ = Describe("Podman build", func() {
|
||||
// If the context directory is pointing at a file and not a directory,
|
||||
// that's a no no, fail out.
|
||||
It("podman build context directory a file", func() {
|
||||
session := podmanTest.PodmanNoCache([]string{"build", "build/context_dir_a_file"})
|
||||
session := podmanTest.Podman([]string{"build", "build/context_dir_a_file"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(125))
|
||||
})
|
||||
@ -90,51 +90,47 @@ var _ = Describe("Podman build", func() {
|
||||
// Check that builds with different values for the squash options
|
||||
// create the appropriate number of layers, then clean up after.
|
||||
It("podman build basic alpine with squash", func() {
|
||||
session := podmanTest.PodmanNoCache([]string{"build", "-f", "build/squash/Dockerfile.squash-a", "-t", "test-squash-a:latest", "build/squash"})
|
||||
session := podmanTest.Podman([]string{"build", "-f", "build/squash/Dockerfile.squash-a", "-t", "test-squash-a:latest", "build/squash"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test-squash-a"})
|
||||
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test-squash-a"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
// Check for two layers
|
||||
Expect(len(strings.Fields(session.OutputToString()))).To(Equal(2))
|
||||
|
||||
session = podmanTest.PodmanNoCache([]string{"build", "-f", "build/squash/Dockerfile.squash-b", "--squash", "-t", "test-squash-b:latest", "build/squash"})
|
||||
session = podmanTest.Podman([]string{"build", "-f", "build/squash/Dockerfile.squash-b", "--squash", "-t", "test-squash-b:latest", "build/squash"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test-squash-b"})
|
||||
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test-squash-b"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
// Check for three layers
|
||||
Expect(len(strings.Fields(session.OutputToString()))).To(Equal(3))
|
||||
|
||||
session = podmanTest.PodmanNoCache([]string{"build", "-f", "build/squash/Dockerfile.squash-c", "--squash", "-t", "test-squash-c:latest", "build/squash"})
|
||||
session = podmanTest.Podman([]string{"build", "-f", "build/squash/Dockerfile.squash-c", "--squash", "-t", "test-squash-c:latest", "build/squash"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test-squash-c"})
|
||||
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test-squash-c"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
// Check for two layers
|
||||
Expect(len(strings.Fields(session.OutputToString()))).To(Equal(2))
|
||||
|
||||
session = podmanTest.PodmanNoCache([]string{"build", "-f", "build/squash/Dockerfile.squash-c", "--squash-all", "-t", "test-squash-d:latest", "build/squash"})
|
||||
session = podmanTest.Podman([]string{"build", "-f", "build/squash/Dockerfile.squash-c", "--squash-all", "-t", "test-squash-d:latest", "build/squash"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test-squash-d"})
|
||||
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test-squash-d"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
// Check for one layers
|
||||
Expect(len(strings.Fields(session.OutputToString()))).To(Equal(1))
|
||||
|
||||
session = podmanTest.PodmanNoCache([]string{"rm", "-a"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
session = podmanTest.PodmanNoCache([]string{"rmi", "-a", "-f"})
|
||||
session = podmanTest.Podman([]string{"rm", "-a"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
@ -165,7 +161,7 @@ var _ = Describe("Podman build", func() {
|
||||
}()
|
||||
|
||||
// When
|
||||
session := podmanTest.PodmanNoCache([]string{
|
||||
session := podmanTest.Podman([]string{
|
||||
"build", "-f", targetFile, "-t", "test-locations",
|
||||
})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@ -189,13 +185,13 @@ var _ = Describe("Podman build", func() {
|
||||
}
|
||||
targetFile := filepath.Join(targetPath, "idFile")
|
||||
|
||||
session := podmanTest.PodmanNoCache([]string{"build", "build/basicalpine", "--iidfile", targetFile})
|
||||
session := podmanTest.Podman([]string{"build", "build/basicalpine", "--iidfile", targetFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
id, _ := ioutil.ReadFile(targetFile)
|
||||
|
||||
// Verify that id is correct
|
||||
inspect := podmanTest.PodmanNoCache([]string{"inspect", string(id)})
|
||||
inspect := podmanTest.Podman([]string{"inspect", string(id)})
|
||||
inspect.WaitWithDefaultTimeout()
|
||||
data := inspect.InspectImageJSON()
|
||||
Expect(data[0].ID).To(Equal(string(id)))
|
||||
@ -203,7 +199,7 @@ var _ = Describe("Podman build", func() {
|
||||
|
||||
It("podman Test PATH in built image", func() {
|
||||
path := "/tmp:/bin:/usr/bin:/usr/sbin"
|
||||
session := podmanTest.PodmanNoCache([]string{
|
||||
session := podmanTest.Podman([]string{
|
||||
"build", "-f", "build/basicalpine/Containerfile.path", "-t", "test-path",
|
||||
})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@ -214,10 +210,6 @@ var _ = Describe("Podman build", func() {
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
stdoutLines := session.OutputToStringArray()
|
||||
Expect(stdoutLines[0]).Should(Equal(path))
|
||||
|
||||
session = podmanTest.PodmanNoCache([]string{"rmi", "-a", "-f"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman build --http_proxy flag", func() {
|
||||
@ -226,14 +218,14 @@ var _ = Describe("Podman build", func() {
|
||||
podmanTest.StopRemoteService()
|
||||
podmanTest.StartRemoteService()
|
||||
}
|
||||
podmanTest.RestoreAllArtifacts()
|
||||
podmanTest.AddImageToRWStore(ALPINE)
|
||||
dockerfile := `FROM quay.io/libpod/alpine:latest
|
||||
RUN printenv http_proxy`
|
||||
|
||||
dockerfilePath := filepath.Join(podmanTest.TempDir, "Dockerfile")
|
||||
err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
session := podmanTest.PodmanNoCache([]string{"build", "--http-proxy", "--file", dockerfilePath, podmanTest.TempDir})
|
||||
session := podmanTest.Podman([]string{"build", "--http-proxy", "--file", dockerfilePath, podmanTest.TempDir})
|
||||
session.Wait(120)
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
ok, _ := session.GrepString("1.2.3.4")
|
||||
|
Reference in New Issue
Block a user