Merge pull request #8324 from baude/speedupe2eremote

use lookaside storage for remote tests
This commit is contained in:
OpenShift Merge Robot
2020-11-16 17:47:12 +01:00
committed by GitHub
32 changed files with 565 additions and 692 deletions

View File

@ -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")

View File

@ -27,6 +27,7 @@ import (
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
var (
@ -71,6 +72,8 @@ type testResult struct {
length float64
}
var noCache = "Cannot run nocache with remote"
type testResultsSorted []testResult
func (a testResultsSorted) Len() int { return len(a) }
@ -100,10 +103,16 @@ func TestLibpod(t *testing.T) {
}
var _ = SynchronizedBeforeSuite(func() []byte {
// make cache dir
if err := os.MkdirAll(ImageCacheDir, 0777); err != nil {
fmt.Printf("%q\n", err)
os.Exit(1)
}
// Cache images
cwd, _ := os.Getwd()
INTEGRATION_ROOT = filepath.Join(cwd, "../../")
podman := PodmanTestCreate("/tmp")
podman := PodmanTestSetup("/tmp")
podman.ArtifactPath = ARTIFACT_DIR
if _, err := os.Stat(ARTIFACT_DIR); os.IsNotExist(err) {
if err = os.Mkdir(ARTIFACT_DIR, 0777); err != nil {
@ -112,16 +121,18 @@ var _ = SynchronizedBeforeSuite(func() []byte {
}
}
// make cache dir
if err := os.MkdirAll(ImageCacheDir, 0777); err != nil {
fmt.Printf("%q\n", err)
os.Exit(1)
}
for _, image := range CACHE_IMAGES {
// Pull cirros but dont put it into the cache
pullImages := []string{cirros, fedoraToolbox}
pullImages = append(pullImages, CACHE_IMAGES...)
for _, image := range pullImages {
podman.createArtifact(image)
}
if err := os.MkdirAll(filepath.Join(ImageCacheDir, podman.ImageCacheFS+"-images"), 0777); err != nil {
fmt.Printf("%q\n", err)
os.Exit(1)
}
podman.CrioRoot = ImageCacheDir
// If running localized tests, the cache dir is created and populated. if the
// tests are remote, this is a no-op
populateCache(podman)
@ -290,18 +301,11 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
return p
}
// RestoreAllArtifacts unpacks all cached images
func (p *PodmanTestIntegration) RestoreAllArtifacts() error {
if os.Getenv("NO_TEST_CACHE") != "" {
return nil
}
for _, image := range RESTORE_IMAGES {
func (p PodmanTestIntegration) AddImageToRWStore(image string) {
if err := p.RestoreArtifact(image); err != nil {
return err
logrus.Errorf("unable to restore %s to RW store", image)
}
}
return nil
}
// createArtifact creates a cached image in the artifact dir
func (p *PodmanTestIntegration) createArtifact(image string) {
@ -424,7 +428,7 @@ func (p *PodmanTestIntegration) BuildImage(dockerfile, imageName string, layers
dockerfilePath := filepath.Join(p.TempDir, "Dockerfile")
err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
Expect(err).To(BeNil())
session := p.PodmanNoCache([]string{"build", "--layers=" + layers, "-t", imageName, "--file", dockerfilePath, p.TempDir})
session := p.Podman([]string{"build", "--layers=" + layers, "-t", imageName, "--file", dockerfilePath, p.TempDir})
session.Wait(120)
Expect(session).Should(Exit(0), fmt.Sprintf("BuildImage session output: %q", session.OutputToString()))
}
@ -481,23 +485,6 @@ func (p *PodmanTestIntegration) CleanupVolume() {
}
}
// PullImages pulls multiple images
func (p *PodmanTestIntegration) PullImages(images []string) error {
for _, i := range images {
p.PullImage(i)
}
return nil
}
// PullImage pulls a single image
// TODO should the timeout be configurable?
func (p *PodmanTestIntegration) PullImage(image string) error {
session := p.PodmanNoCache([]string{"pull", image})
session.Wait(60)
Expect(session.ExitCode()).To(Equal(0))
return nil
}
// InspectContainerToJSON takes the session output of an inspect
// container and returns json
func (s *PodmanSessionIntegration) InspectContainerToJSON() []define.InspectContainerData {
@ -559,12 +546,6 @@ func (p *PodmanTestIntegration) RunTopContainerInPod(name, pod string) *PodmanSe
return p.Podman(podmanArgs)
}
func (p *PodmanTestIntegration) ImageExistsInMainStore(idOrName string) bool {
results := p.PodmanNoCache([]string{"image", "exists", idOrName})
results.WaitWithDefaultTimeout()
return Expect(results.ExitCode()).To(Equal(0))
}
func (p *PodmanTestIntegration) RunHealthCheck(cid string) error {
for i := 0; i < 10; i++ {
hc := p.Podman([]string{"healthcheck", "run", cid})
@ -685,3 +666,125 @@ func (p *PodmanTestIntegration) RestartRemoteService() {
p.StopRemoteService()
p.StartRemoteService()
}
// RestoreArtifactToCache populates the imagecache from tarballs that were cached earlier
func (p *PodmanTestIntegration) RestoreArtifactToCache(image string) error {
fmt.Printf("Restoring %s...\n", image)
dest := strings.Split(image, "/")
destName := fmt.Sprintf("/tmp/%s.tar", strings.Replace(strings.Join(strings.Split(dest[len(dest)-1], "/"), ""), ":", "-", -1))
p.CrioRoot = p.ImageCacheDir
restore := p.PodmanNoEvents([]string{"load", "-q", "-i", destName})
restore.WaitWithDefaultTimeout()
return nil
}
func populateCache(podman *PodmanTestIntegration) {
for _, image := range CACHE_IMAGES {
podman.RestoreArtifactToCache(image)
}
// logformatter uses this to recognize the first test
fmt.Printf("-----------------------------\n")
}
func removeCache() {
// Remove cache dirs
if err := os.RemoveAll(ImageCacheDir); err != nil {
fmt.Printf("%q\n", err)
}
}
// PodmanNoCache calls the podman command with no configured imagecache
func (p *PodmanTestIntegration) PodmanNoCache(args []string) *PodmanSessionIntegration {
podmanSession := p.PodmanBase(args, false, true)
return &PodmanSessionIntegration{podmanSession}
}
func PodmanTestSetup(tempDir string) *PodmanTestIntegration {
return PodmanTestCreateUtil(tempDir, false)
}
// PodmanNoEvents calls the Podman command without an imagecache and without an
// events backend. It is used mostly for caching and uncaching images.
func (p *PodmanTestIntegration) PodmanNoEvents(args []string) *PodmanSessionIntegration {
podmanSession := p.PodmanBase(args, true, true)
return &PodmanSessionIntegration{podmanSession}
}
// MakeOptions assembles all the podman main options
func (p *PodmanTestIntegration) makeOptions(args []string, noEvents, noCache bool) []string {
if p.RemoteTest {
return args
}
var debug string
if _, ok := os.LookupEnv("DEBUG"); ok {
debug = "--log-level=debug --syslog=true "
}
eventsType := "file"
if noEvents {
eventsType = "none"
}
podmanOptions := strings.Split(fmt.Sprintf("%s--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s --tmpdir %s --events-backend %s",
debug, p.CrioRoot, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager, p.TmpDir, eventsType), " ")
if os.Getenv("HOOK_OPTION") != "" {
podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION"))
}
podmanOptions = append(podmanOptions, strings.Split(p.StorageOptions, " ")...)
if !noCache {
cacheOptions := []string{"--storage-opt",
fmt.Sprintf("%s.imagestore=%s", p.PodmanTest.ImageCacheFS, p.PodmanTest.ImageCacheDir)}
podmanOptions = append(cacheOptions, podmanOptions...)
}
podmanOptions = append(podmanOptions, args...)
return podmanOptions
}
func writeConf(conf []byte, confPath string) {
if err := ioutil.WriteFile(confPath, conf, 777); err != nil {
fmt.Println(err)
}
}
func removeConf(confPath string) {
if err := os.Remove(confPath); err != nil {
fmt.Println(err)
}
}
// generateNetworkConfig generates a cni config with a random name
// it returns the network name and the filepath
func generateNetworkConfig(p *PodmanTestIntegration) (string, string) {
// generate a random name to prevent conflicts with other tests
name := "net" + stringid.GenerateNonCryptoID()
path := filepath.Join(p.CNIConfigDir, fmt.Sprintf("%s.conflist", name))
conf := fmt.Sprintf(`{
"cniVersion": "0.3.0",
"name": "%s",
"plugins": [
{
"type": "bridge",
"bridge": "cni1",
"isGateway": true,
"ipMasq": true,
"ipam": {
"type": "host-local",
"subnet": "10.99.0.0/16",
"routes": [
{ "dst": "0.0.0.0/0" }
]
}
},
{
"type": "portmap",
"capabilities": {
"portMappings": true
}
}
]
}`, name)
writeConf([]byte(conf), path)
return name, path
}

View File

@ -12,4 +12,5 @@ var (
labels = "quay.io/libpod/alpine_labels:latest"
ubi_minimal = "registry.access.redhat.com/ubi8-minimal"
ubi_init = "registry.access.redhat.com/ubi8-init"
cirros = "quay.io/libpod/cirros:latest"
)

View File

@ -336,7 +336,7 @@ var _ = Describe("Podman cp", func() {
DockerfileName := "Dockerfile.test-cp-root-dir"
ctrName := "test-container-cp-root"
session := podmanTest.PodmanNoCache([]string{"build", "-f", "build/" + DockerfileName, "-t", imgName, "build/"})
session := podmanTest.Podman([]string{"build", "-f", "build/" + DockerfileName, "-t", imgName, "build/"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@ -365,7 +365,7 @@ var _ = Describe("Podman cp", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "-f", imgName})
session = podmanTest.Podman([]string{"rmi", "-f", imgName})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})

View File

@ -271,73 +271,73 @@ var _ = Describe("Podman create", func() {
})
It("podman create --pull", func() {
session := podmanTest.PodmanNoCache([]string{"create", "--pull", "never", "--name=foo", "testimage:00000000"})
session := podmanTest.Podman([]string{"create", "--pull", "never", "--name=foo", "testimage:00000000"})
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError())
session = podmanTest.PodmanNoCache([]string{"create", "--pull", "always", "--name=foo", "testimage:00000000"})
session = podmanTest.Podman([]string{"create", "--pull", "always", "--name=foo", "testimage:00000000"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
It("podman create using image list by tag", func() {
session := podmanTest.PodmanNoCache([]string{"create", "--pull=always", "--override-arch=arm64", "--name=foo", ALPINELISTTAG})
session := podmanTest.Podman([]string{"create", "--pull=always", "--override-arch=arm64", "--name=foo", ALPINELISTTAG})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To((Equal(0)))
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.Image}}", "foo"})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Image}}", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To((Equal(0)))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64ID))
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.ImageName}}", "foo"})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.ImageName}}", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To((Equal(0)))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG))
})
It("podman create using image list by digest", func() {
session := podmanTest.PodmanNoCache([]string{"create", "--pull=always", "--override-arch=arm64", "--name=foo", ALPINELISTDIGEST})
session := podmanTest.Podman([]string{"create", "--pull=always", "--override-arch=arm64", "--name=foo", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To((Equal(0)))
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.Image}}", "foo"})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Image}}", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To((Equal(0)))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64ID))
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.ImageName}}", "foo"})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.ImageName}}", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To((Equal(0)))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
})
It("podman create using image list instance by digest", func() {
session := podmanTest.PodmanNoCache([]string{"create", "--pull=always", "--override-arch=arm64", "--name=foo", ALPINEARM64DIGEST})
session := podmanTest.Podman([]string{"create", "--pull=always", "--override-arch=arm64", "--name=foo", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To((Equal(0)))
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.Image}}", "foo"})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Image}}", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To((Equal(0)))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64ID))
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.ImageName}}", "foo"})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.ImageName}}", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To((Equal(0)))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
})
It("podman create using cross-arch image list instance by digest", func() {
session := podmanTest.PodmanNoCache([]string{"create", "--pull=always", "--override-arch=arm64", "--name=foo", ALPINEARM64DIGEST})
session := podmanTest.Podman([]string{"create", "--pull=always", "--override-arch=arm64", "--name=foo", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To((Equal(0)))
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.Image}}", "foo"})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Image}}", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To((Equal(0)))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64ID))
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.ImageName}}", "foo"})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.ImageName}}", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To((Equal(0)))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
})
It("podman create --authfile with nonexist authfile", func() {
session := podmanTest.PodmanNoCache([]string{"create", "--authfile", "/tmp/nonexist", "--name=foo", ALPINE})
session := podmanTest.Podman([]string{"create", "--authfile", "/tmp/nonexist", "--name=foo", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).To(Not(Equal(0)))
})

View File

@ -23,7 +23,6 @@ var _ = Describe("Podman image|container exists", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {

View File

@ -397,6 +397,7 @@ var _ = Describe("Podman generate kube", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
podmanTest.AddImageToRWStore(ALPINE)
session = podmanTest.Podman([]string{"play", "kube", outputFile})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))

View File

@ -45,18 +45,6 @@ var _ = Describe("Podman images", func() {
Expect(session.LineInOuputStartsWith("quay.io/libpod/busybox")).To(BeTrue())
})
It("podman images with no images prints header", func() {
rmi := podmanTest.PodmanNoCache([]string{"rmi", "-a"})
rmi.WaitWithDefaultTimeout()
Expect(rmi).Should(Exit(0))
session := podmanTest.PodmanNoCache([]string{"images"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(1))
Expect(session.LineInOutputContains("REPOSITORY")).To(BeTrue())
})
It("podman image List", func() {
session := podmanTest.Podman([]string{"image", "list"})
session.WaitWithDefaultTimeout()
@ -68,16 +56,16 @@ var _ = Describe("Podman images", func() {
It("podman images with multiple tags", func() {
// tag "docker.io/library/alpine:latest" to "foo:{a,b,c}"
podmanTest.RestoreAllArtifacts()
session := podmanTest.PodmanNoCache([]string{"tag", ALPINE, "foo:a", "foo:b", "foo:c"})
podmanTest.AddImageToRWStore(ALPINE)
session := podmanTest.Podman([]string{"tag", ALPINE, "foo:a", "foo:b", "foo:c"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
// tag "foo:c" to "bar:{a,b}"
session = podmanTest.PodmanNoCache([]string{"tag", "foo:c", "bar:a", "bar:b"})
session = podmanTest.Podman([]string{"tag", "foo:c", "bar:a", "bar:b"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
// check all previous and the newly tagged images
session = podmanTest.PodmanNoCache([]string{"images"})
session = podmanTest.Podman([]string{"images"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.LineInOutputContainsTag("quay.io/libpod/alpine", "latest")).To(BeTrue())
@ -87,10 +75,10 @@ var _ = Describe("Podman images", func() {
Expect(session.LineInOutputContainsTag("localhost/foo", "c")).To(BeTrue())
Expect(session.LineInOutputContainsTag("localhost/bar", "a")).To(BeTrue())
Expect(session.LineInOutputContainsTag("localhost/bar", "b")).To(BeTrue())
session = podmanTest.PodmanNoCache([]string{"images", "-qn"})
session = podmanTest.Podman([]string{"images", "-qn"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 3))
Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 11))
})
It("podman images with digests", func() {
@ -131,45 +119,46 @@ var _ = Describe("Podman images", func() {
})
It("podman images filter by image name", func() {
podmanTest.RestoreAllArtifacts()
session := podmanTest.PodmanNoCache([]string{"images", "-q", ALPINE})
podmanTest.AddImageToRWStore(ALPINE)
podmanTest.AddImageToRWStore(BB)
session := podmanTest.Podman([]string{"images", "-q", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(1))
session = podmanTest.PodmanNoCache([]string{"tag", ALPINE, "foo:a"})
session = podmanTest.Podman([]string{"tag", ALPINE, "foo:a"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"tag", BB, "foo:b"})
session = podmanTest.Podman([]string{"tag", BB, "foo:b"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"images", "-q", "foo"})
session = podmanTest.Podman([]string{"images", "-q", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
})
It("podman images filter reference", func() {
podmanTest.RestoreAllArtifacts()
result := podmanTest.PodmanNoCache([]string{"images", "-q", "-f", "reference=quay.io*"})
result := podmanTest.Podman([]string{"images", "-q", "-f", "reference=quay.io*"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(Equal(3))
Expect(len(result.OutputToStringArray())).To(Equal(8))
retapline := podmanTest.PodmanNoCache([]string{"images", "-f", "reference=a*pine"})
retapline := podmanTest.Podman([]string{"images", "-f", "reference=a*pine"})
retapline.WaitWithDefaultTimeout()
Expect(retapline).Should(Exit(0))
Expect(len(retapline.OutputToStringArray())).To(Equal(3))
Expect(len(retapline.OutputToStringArray())).To(Equal(6))
Expect(retapline.LineInOutputContains("alpine")).To(BeTrue())
retapline = podmanTest.PodmanNoCache([]string{"images", "-f", "reference=alpine"})
retapline = podmanTest.Podman([]string{"images", "-f", "reference=alpine"})
retapline.WaitWithDefaultTimeout()
Expect(retapline).Should(Exit(0))
Expect(len(retapline.OutputToStringArray())).To(Equal(3))
Expect(len(retapline.OutputToStringArray())).To(Equal(6))
Expect(retapline.LineInOutputContains("alpine")).To(BeTrue())
retnone := podmanTest.PodmanNoCache([]string{"images", "-q", "-f", "reference=bogus"})
retnone := podmanTest.Podman([]string{"images", "-q", "-f", "reference=bogus"})
retnone.WaitWithDefaultTimeout()
Expect(retnone).Should(Exit(0))
Expect(len(retnone.OutputToStringArray())).To(Equal(0))
@ -199,33 +188,23 @@ WORKDIR /test
})
It("podman images filter since image", func() {
podmanTest.RestoreAllArtifacts()
rmi := podmanTest.PodmanNoCache([]string{"rmi", "busybox"})
rmi.WaitWithDefaultTimeout()
Expect(rmi).Should(Exit(0))
dockerfile := `FROM quay.io/libpod/alpine:latest
`
podmanTest.BuildImage(dockerfile, "foobar.com/before:latest", "false")
result := podmanTest.PodmanNoCache([]string{"images", "-q", "-f", "since=quay.io/libpod/alpine:latest"})
result := podmanTest.Podman([]string{"images", "-q", "-f", "since=quay.io/libpod/alpine:latest"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(Equal(0))
Expect(len(result.OutputToStringArray())).To(Equal(7))
})
It("podman image list filter after image", func() {
podmanTest.RestoreAllArtifacts()
rmi := podmanTest.PodmanNoCache([]string{"image", "rm", "busybox"})
rmi.WaitWithDefaultTimeout()
Expect(rmi).Should(Exit(0))
dockerfile := `FROM quay.io/libpod/alpine:latest
`
podmanTest.BuildImage(dockerfile, "foobar.com/before:latest", "false")
result := podmanTest.PodmanNoCache([]string{"image", "list", "-q", "-f", "after=quay.io/libpod/alpine:latest"})
result := podmanTest.Podman([]string{"image", "list", "-q", "-f", "after=quay.io/libpod/alpine:latest"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
Expect(result.OutputToStringArray()).Should(HaveLen(0), "list filter output: %q", result.OutputToString())
Expect(result.OutputToStringArray()).Should(HaveLen(7), "list filter output: %q", result.OutputToString())
})
It("podman images filter dangling", func() {
@ -341,22 +320,21 @@ WORKDIR /test
It("podman images --all flag", func() {
SkipIfRemote("FIXME This should work on podman-remote, problem is with podman-remote build")
podmanTest.RestoreAllArtifacts()
dockerfile := `FROM quay.io/libpod/alpine:latest
RUN mkdir hello
RUN touch test.txt
ENV foo=bar
`
podmanTest.BuildImage(dockerfile, "test", "true")
session := podmanTest.PodmanNoCache([]string{"images"})
session := podmanTest.Podman([]string{"images"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(5))
Expect(len(session.OutputToStringArray())).To(Equal(len(CACHE_IMAGES) + 2))
session2 := podmanTest.PodmanNoCache([]string{"images", "--all"})
session2 := podmanTest.Podman([]string{"images", "--all"})
session2.WaitWithDefaultTimeout()
Expect(session2).Should(Exit(0))
Expect(len(session2.OutputToStringArray())).To(Equal(7))
Expect(len(session2.OutputToStringArray())).To(Equal(len(CACHE_IMAGES) + 4))
})
It("podman images filter by label", func() {

View File

@ -62,11 +62,14 @@ var _ = Describe("Podman import", func() {
export.WaitWithDefaultTimeout()
Expect(export.ExitCode()).To(Equal(0))
importImage := podmanTest.PodmanNoCache([]string{"import", outfile})
importImage := podmanTest.Podman([]string{"import", outfile})
importImage.WaitWithDefaultTimeout()
Expect(importImage.ExitCode()).To(Equal(0))
Expect(podmanTest.ImageExistsInMainStore(importImage.OutputToString())).To(BeTrue())
// tag the image which proves it is in R/W storage
tag := podmanTest.Podman([]string{"tag", importImage.OutputToString(), "foo"})
tag.WaitWithDefaultTimeout()
Expect(tag.ExitCode()).To(BeZero())
})
It("podman import with message flag", func() {

View File

@ -160,10 +160,7 @@ var _ = Describe("Podman inspect", func() {
})
It("podman inspect shows healthcheck on docker image", func() {
pull := podmanTest.Podman([]string{"pull", healthcheck})
pull.WaitWithDefaultTimeout()
Expect(pull.ExitCode()).To(BeZero())
podmanTest.AddImageToRWStore(healthcheck)
session := podmanTest.Podman([]string{"inspect", "--format=json", healthcheck})
session.WaitWithDefaultTimeout()
imageData := session.InspectImageJSON()
@ -248,12 +245,13 @@ var _ = Describe("Podman inspect", func() {
})
It("podman inspect container + image with same name gives container", func() {
podmanTest.AddImageToRWStore(ALPINE)
ctrName := "testcontainer"
create := podmanTest.PodmanNoCache([]string{"create", "--name", ctrName, ALPINE, "sh"})
create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "sh"})
create.WaitWithDefaultTimeout()
Expect(create.ExitCode()).To(Equal(0))
tag := podmanTest.PodmanNoCache([]string{"tag", ALPINE, ctrName + ":latest"})
tag := podmanTest.Podman([]string{"tag", ALPINE, ctrName + ":latest"})
tag.WaitWithDefaultTimeout()
Expect(tag.ExitCode()).To(Equal(0))
@ -271,7 +269,7 @@ var _ = Describe("Podman inspect", func() {
}
ctrName := "hugo"
create := podmanTest.PodmanNoCache([]string{
create := podmanTest.Podman([]string{
"create", "--name", ctrName,
"--security-opt", "seccomp=unconfined",
"--security-opt", "label=type:spc_t",
@ -291,7 +289,7 @@ var _ = Describe("Podman inspect", func() {
It("podman inspect pod", func() {
podName := "testpod"
create := podmanTest.PodmanNoCache([]string{"pod", "create", "--name", podName})
create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
create.WaitWithDefaultTimeout()
Expect(create.ExitCode()).To(Equal(0))
@ -305,7 +303,7 @@ var _ = Describe("Podman inspect", func() {
It("podman inspect pod with type", func() {
podName := "testpod"
create := podmanTest.PodmanNoCache([]string{"pod", "create", "--name", podName})
create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
create.WaitWithDefaultTimeout()
Expect(create.ExitCode()).To(Equal(0))
@ -320,7 +318,7 @@ var _ = Describe("Podman inspect", func() {
It("podman inspect latest pod", func() {
SkipIfRemote("--latest flag n/a")
podName := "testpod"
create := podmanTest.PodmanNoCache([]string{"pod", "create", "--name", podName})
create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
create.WaitWithDefaultTimeout()
Expect(create.ExitCode()).To(Equal(0))
@ -334,7 +332,7 @@ var _ = Describe("Podman inspect", func() {
It("podman inspect latest defaults to latest container", func() {
SkipIfRemote("--latest flag n/a")
podName := "testpod"
pod := podmanTest.PodmanNoCache([]string{"pod", "create", "--name", podName})
pod := podmanTest.Podman([]string{"pod", "create", "--name", podName})
pod.WaitWithDefaultTimeout()
Expect(pod.ExitCode()).To(Equal(0))
@ -388,7 +386,7 @@ var _ = Describe("Podman inspect", func() {
})
It("podman inspect --type container on a pod should fail", func() {
podName := "testpod"
create := podmanTest.PodmanNoCache([]string{"pod", "create", "--name", podName})
create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
create.WaitWithDefaultTimeout()
Expect(create.ExitCode()).To(Equal(0))
@ -399,7 +397,7 @@ var _ = Describe("Podman inspect", func() {
It("podman inspect --type network on a container should fail", func() {
ctrName := "testctr"
create := podmanTest.PodmanNoCache([]string{"create", "--name", ctrName, ALPINE})
create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE})
create.WaitWithDefaultTimeout()
Expect(create.ExitCode()).To(Equal(0))
@ -410,7 +408,7 @@ var _ = Describe("Podman inspect", func() {
It("podman inspect --type pod on a container should fail", func() {
ctrName := "testctr"
create := podmanTest.PodmanNoCache([]string{"create", "--name", ctrName, ALPINE})
create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE})
create.WaitWithDefaultTimeout()
Expect(create.ExitCode()).To(Equal(0))
@ -421,7 +419,7 @@ var _ = Describe("Podman inspect", func() {
It("podman inspect --type volume on a container should fail", func() {
ctrName := "testctr"
create := podmanTest.PodmanNoCache([]string{"create", "--name", ctrName, ALPINE})
create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE})
create.WaitWithDefaultTimeout()
Expect(create.ExitCode()).To(Equal(0))

View File

@ -22,7 +22,6 @@ var _ = Describe("Podman kill", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
podmanTest.SeedImages()
})
AfterEach(func() {

View File

@ -46,21 +46,6 @@ func (p *PodmanTestIntegration) PodmanExtraFiles(args []string, extraFiles []*os
return &PodmanSessionIntegration{podmanSession}
}
// PodmanNoCache calls podman with out adding the imagecache
func (p *PodmanTestIntegration) PodmanNoCache(args []string) *PodmanSessionIntegration {
var remoteArgs = []string{"--remote", "--url", p.RemoteSocket}
remoteArgs = append(remoteArgs, args...)
podmanSession := p.PodmanBase(remoteArgs, false, true)
return &PodmanSessionIntegration{podmanSession}
}
// PodmanNoEvents calls the Podman command without an imagecache and without an
// events backend. It is used mostly for caching and uncaching images.
func (p *PodmanTestIntegration) PodmanNoEvents(args []string) *PodmanSessionIntegration {
podmanSession := p.PodmanBase(args, true, true)
return &PodmanSessionIntegration{podmanSession}
}
func (p *PodmanTestIntegration) setDefaultRegistriesConfigEnv() {
defaultFile := filepath.Join(INTEGRATION_ROOT, "test/registries.conf")
os.Setenv("REGISTRIES_CONFIG_PATH", defaultFile)
@ -93,6 +78,9 @@ func (p *PodmanTestIntegration) StartRemoteService() {
remoteSocket := p.RemoteSocket
args = append(args, "system", "service", "--time", "0", remoteSocket)
podmanOptions := getRemoteOptions(p, args)
cacheOptions := []string{"--storage-opt",
fmt.Sprintf("%s.imagestore=%s", p.PodmanTest.ImageCacheFS, p.PodmanTest.ImageCacheDir)}
podmanOptions = append(cacheOptions, podmanOptions...)
command := exec.Command(p.PodmanBinary, podmanOptions...)
command.Stdout = os.Stdout
command.Stderr = os.Stderr
@ -153,11 +141,6 @@ func (p *PodmanTestIntegration) StopRemoteService() {
}
}
//MakeOptions assembles all the podman main options
func (p *PodmanTestIntegration) makeOptions(args []string, noEvents, noCache bool) []string {
return args
}
//MakeOptions assembles all the podman main options
func getRemoteOptions(p *PodmanTestIntegration, args []string) []string {
podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s",
@ -170,19 +153,9 @@ func getRemoteOptions(p *PodmanTestIntegration, args []string) []string {
return podmanOptions
}
func (p *PodmanTestIntegration) RestoreArtifactToCache(image string) error {
fmt.Printf("Restoring %s...\n", image)
dest := strings.Split(image, "/")
destName := fmt.Sprintf("/tmp/%s.tar", strings.Replace(strings.Join(strings.Split(dest[len(dest)-1], "/"), ""), ":", "-", -1))
p.CrioRoot = p.ImageCacheDir
restore := p.PodmanNoEvents([]string{"load", "-q", "-i", destName})
restore.WaitWithDefaultTimeout()
return nil
}
// SeedImages restores all the artifacts into the main store for remote tests
func (p *PodmanTestIntegration) SeedImages() error {
return p.RestoreAllArtifacts()
return nil
}
// RestoreArtifact puts the cached image into our test store
@ -212,6 +185,3 @@ func (p *PodmanTestIntegration) DelayForService() error {
}
return errors.New("Service not detected")
}
func populateCache(podman *PodmanTestIntegration) {}
func removeCache() {}

View File

@ -29,19 +29,6 @@ func (p *PodmanTestIntegration) PodmanExtraFiles(args []string, extraFiles []*os
return &PodmanSessionIntegration{podmanSession}
}
// PodmanNoCache calls the podman command with no configured imagecache
func (p *PodmanTestIntegration) PodmanNoCache(args []string) *PodmanSessionIntegration {
podmanSession := p.PodmanBase(args, false, true)
return &PodmanSessionIntegration{podmanSession}
}
// PodmanNoEvents calls the Podman command without an imagecache and without an
// events backend. It is used mostly for caching and uncaching images.
func (p *PodmanTestIntegration) PodmanNoEvents(args []string) *PodmanSessionIntegration {
podmanSession := p.PodmanBase(args, true, true)
return &PodmanSessionIntegration{podmanSession}
}
func (p *PodmanTestIntegration) setDefaultRegistriesConfigEnv() {
defaultFile := filepath.Join(INTEGRATION_ROOT, "test/registries.conf")
os.Setenv("REGISTRIES_CONFIG_PATH", defaultFile)
@ -61,34 +48,6 @@ func PodmanTestCreate(tempDir string) *PodmanTestIntegration {
return PodmanTestCreateUtil(tempDir, false)
}
// MakeOptions assembles all the podman main options
func (p *PodmanTestIntegration) makeOptions(args []string, noEvents, noCache bool) []string {
var debug string
if _, ok := os.LookupEnv("DEBUG"); ok {
debug = "--log-level=debug --syslog=true "
}
eventsType := "file"
if noEvents {
eventsType = "none"
}
podmanOptions := strings.Split(fmt.Sprintf("%s--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s --tmpdir %s --events-backend %s",
debug, p.CrioRoot, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager, p.TmpDir, eventsType), " ")
if os.Getenv("HOOK_OPTION") != "" {
podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION"))
}
podmanOptions = append(podmanOptions, strings.Split(p.StorageOptions, " ")...)
if !noCache {
cacheOptions := []string{"--storage-opt",
fmt.Sprintf("%s.imagestore=%s", p.PodmanTest.ImageCacheFS, p.PodmanTest.ImageCacheDir)}
podmanOptions = append(cacheOptions, podmanOptions...)
}
podmanOptions = append(podmanOptions, args...)
return podmanOptions
}
// RestoreArtifact puts the cached image into our test store
func (p *PodmanTestIntegration) RestoreArtifact(image string) error {
fmt.Printf("Restoring %s...\n", image)
@ -99,36 +58,9 @@ func (p *PodmanTestIntegration) RestoreArtifact(image string) error {
return nil
}
// RestoreArtifactToCache populates the imagecache from tarballs that were cached earlier
func (p *PodmanTestIntegration) RestoreArtifactToCache(image string) error {
fmt.Printf("Restoring %s...\n", image)
dest := strings.Split(image, "/")
destName := fmt.Sprintf("/tmp/%s.tar", strings.Replace(strings.Join(strings.Split(dest[len(dest)-1], "/"), ""), ":", "-", -1))
p.CrioRoot = p.ImageCacheDir
restore := p.PodmanNoEvents([]string{"load", "-q", "-i", destName})
restore.WaitWithDefaultTimeout()
return nil
}
func (p *PodmanTestIntegration) StopRemoteService() {}
func (p *PodmanTestIntegration) DelayForVarlink() {}
func populateCache(podman *PodmanTestIntegration) {
for _, image := range CACHE_IMAGES {
podman.RestoreArtifactToCache(image)
}
// logformatter uses this to recognize the first test
fmt.Printf("-----------------------------\n")
}
func removeCache() {
// Remove cache dirs
if err := os.RemoveAll(ImageCacheDir); err != nil {
fmt.Printf("%q\n", err)
}
}
// SeedImages is a no-op for localized testing
func (p *PodmanTestIntegration) SeedImages() error {
return nil

View File

@ -24,7 +24,7 @@ var _ = Describe("Podman load", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
podmanTest.AddImageToRWStore(ALPINE)
})
AfterEach(func() {
@ -37,11 +37,11 @@ var _ = Describe("Podman load", func() {
It("podman load input flag", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
images := podmanTest.PodmanNoCache([]string{"images"})
images := podmanTest.Podman([]string{"images"})
images.WaitWithDefaultTimeout()
fmt.Println(images.OutputToStringArray())
save := podmanTest.PodmanNoCache([]string{"save", "-o", outfile, ALPINE})
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
@ -49,7 +49,7 @@ var _ = Describe("Podman load", func() {
rmi.WaitWithDefaultTimeout()
Expect(rmi.ExitCode()).To(Equal(0))
result := podmanTest.PodmanNoCache([]string{"load", "-i", outfile})
result := podmanTest.Podman([]string{"load", "-i", outfile})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
})
@ -57,7 +57,7 @@ var _ = Describe("Podman load", func() {
It("podman load compressed tar file", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.PodmanNoCache([]string{"save", "-o", outfile, ALPINE})
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
@ -65,11 +65,11 @@ var _ = Describe("Podman load", func() {
Expect(compress.ExitCode()).To(Equal(0))
outfile = outfile + ".gz"
rmi := podmanTest.PodmanNoCache([]string{"rmi", ALPINE})
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
Expect(rmi.ExitCode()).To(Equal(0))
result := podmanTest.PodmanNoCache([]string{"load", "-i", outfile})
result := podmanTest.Podman([]string{"load", "-i", outfile})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
})
@ -77,15 +77,15 @@ var _ = Describe("Podman load", func() {
It("podman load oci-archive image", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.PodmanNoCache([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
rmi := podmanTest.PodmanNoCache([]string{"rmi", ALPINE})
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
Expect(rmi.ExitCode()).To(Equal(0))
result := podmanTest.PodmanNoCache([]string{"load", "-i", outfile})
result := podmanTest.Podman([]string{"load", "-i", outfile})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
})
@ -93,15 +93,15 @@ var _ = Describe("Podman load", func() {
It("podman load oci-archive with signature", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.PodmanNoCache([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
rmi := podmanTest.PodmanNoCache([]string{"rmi", ALPINE})
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
Expect(rmi.ExitCode()).To(Equal(0))
result := podmanTest.PodmanNoCache([]string{"load", "--signature-policy", "/etc/containers/policy.json", "-i", outfile})
result := podmanTest.Podman([]string{"load", "--signature-policy", "/etc/containers/policy.json", "-i", outfile})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
})
@ -109,15 +109,15 @@ var _ = Describe("Podman load", func() {
It("podman load with quiet flag", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.PodmanNoCache([]string{"save", "-o", outfile, ALPINE})
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
rmi := podmanTest.PodmanNoCache([]string{"rmi", ALPINE})
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
Expect(rmi.ExitCode()).To(Equal(0))
result := podmanTest.PodmanNoCache([]string{"load", "-q", "-i", outfile})
result := podmanTest.Podman([]string{"load", "-q", "-i", outfile})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
})
@ -126,7 +126,7 @@ var _ = Describe("Podman load", func() {
SkipIfRemote("Remote does not support loading directories")
outdir := filepath.Join(podmanTest.TempDir, "alpine")
save := podmanTest.PodmanNoCache([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE})
save := podmanTest.Podman([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
@ -156,7 +156,7 @@ var _ = Describe("Podman load", func() {
})
It("podman load bogus file", func() {
save := podmanTest.PodmanNoCache([]string{"load", "-i", "foobar.tar"})
save := podmanTest.Podman([]string{"load", "-i", "foobar.tar"})
save.WaitWithDefaultTimeout()
Expect(save).To(ExitWithError())
})
@ -168,75 +168,74 @@ var _ = Describe("Podman load", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
alpVersion := "quay.io/libpod/alpine:3.2"
pull := podmanTest.PodmanNoCache([]string{"pull", alpVersion})
pull := podmanTest.Podman([]string{"pull", alpVersion})
pull.WaitWithDefaultTimeout()
Expect(pull.ExitCode()).To(Equal(0))
save := podmanTest.PodmanNoCache([]string{"save", "-o", outfile, ALPINE, alpVersion})
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE, alpVersion})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
rmi := podmanTest.PodmanNoCache([]string{"rmi", ALPINE, alpVersion})
rmi := podmanTest.Podman([]string{"rmi", ALPINE, alpVersion})
rmi.WaitWithDefaultTimeout()
Expect(rmi.ExitCode()).To(Equal(0))
result := podmanTest.PodmanNoCache([]string{"load", "-i", outfile})
result := podmanTest.Podman([]string{"load", "-i", outfile})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
inspect := podmanTest.PodmanNoCache([]string{"inspect", ALPINE})
inspect := podmanTest.Podman([]string{"inspect", ALPINE})
inspect.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
inspect = podmanTest.PodmanNoCache([]string{"inspect", alpVersion})
inspect = podmanTest.Podman([]string{"inspect", alpVersion})
inspect.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
})
It("podman load localhost registry from scratch", func() {
outfile := filepath.Join(podmanTest.TempDir, "load_test.tar.gz")
setup := podmanTest.PodmanNoCache([]string{"tag", ALPINE, "hello:world"})
setup := podmanTest.Podman([]string{"tag", ALPINE, "hello:world"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
setup = podmanTest.PodmanNoCache([]string{"save", "-o", outfile, "--format", "oci-archive", "hello:world"})
setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", "hello:world"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
setup = podmanTest.PodmanNoCache([]string{"rmi", "hello:world"})
setup = podmanTest.Podman([]string{"rmi", "hello:world"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
load := podmanTest.PodmanNoCache([]string{"load", "-i", outfile})
load := podmanTest.Podman([]string{"load", "-i", outfile})
load.WaitWithDefaultTimeout()
Expect(load.ExitCode()).To(Equal(0))
result := podmanTest.PodmanNoCache([]string{"images", "hello:world"})
result := podmanTest.Podman([]string{"images", "hello:world"})
result.WaitWithDefaultTimeout()
Expect(result.LineInOutputContains("docker")).To(Not(BeTrue()))
Expect(result.LineInOutputContains("localhost")).To(BeTrue())
})
It("podman load localhost registry from scratch and :latest", func() {
podmanTest.RestoreArtifact(fedoraMinimal)
outfile := filepath.Join(podmanTest.TempDir, "load_test.tar.gz")
setup := podmanTest.PodmanNoCache([]string{"tag", fedoraMinimal, "hello"})
setup := podmanTest.Podman([]string{"tag", ALPINE, "hello"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
setup = podmanTest.PodmanNoCache([]string{"save", "-o", outfile, "--format", "oci-archive", "hello"})
setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", "hello"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
setup = podmanTest.PodmanNoCache([]string{"rmi", "hello"})
setup = podmanTest.Podman([]string{"rmi", "hello"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
load := podmanTest.PodmanNoCache([]string{"load", "-i", outfile})
load := podmanTest.Podman([]string{"load", "-i", outfile})
load.WaitWithDefaultTimeout()
Expect(load.ExitCode()).To(Equal(0))
result := podmanTest.PodmanNoCache([]string{"images", "hello:latest"})
result := podmanTest.Podman([]string{"images", "hello:latest"})
result.WaitWithDefaultTimeout()
Expect(result.LineInOutputContains("docker")).To(Not(BeTrue()))
Expect(result.LineInOutputContains("localhost")).To(BeTrue())
@ -246,48 +245,48 @@ var _ = Describe("Podman load", func() {
SkipIfRemote("podman-remote does not support loading directories")
outfile := filepath.Join(podmanTest.TempDir, "load")
setup := podmanTest.PodmanNoCache([]string{"tag", BB, "hello:world"})
setup := podmanTest.Podman([]string{"tag", ALPINE, "hello:world"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
setup = podmanTest.PodmanNoCache([]string{"save", "-o", outfile, "--format", "oci-dir", "hello:world"})
setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-dir", "hello:world"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
setup = podmanTest.PodmanNoCache([]string{"rmi", "hello:world"})
setup = podmanTest.Podman([]string{"rmi", "hello:world"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
load := podmanTest.PodmanNoCache([]string{"load", "-i", outfile})
load := podmanTest.Podman([]string{"load", "-i", outfile})
load.WaitWithDefaultTimeout()
Expect(load.ExitCode()).To(Equal(0))
result := podmanTest.PodmanNoCache([]string{"images", "load:latest"})
result := podmanTest.Podman([]string{"images", "load:latest"})
result.WaitWithDefaultTimeout()
Expect(result.LineInOutputContains("docker")).To(Not(BeTrue()))
Expect(result.LineInOutputContains("localhost")).To(BeTrue())
})
It("podman load xz compressed image", func() {
outfile := filepath.Join(podmanTest.TempDir, "bb.tar")
outfile := filepath.Join(podmanTest.TempDir, "alp.tar")
save := podmanTest.PodmanNoCache([]string{"save", "-o", outfile, BB})
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
session := SystemExec("xz", []string{outfile})
Expect(session.ExitCode()).To(Equal(0))
rmi := podmanTest.PodmanNoCache([]string{"rmi", BB})
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
Expect(rmi.ExitCode()).To(Equal(0))
result := podmanTest.PodmanNoCache([]string{"load", "-i", outfile + ".xz"})
result := podmanTest.Podman([]string{"load", "-i", outfile + ".xz"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
})
It("podman load multi-image archive", func() {
result := podmanTest.PodmanNoCache([]string{"load", "-i", "./testdata/image/docker-two-images.tar.xz"})
result := podmanTest.Podman([]string{"load", "-i", "./testdata/image/docker-two-images.tar.xz"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
Expect(result.LineInOutputContains("example.com/empty:latest")).To(BeTrue())

View File

@ -35,7 +35,6 @@ var _ = Describe("Podman login and logout", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.RestoreAllArtifacts()
authPath = filepath.Join(podmanTest.TempDir, "auth")
os.Mkdir(authPath, os.ModePerm)

View File

@ -55,12 +55,12 @@ var _ = Describe("Podman manifest", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"manifest", "inspect", "quay.io/libpod/busybox"})
session = podmanTest.Podman([]string{"manifest", "inspect", "quay.io/libpod/busybox"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
// inspect manifest of single image
session = podmanTest.PodmanNoCache([]string{"manifest", "inspect", "quay.io/libpod/busybox@sha256:6655df04a3df853b029a5fac8836035ac4fab117800c9a6c4b69341bb5306c3d"})
session = podmanTest.Podman([]string{"manifest", "inspect", "quay.io/libpod/busybox@sha256:6655df04a3df853b029a5fac8836035ac4fab117800c9a6c4b69341bb5306c3d"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
})

View File

@ -61,18 +61,16 @@ var _ = Describe("Podman mount", func() {
})
It("podman image mount", func() {
setup := podmanTest.PodmanNoCache([]string{"pull", ALPINE})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
mount := podmanTest.PodmanNoCache([]string{"image", "mount", ALPINE})
podmanTest.AddImageToRWStore(ALPINE)
mount := podmanTest.Podman([]string{"image", "mount", ALPINE})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).ToNot(Equal(0))
Expect(mount.ErrorToString()).To(ContainSubstring("podman unshare"))
})
It("podman unshare image podman mount", func() {
setup := podmanTest.PodmanNoCache([]string{"pull", ALPINE})
podmanTest.AddImageToRWStore(ALPINE)
setup := podmanTest.Podman([]string{"pull", ALPINE})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))

View File

@ -25,7 +25,7 @@ var _ = Describe("Podman mount", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
podmanTest.SeedImages()
podmanTest.AddImageToRWStore(ALPINE)
})
AfterEach(func() {
@ -281,79 +281,65 @@ var _ = Describe("Podman mount", func() {
})
It("podman image mount", func() {
setup := podmanTest.PodmanNoCache([]string{"pull", ALPINE})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
images := podmanTest.PodmanNoCache([]string{"images"})
images := podmanTest.Podman([]string{"images"})
images.WaitWithDefaultTimeout()
Expect(images.ExitCode()).To(Equal(0))
mount := podmanTest.PodmanNoCache([]string{"image", "mount", ALPINE})
mount := podmanTest.Podman([]string{"image", "mount", ALPINE})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
umount := podmanTest.PodmanNoCache([]string{"image", "umount", ALPINE})
umount := podmanTest.Podman([]string{"image", "umount", ALPINE})
umount.WaitWithDefaultTimeout()
Expect(umount.ExitCode()).To(Equal(0))
mount = podmanTest.PodmanNoCache([]string{"image", "mount"})
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
Expect(mount.OutputToString()).To(Equal(""))
// Mount multiple times
mount = podmanTest.PodmanNoCache([]string{"image", "mount", ALPINE})
mount = podmanTest.Podman([]string{"image", "mount", ALPINE})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
mount = podmanTest.PodmanNoCache([]string{"image", "mount", ALPINE})
mount = podmanTest.Podman([]string{"image", "mount", ALPINE})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
// Unmount once
mount = podmanTest.PodmanNoCache([]string{"image", "mount", ALPINE})
mount = podmanTest.Podman([]string{"image", "mount", ALPINE})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
mount = podmanTest.PodmanNoCache([]string{"image", "mount"})
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
Expect(mount.OutputToString()).To(ContainSubstring(ALPINE))
mount = podmanTest.PodmanNoCache([]string{"image", "umount", "--all"})
mount = podmanTest.Podman([]string{"image", "umount", "--all"})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
})
It("podman mount with json format", func() {
setup := podmanTest.PodmanNoCache([]string{"pull", fedoraMinimal})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
mount := podmanTest.PodmanNoCache([]string{"image", "mount", fedoraMinimal})
podmanTest.AddImageToRWStore(fedoraMinimal)
mount := podmanTest.Podman([]string{"image", "mount", fedoraMinimal})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
j := podmanTest.PodmanNoCache([]string{"image", "mount", "--format=json"})
j := podmanTest.Podman([]string{"image", "mount", "--format=json"})
j.WaitWithDefaultTimeout()
Expect(j.ExitCode()).To(Equal(0))
Expect(j.IsJSONOutputValid()).To(BeTrue())
umount := podmanTest.PodmanNoCache([]string{"image", "umount", fedoraMinimal})
umount := podmanTest.Podman([]string{"image", "umount", fedoraMinimal})
umount.WaitWithDefaultTimeout()
Expect(umount.ExitCode()).To(Equal(0))
})
It("podman umount --all", func() {
setup := podmanTest.PodmanNoCache([]string{"pull", fedoraMinimal})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
setup = podmanTest.PodmanNoCache([]string{"pull", ALPINE})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
podmanTest.AddImageToRWStore(fedoraMinimal)
mount := podmanTest.Podman([]string{"image", "mount", fedoraMinimal})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
@ -365,78 +351,70 @@ var _ = Describe("Podman mount", func() {
})
It("podman mount many", func() {
setup := podmanTest.PodmanNoCache([]string{"pull", fedoraMinimal})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
Skip("Issue where using short name when we have a lookaside store")
podmanTest.AddImageToRWStore(fedoraMinimal)
podmanTest.AddImageToRWStore(BB)
setup = podmanTest.PodmanNoCache([]string{"pull", ALPINE})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
setup = podmanTest.PodmanNoCache([]string{"pull", "busybox"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
mount1 := podmanTest.PodmanNoCache([]string{"image", "mount", fedoraMinimal, ALPINE, "busybox"})
mount1 := podmanTest.Podman([]string{"image", "mount", fedoraMinimal, ALPINE, "busybox"})
mount1.WaitWithDefaultTimeout()
Expect(mount1.ExitCode()).To(Equal(0))
umount := podmanTest.PodmanNoCache([]string{"image", "umount", fedoraMinimal, ALPINE})
umount := podmanTest.Podman([]string{"image", "umount", fedoraMinimal, ALPINE})
umount.WaitWithDefaultTimeout()
Expect(umount.ExitCode()).To(Equal(0))
mount := podmanTest.PodmanNoCache([]string{"image", "mount"})
mount := podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
Expect(mount.OutputToString()).To(ContainSubstring("busybox"))
mount1 = podmanTest.PodmanNoCache([]string{"image", "unmount", "busybox"})
mount1 = podmanTest.Podman([]string{"image", "unmount", "busybox"})
mount1.WaitWithDefaultTimeout()
Expect(mount1.ExitCode()).To(Equal(0))
mount = podmanTest.PodmanNoCache([]string{"image", "mount"})
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
Expect(mount.OutputToString()).To(Equal(""))
mount1 = podmanTest.PodmanNoCache([]string{"image", "mount", fedoraMinimal, ALPINE, "busybox"})
mount1 = podmanTest.Podman([]string{"image", "mount", fedoraMinimal, ALPINE, "busybox"})
mount1.WaitWithDefaultTimeout()
Expect(mount1.ExitCode()).To(Equal(0))
mount = podmanTest.PodmanNoCache([]string{"image", "mount"})
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
Expect(mount.OutputToString()).To(ContainSubstring(fedoraMinimal))
Expect(mount.OutputToString()).To(ContainSubstring(ALPINE))
umount = podmanTest.PodmanNoCache([]string{"image", "umount", "--all"})
umount = podmanTest.Podman([]string{"image", "umount", "--all"})
umount.WaitWithDefaultTimeout()
Expect(umount.ExitCode()).To(Equal(0))
mount = podmanTest.PodmanNoCache([]string{"image", "mount"})
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
Expect(mount.OutputToString()).To(Equal(""))
umount = podmanTest.PodmanNoCache([]string{"image", "umount", fedoraMinimal, ALPINE})
umount = podmanTest.Podman([]string{"image", "umount", fedoraMinimal, ALPINE})
umount.WaitWithDefaultTimeout()
Expect(umount.ExitCode()).To(Equal(0))
mount1 = podmanTest.PodmanNoCache([]string{"image", "mount", "--all"})
mount1 = podmanTest.Podman([]string{"image", "mount", "--all"})
mount1.WaitWithDefaultTimeout()
Expect(mount1.ExitCode()).To(Equal(0))
mount = podmanTest.PodmanNoCache([]string{"image", "mount"})
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
Expect(mount.OutputToString()).To(ContainSubstring(fedoraMinimal))
Expect(mount.OutputToString()).To(ContainSubstring(ALPINE))
umount = podmanTest.PodmanNoCache([]string{"image", "umount", "--all"})
umount = podmanTest.Podman([]string{"image", "umount", "--all"})
umount.WaitWithDefaultTimeout()
Expect(umount.ExitCode()).To(Equal(0))
mount = podmanTest.PodmanNoCache([]string{"image", "mount"})
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
Expect(mount.ExitCode()).To(Equal(0))
Expect(mount.OutputToString()).To(Equal(""))

View File

@ -2,9 +2,7 @@ package integration
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
@ -15,53 +13,6 @@ import (
. "github.com/onsi/gomega"
)
func writeConf(conf []byte, confPath string) {
if err := ioutil.WriteFile(confPath, conf, 777); err != nil {
fmt.Println(err)
}
}
func removeConf(confPath string) {
if err := os.Remove(confPath); err != nil {
fmt.Println(err)
}
}
// generateNetworkConfig generates a cni config with a random name
// it returns the network name and the filepath
func generateNetworkConfig(p *PodmanTestIntegration) (string, string) {
// generate a random name to prevent conflicts with other tests
name := "net" + stringid.GenerateNonCryptoID()
path := filepath.Join(p.CNIConfigDir, fmt.Sprintf("%s.conflist", name))
conf := fmt.Sprintf(`{
"cniVersion": "0.3.0",
"name": "%s",
"plugins": [
{
"type": "bridge",
"bridge": "cni1",
"isGateway": true,
"ipMasq": true,
"ipam": {
"type": "host-local",
"subnet": "10.99.0.0/16",
"routes": [
{ "dst": "0.0.0.0/0" }
]
}
},
{
"type": "portmap",
"capabilities": {
"portMappings": true
}
}
]
}`, name)
writeConf([]byte(conf), path)
return name, path
}
var _ = Describe("Podman network", func() {
var (
tempdir string

View File

@ -135,28 +135,29 @@ var _ = Describe("Podman prune", func() {
})
It("podman image prune unused images", func() {
podmanTest.RestoreAllArtifacts()
prune := podmanTest.PodmanNoCache([]string{"image", "prune", "-af"})
podmanTest.AddImageToRWStore(ALPINE)
podmanTest.AddImageToRWStore(BB)
prune := podmanTest.Podman([]string{"image", "prune", "-af"})
prune.WaitWithDefaultTimeout()
Expect(prune.ExitCode()).To(Equal(0))
images := podmanTest.PodmanNoCache([]string{"images", "-aq"})
images := podmanTest.Podman([]string{"images", "-aq"})
images.WaitWithDefaultTimeout()
// all images are unused, so they all should be deleted!
Expect(len(images.OutputToStringArray())).To(Equal(0))
Expect(len(images.OutputToStringArray())).To(Equal(len(CACHE_IMAGES)))
})
It("podman system image prune unused images", func() {
podmanTest.RestoreAllArtifacts()
podmanTest.AddImageToRWStore(ALPINE)
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
prune := podmanTest.PodmanNoCache([]string{"system", "prune", "-a", "--force"})
prune := podmanTest.Podman([]string{"system", "prune", "-a", "--force"})
prune.WaitWithDefaultTimeout()
Expect(prune.ExitCode()).To(Equal(0))
images := podmanTest.PodmanNoCache([]string{"images", "-aq"})
images := podmanTest.Podman([]string{"images", "-aq"})
images.WaitWithDefaultTimeout()
// all images are unused, so they all should be deleted!
Expect(len(images.OutputToStringArray())).To(Equal(0))
Expect(len(images.OutputToStringArray())).To(Equal(len(CACHE_IMAGES)))
})
It("podman system prune pods", func() {
@ -343,9 +344,9 @@ var _ = Describe("Podman prune", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
images := podmanTest.PodmanNoCache([]string{"images", "-aq"})
images := podmanTest.Podman([]string{"images", "-aq"})
images.WaitWithDefaultTimeout()
// all images are unused, so they all should be deleted!
Expect(len(images.OutputToStringArray())).To(Equal(0))
Expect(len(images.OutputToStringArray())).To(Equal(len(CACHE_IMAGES)))
})
})

View File

@ -35,200 +35,200 @@ var _ = Describe("Podman pull", func() {
})
It("podman pull from docker a not existing image", func() {
session := podmanTest.PodmanNoCache([]string{"pull", "ibetthisdoesntexistthere:foo"})
session := podmanTest.Podman([]string{"pull", "ibetthisdoesntexistthere:foo"})
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError())
})
It("podman pull from docker with tag", func() {
session := podmanTest.PodmanNoCache([]string{"pull", "quay.io/libpod/testdigest_v2s2:20200210"})
session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2:20200210"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "testdigest_v2s2:20200210"})
session = podmanTest.Podman([]string{"rmi", "testdigest_v2s2:20200210"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
It("podman pull from docker without tag", func() {
session := podmanTest.PodmanNoCache([]string{"pull", "quay.io/libpod/testdigest_v2s2"})
session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "testdigest_v2s2"})
session = podmanTest.Podman([]string{"rmi", "testdigest_v2s2"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
It("podman pull from alternate registry with tag", func() {
session := podmanTest.PodmanNoCache([]string{"pull", nginx})
session := podmanTest.Podman([]string{"pull", cirros})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", nginx})
session = podmanTest.Podman([]string{"rmi", cirros})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
It("podman pull from alternate registry without tag", func() {
session := podmanTest.PodmanNoCache([]string{"pull", "quay.io/libpod/alpine_nginx"})
session := podmanTest.Podman([]string{"pull", "quay.io/libpod/cirros"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "quay.io/libpod/alpine_nginx"})
session = podmanTest.Podman([]string{"rmi", "quay.io/libpod/cirros"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
It("podman pull by digest", func() {
session := podmanTest.PodmanNoCache([]string{"pull", "quay.io/libpod/testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"})
session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "testdigest_v2s2:none"})
session = podmanTest.Podman([]string{"rmi", "testdigest_v2s2:none"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
It("podman pull by digest (image list)", func() {
session := podmanTest.PodmanNoCache([]string{"pull", "--override-arch=arm64", ALPINELISTDIGEST})
session := podmanTest.Podman([]string{"pull", "--override-arch=arm64", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
// inspect using the digest of the list
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTDIGEST})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(HavePrefix("[]"))
// inspect using the digest of the list
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTDIGEST})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// inspect using the digest of the arch-specific image's manifest
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64DIGEST})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(HavePrefix("[]"))
// inspect using the digest of the arch-specific image's manifest
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64DIGEST})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// inspect using the image ID
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64ID})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64ID})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(HavePrefix("[]"))
// inspect using the image ID
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64ID})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64ID})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// remove using the digest of the list
session = podmanTest.PodmanNoCache([]string{"rmi", ALPINELISTDIGEST})
session = podmanTest.Podman([]string{"rmi", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
It("podman pull by instance digest (image list)", func() {
session := podmanTest.PodmanNoCache([]string{"pull", "--override-arch=arm64", ALPINEARM64DIGEST})
session := podmanTest.Podman([]string{"pull", "--override-arch=arm64", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
// inspect using the digest of the list
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTDIGEST})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Not(Equal(0)))
// inspect using the digest of the list
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTDIGEST})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Not(Equal(0)))
// inspect using the digest of the arch-specific image's manifest
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64DIGEST})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(HavePrefix("[]"))
// inspect using the digest of the arch-specific image's manifest
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64DIGEST})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(Not(ContainSubstring(ALPINELISTDIGEST)))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// inspect using the image ID
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64ID})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64ID})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(HavePrefix("[]"))
// inspect using the image ID
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64ID})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64ID})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(Not(ContainSubstring(ALPINELISTDIGEST)))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// remove using the digest of the instance
session = podmanTest.PodmanNoCache([]string{"rmi", ALPINEARM64DIGEST})
session = podmanTest.Podman([]string{"rmi", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
It("podman pull by tag (image list)", func() {
session := podmanTest.PodmanNoCache([]string{"pull", "--override-arch=arm64", ALPINELISTTAG})
session := podmanTest.Podman([]string{"pull", "--override-arch=arm64", ALPINELISTTAG})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
// inspect using the tag we used for pulling
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTTAG})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTTAG})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG))
// inspect using the tag we used for pulling
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTTAG})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTTAG})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// inspect using the digest of the list
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTDIGEST})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG))
// inspect using the digest of the list
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTDIGEST})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// inspect using the digest of the arch-specific image's manifest
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64DIGEST})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG))
// inspect using the digest of the arch-specific image's manifest
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64DIGEST})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// inspect using the image ID
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64ID})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64ID})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG))
// inspect using the image ID
session = podmanTest.PodmanNoCache([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64ID})
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64ID})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// remove using the tag
session = podmanTest.PodmanNoCache([]string{"rmi", ALPINELISTTAG})
session = podmanTest.Podman([]string{"rmi", ALPINELISTTAG})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
It("podman pull bogus image", func() {
session := podmanTest.PodmanNoCache([]string{"pull", "umohnani/get-started"})
session := podmanTest.Podman([]string{"pull", "umohnani/get-started"})
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError())
})
@ -236,26 +236,26 @@ var _ = Describe("Podman pull", func() {
It("podman pull from docker-archive", func() {
SkipIfRemote("podman-remote does not support pulling from docker-archive")
podmanTest.RestoreArtifact(ALPINE)
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
session := podmanTest.PodmanNoCache([]string{"save", "-o", tarfn, "alpine"})
podmanTest.AddImageToRWStore(cirros)
tarfn := filepath.Join(podmanTest.TempDir, "cirros.tar")
session := podmanTest.Podman([]string{"save", "-o", tarfn, "cirros"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "alpine"})
session = podmanTest.Podman([]string{"rmi", "cirros"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"pull", fmt.Sprintf("docker-archive:%s", tarfn)})
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:%s", tarfn)})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "alpine"})
session = podmanTest.Podman([]string{"rmi", "cirros"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
// Pulling a multi-image archive without further specifying
// which image _must_ error out. Pulling is restricted to one
// image.
session = podmanTest.PodmanNoCache([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz")})
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz")})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(125))
expectedError := "Unexpected tar manifest.json: expected 1 item, got 2"
@ -264,31 +264,31 @@ var _ = Describe("Podman pull", func() {
// Now pull _one_ image from a multi-image archive via the name
// and index syntax.
session = podmanTest.PodmanNoCache([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz:@0")})
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz:@0")})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz:example.com/empty:latest")})
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz:example.com/empty:latest")})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz:@1")})
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz:@1")})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz:example.com/empty/but:different")})
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz:example.com/empty/but:different")})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
// Now check for some errors.
session = podmanTest.PodmanNoCache([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz:foo.com/does/not/exist:latest")})
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz:foo.com/does/not/exist:latest")})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(125))
expectedError = "Tag \"foo.com/does/not/exist:latest\" not found"
found, _ = session.ErrorGrepString(expectedError)
Expect(found).To(Equal(true))
session = podmanTest.PodmanNoCache([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz:@2")})
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/image/docker-two-images.tar.xz:@2")})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(125))
expectedError = "Invalid source index @2, only 2 manifest items available"
@ -299,19 +299,19 @@ var _ = Describe("Podman pull", func() {
It("podman pull from oci-archive", func() {
SkipIfRemote("podman-remote does not support pulling from oci-archive")
podmanTest.RestoreArtifact(ALPINE)
tarfn := filepath.Join(podmanTest.TempDir, "oci-alp.tar")
session := podmanTest.PodmanNoCache([]string{"save", "--format", "oci-archive", "-o", tarfn, "alpine"})
podmanTest.AddImageToRWStore(cirros)
tarfn := filepath.Join(podmanTest.TempDir, "oci-cirrus.tar")
session := podmanTest.Podman([]string{"save", "--format", "oci-archive", "-o", tarfn, "cirros"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "alpine"})
session = podmanTest.Podman([]string{"rmi", "cirros"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"pull", fmt.Sprintf("oci-archive:%s", tarfn)})
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("oci-archive:%s", tarfn)})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "alpine"})
session = podmanTest.Podman([]string{"rmi", "cirros"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
@ -319,67 +319,61 @@ var _ = Describe("Podman pull", func() {
It("podman pull from local directory", func() {
SkipIfRemote("podman-remote does not support pulling from local directory")
podmanTest.RestoreArtifact(ALPINE)
dirpath := filepath.Join(podmanTest.TempDir, "alpine")
podmanTest.AddImageToRWStore(cirros)
dirpath := filepath.Join(podmanTest.TempDir, "cirros")
os.MkdirAll(dirpath, os.ModePerm)
imgPath := fmt.Sprintf("dir:%s", dirpath)
session := podmanTest.PodmanNoCache([]string{"push", "alpine", imgPath})
session := podmanTest.Podman([]string{"push", "cirros", imgPath})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "alpine"})
session = podmanTest.Podman([]string{"rmi", "cirros"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"pull", imgPath})
session = podmanTest.Podman([]string{"pull", imgPath})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"images"})
session = podmanTest.Podman([]string{"images"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.LineInOutputContainsTag(filepath.Join("localhost", dirpath), "latest")).To(BeTrue())
session = podmanTest.PodmanNoCache([]string{"rmi", "alpine"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
It("podman pull from local OCI directory", func() {
SkipIfRemote("podman-remote does not support pulling from OCI directory")
podmanTest.RestoreArtifact(ALPINE)
dirpath := filepath.Join(podmanTest.TempDir, "alpine")
podmanTest.AddImageToRWStore(cirros)
dirpath := filepath.Join(podmanTest.TempDir, "cirros")
os.MkdirAll(dirpath, os.ModePerm)
imgPath := fmt.Sprintf("oci:%s", dirpath)
session := podmanTest.PodmanNoCache([]string{"push", "alpine", imgPath})
session := podmanTest.Podman([]string{"push", "cirros", imgPath})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "alpine"})
session = podmanTest.Podman([]string{"rmi", "cirros"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"pull", imgPath})
session = podmanTest.Podman([]string{"pull", imgPath})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"images"})
session = podmanTest.Podman([]string{"images"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.LineInOutputContainsTag(filepath.Join("localhost", dirpath), "latest")).To(BeTrue())
session = podmanTest.PodmanNoCache([]string{"rmi", "alpine"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
It("podman pull check quiet", func() {
podmanTest.RestoreArtifact(ALPINE)
setup := podmanTest.PodmanNoCache([]string{"images", ALPINE, "-q", "--no-trunc"})
setup := podmanTest.Podman([]string{"images", ALPINE, "-q", "--no-trunc"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
shortImageId := strings.Split(setup.OutputToString(), ":")[1]
rmi := podmanTest.PodmanNoCache([]string{"rmi", ALPINE})
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
Expect(rmi.ExitCode()).To(Equal(0))
pull := podmanTest.PodmanNoCache([]string{"pull", "-q", ALPINE})
pull := podmanTest.Podman([]string{"pull", "-q", ALPINE})
pull.WaitWithDefaultTimeout()
Expect(pull.ExitCode()).To(Equal(0))
@ -387,19 +381,19 @@ var _ = Describe("Podman pull", func() {
})
It("podman pull check all tags", func() {
session := podmanTest.PodmanNoCache([]string{"pull", "--all-tags", "k8s.gcr.io/pause"})
session := podmanTest.Podman([]string{"pull", "--all-tags", "k8s.gcr.io/pause"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.LineInOuputStartsWith("Pulled Images:")).To(BeTrue())
session = podmanTest.PodmanNoCache([]string{"images"})
session = podmanTest.Podman([]string{"images"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 4))
})
It("podman pull from docker with nonexist --authfile", func() {
session := podmanTest.PodmanNoCache([]string{"pull", "--authfile", "/tmp/nonexist", ALPINE})
session := podmanTest.Podman([]string{"pull", "--authfile", "/tmp/nonexist", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Not(Equal(0)))
})
@ -421,7 +415,7 @@ var _ = Describe("Podman pull", func() {
// A `podman inspect $name` must yield the one from the _first_
// matching registry in the registries.conf.
getID := func(image string) string {
setup := podmanTest.PodmanNoCache([]string{"image", "inspect", image})
setup := podmanTest.Podman([]string{"image", "inspect", image})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
@ -431,11 +425,11 @@ var _ = Describe("Podman pull", func() {
}
untag := func(image string) {
setup := podmanTest.PodmanNoCache([]string{"untag", image})
setup := podmanTest.Podman([]string{"untag", image})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
setup = podmanTest.PodmanNoCache([]string{"image", "inspect", image})
setup = podmanTest.Podman([]string{"image", "inspect", image})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
@ -445,10 +439,10 @@ var _ = Describe("Podman pull", func() {
}
tag := func(image, tag string) {
setup := podmanTest.PodmanNoCache([]string{"tag", image, tag})
setup := podmanTest.Podman([]string{"tag", image, tag})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
setup = podmanTest.PodmanNoCache([]string{"image", "exists", tag})
setup = podmanTest.Podman([]string{"image", "exists", tag})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
}
@ -489,7 +483,7 @@ var _ = Describe("Podman pull", func() {
tag(image1, t.tag1)
tag(image2, t.tag2)
setup := podmanTest.PodmanNoCache([]string{"image", "inspect", name})
setup := podmanTest.Podman([]string{"image", "inspect", name})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))

View File

@ -28,7 +28,7 @@ var _ = Describe("Podman push", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
podmanTest.AddImageToRWStore(ALPINE)
})
AfterEach(func() {
@ -39,18 +39,18 @@ var _ = Describe("Podman push", func() {
})
It("podman push to containers/storage", func() {
session := podmanTest.PodmanNoCache([]string{"push", ALPINE, "containers-storage:busybox:test"})
session := podmanTest.Podman([]string{"push", ALPINE, "containers-storage:busybox:test"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", ALPINE})
session = podmanTest.Podman([]string{"rmi", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
It("podman push to dir", func() {
bbdir := filepath.Join(podmanTest.TempDir, "busybox")
session := podmanTest.PodmanNoCache([]string{"push", "--remove-signatures", ALPINE,
session := podmanTest.Podman([]string{"push", "--remove-signatures", ALPINE,
fmt.Sprintf("dir:%s", bbdir)})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@ -65,7 +65,7 @@ var _ = Describe("Podman push", func() {
}
lock := GetPortLock("5000")
defer lock.Unlock()
session := podmanTest.PodmanNoCache([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@ -73,12 +73,12 @@ var _ = Describe("Podman push", func() {
Skip("Cannot start docker registry.")
}
push := podmanTest.PodmanNoCache([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
push.WaitWithDefaultTimeout()
Expect(push.ExitCode()).To(Equal(0))
// Test --digestfile option
push2 := podmanTest.PodmanNoCache([]string{"push", "--tls-verify=false", "--digestfile=/tmp/digestfile.txt", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
push2 := podmanTest.Podman([]string{"push", "--tls-verify=false", "--digestfile=/tmp/digestfile.txt", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
push2.WaitWithDefaultTimeout()
fi, err := os.Lstat("/tmp/digestfile.txt")
Expect(err).To(BeNil())
@ -113,7 +113,7 @@ var _ = Describe("Podman push", func() {
}
lock := GetPortLock("5000")
defer lock.Unlock()
session := podmanTest.PodmanNoCache([]string{"run", "--entrypoint", "htpasswd", registry, "-Bbn", "podmantest", "test"})
session := podmanTest.Podman([]string{"run", "--entrypoint", "htpasswd", registry, "-Bbn", "podmantest", "test"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@ -123,7 +123,7 @@ var _ = Describe("Podman push", func() {
f.WriteString(session.OutputToString())
f.Sync()
session = podmanTest.PodmanNoCache([]string{"run", "-d", "-p", "5000:5000", "--name", "registry", "-v",
session = podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry", "-v",
strings.Join([]string{authPath, "/auth"}, ":"), "-e", "REGISTRY_AUTH=htpasswd", "-e",
"REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm", "-e", "REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd",
"-v", strings.Join([]string{certPath, "/certs"}, ":"), "-e", "REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt",
@ -135,36 +135,36 @@ var _ = Describe("Podman push", func() {
Skip("Cannot start docker registry.")
}
session = podmanTest.PodmanNoCache([]string{"logs", "registry"})
session = podmanTest.Podman([]string{"logs", "registry"})
session.WaitWithDefaultTimeout()
push := podmanTest.PodmanNoCache([]string{"push", "--creds=podmantest:test", ALPINE, "localhost:5000/tlstest"})
push := podmanTest.Podman([]string{"push", "--creds=podmantest:test", ALPINE, "localhost:5000/tlstest"})
push.WaitWithDefaultTimeout()
Expect(push).To(ExitWithError())
push = podmanTest.PodmanNoCache([]string{"push", "--creds=podmantest:test", "--tls-verify=false", ALPINE, "localhost:5000/tlstest"})
push = podmanTest.Podman([]string{"push", "--creds=podmantest:test", "--tls-verify=false", ALPINE, "localhost:5000/tlstest"})
push.WaitWithDefaultTimeout()
Expect(push.ExitCode()).To(Equal(0))
setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), "/etc/containers/certs.d/localhost:5000/ca.crt"})
Expect(setup.ExitCode()).To(Equal(0))
push = podmanTest.PodmanNoCache([]string{"push", "--creds=podmantest:wrongpasswd", ALPINE, "localhost:5000/credstest"})
push = podmanTest.Podman([]string{"push", "--creds=podmantest:wrongpasswd", ALPINE, "localhost:5000/credstest"})
push.WaitWithDefaultTimeout()
Expect(push).To(ExitWithError())
push = podmanTest.PodmanNoCache([]string{"push", "--creds=podmantest:test", "--cert-dir=fakedir", ALPINE, "localhost:5000/certdirtest"})
push = podmanTest.Podman([]string{"push", "--creds=podmantest:test", "--cert-dir=fakedir", ALPINE, "localhost:5000/certdirtest"})
push.WaitWithDefaultTimeout()
Expect(push).To(ExitWithError())
push = podmanTest.PodmanNoCache([]string{"push", "--creds=podmantest:test", ALPINE, "localhost:5000/defaultflags"})
push = podmanTest.Podman([]string{"push", "--creds=podmantest:test", ALPINE, "localhost:5000/defaultflags"})
push.WaitWithDefaultTimeout()
Expect(push.ExitCode()).To(Equal(0))
})
It("podman push to docker-archive", func() {
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
session := podmanTest.PodmanNoCache([]string{"push", ALPINE,
session := podmanTest.Podman([]string{"push", ALPINE,
fmt.Sprintf("docker-archive:%s:latest", tarfn)})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@ -183,7 +183,7 @@ var _ = Describe("Podman push", func() {
Skip("Docker is not available")
}
session := podmanTest.PodmanNoCache([]string{"push", ALPINE, "docker-daemon:alpine:podmantest"})
session := podmanTest.Podman([]string{"push", ALPINE, "docker-daemon:alpine:podmantest"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@ -197,7 +197,7 @@ var _ = Describe("Podman push", func() {
It("podman push to oci-archive", func() {
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
session := podmanTest.PodmanNoCache([]string{"push", ALPINE,
session := podmanTest.Podman([]string{"push", ALPINE,
fmt.Sprintf("oci-archive:%s:latest", tarfn)})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@ -205,7 +205,7 @@ var _ = Describe("Podman push", func() {
It("podman push to docker-archive no reference", func() {
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
session := podmanTest.PodmanNoCache([]string{"push", ALPINE,
session := podmanTest.Podman([]string{"push", ALPINE,
fmt.Sprintf("docker-archive:%s", tarfn)})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@ -213,7 +213,7 @@ var _ = Describe("Podman push", func() {
It("podman push to oci-archive no reference", func() {
ociarc := filepath.Join(podmanTest.TempDir, "alp-oci")
session := podmanTest.PodmanNoCache([]string{"push", ALPINE,
session := podmanTest.Podman([]string{"push", ALPINE,
fmt.Sprintf("oci-archive:%s", ociarc)})
session.WaitWithDefaultTimeout()

View File

@ -1,7 +1,6 @@
package integration
import (
"fmt"
"os"
. "github.com/containers/podman/v2/test/utils"
@ -24,7 +23,6 @@ var _ = Describe("Podman rmi", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
@ -42,48 +40,50 @@ var _ = Describe("Podman rmi", func() {
})
It("podman rmi with fq name", func() {
session := podmanTest.PodmanNoCache([]string{"rmi", ALPINE})
podmanTest.AddImageToRWStore(ALPINE)
session := podmanTest.Podman([]string{"rmi", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
})
It("podman rmi with short name", func() {
session := podmanTest.PodmanNoCache([]string{"rmi", "alpine"})
podmanTest.AddImageToRWStore(cirros)
session := podmanTest.Podman([]string{"rmi", "cirros"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
})
It("podman rmi all images", func() {
podmanTest.RestoreArtifact(nginx)
session := podmanTest.PodmanNoCache([]string{"rmi", "-a"})
podmanTest.AddImageToRWStore(nginx)
session := podmanTest.Podman([]string{"rmi", "-a"})
session.WaitWithDefaultTimeout()
images := podmanTest.PodmanNoCache([]string{"images"})
images := podmanTest.Podman([]string{"images"})
images.WaitWithDefaultTimeout()
fmt.Println(images.OutputToStringArray())
Expect(session).Should(Exit(0))
})
It("podman rmi all images forcibly with short options", func() {
podmanTest.RestoreArtifact(nginx)
session := podmanTest.PodmanNoCache([]string{"rmi", "-fa"})
podmanTest.AddImageToRWStore(nginx)
session := podmanTest.Podman([]string{"rmi", "-fa"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
})
It("podman rmi tagged image", func() {
setup := podmanTest.PodmanNoCache([]string{"images", "-q", ALPINE})
podmanTest.AddImageToRWStore(cirros)
setup := podmanTest.Podman([]string{"images", "-q", cirros})
setup.WaitWithDefaultTimeout()
Expect(setup).Should(Exit(0))
session := podmanTest.PodmanNoCache([]string{"tag", "alpine", "foo:bar", "foo"})
session := podmanTest.Podman([]string{"tag", cirros, "foo:bar", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
result := podmanTest.PodmanNoCache([]string{"images", "-q", "foo"})
result := podmanTest.Podman([]string{"images", "-q", "foo"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
@ -91,114 +91,106 @@ var _ = Describe("Podman rmi", func() {
})
It("podman rmi image with tags by ID cannot be done without force", func() {
setup := podmanTest.PodmanNoCache([]string{"images", "-q", ALPINE})
podmanTest.AddImageToRWStore(cirros)
setup := podmanTest.Podman([]string{"images", "-q", cirros})
setup.WaitWithDefaultTimeout()
Expect(setup).Should(Exit(0))
alpineId := setup.OutputToString()
cirrosId := setup.OutputToString()
session := podmanTest.PodmanNoCache([]string{"tag", "alpine", "foo:bar", "foo"})
session := podmanTest.Podman([]string{"tag", "cirros", "foo:bar", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
// Trying without --force should fail
result := podmanTest.PodmanNoCache([]string{"rmi", alpineId})
result := podmanTest.Podman([]string{"rmi", cirrosId})
result.WaitWithDefaultTimeout()
Expect(result).To(ExitWithError())
// With --force it should work
resultForce := podmanTest.PodmanNoCache([]string{"rmi", "-f", alpineId})
resultForce := podmanTest.Podman([]string{"rmi", "-f", cirrosId})
resultForce.WaitWithDefaultTimeout()
Expect(resultForce).Should(Exit(0))
})
It("podman rmi image that is a parent of another image", func() {
session := podmanTest.PodmanNoCache([]string{"rmi", "-fa"})
Skip("I need help with this one. i dont understand what is going on")
podmanTest.AddImageToRWStore(cirros)
session := podmanTest.Podman([]string{"run", "--name", "c_test", cirros, "true"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"run", "--name", "c_test", ALPINE, "true"})
session = podmanTest.Podman([]string{"commit", "-q", "c_test", "test"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"commit", "-q", "c_test", "test"})
session = podmanTest.Podman([]string{"rm", "c_test"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"rm", "c_test"})
session = podmanTest.Podman([]string{"rmi", cirros})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"rmi", ALPINE})
session = podmanTest.Podman([]string{"images", "-q"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(12))
session = podmanTest.PodmanNoCache([]string{"images", "-q"})
session = podmanTest.Podman([]string{"images", "--sort", "created", "--format", "{{.Id}}", "--all"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(1))
session = podmanTest.PodmanNoCache([]string{"images", "--sort", "created", "--format", "{{.Id}}", "--all"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2),
Expect(len(session.OutputToStringArray())).To(Equal(13),
"Output from 'podman images -q -a':'%s'", session.Out.Contents())
untaggedImg := session.OutputToStringArray()[1]
session = podmanTest.PodmanNoCache([]string{"rmi", "-f", untaggedImg})
session = podmanTest.Podman([]string{"rmi", "-f", untaggedImg})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(2), "UntaggedImg is '%s'", untaggedImg)
})
It("podman rmi image that is created from another named imaged", func() {
session := podmanTest.PodmanNoCache([]string{"rmi", "-fa"})
podmanTest.AddImageToRWStore(ALPINE)
session := podmanTest.Podman([]string{"create", "--name", "c_test1", ALPINE, "true"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"create", "--name", "c_test1", ALPINE, "true"})
session = podmanTest.Podman([]string{"commit", "-q", "c_test1", "test1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"commit", "-q", "c_test1", "test1"})
session = podmanTest.Podman([]string{"create", "--name", "c_test2", "test1", "true"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"create", "--name", "c_test2", "test1", "true"})
session = podmanTest.Podman([]string{"commit", "-q", "c_test2", "test2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"commit", "-q", "c_test2", "test2"})
session = podmanTest.Podman([]string{"rm", "-a"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"rm", "-a"})
session = podmanTest.Podman([]string{"rmi", "test2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "test2"})
session = podmanTest.Podman([]string{"images", "-q"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"images", "-q"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(len(session.OutputToStringArray())).To(Equal(len(CACHE_IMAGES) + 1))
})
It("podman rmi with cached images", func() {
SkipIfRemote("FIXME This should work on podman-remote, problem is with podman-remote build")
session := podmanTest.PodmanNoCache([]string{"rmi", "-fa"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
dockerfile := `FROM quay.io/libpod/alpine:latest
podmanTest.AddImageToRWStore(cirros)
dockerfile := `FROM quay.io/libpod/cirros:latest
RUN mkdir hello
RUN touch test.txt
ENV foo=bar
`
podmanTest.BuildImage(dockerfile, "test", "true")
dockerfile = `FROM quay.io/libpod/alpine:latest
dockerfile = `FROM quay.io/libpod/cirros:latest
RUN mkdir hello
RUN touch test.txt
RUN mkdir blah
@ -206,57 +198,57 @@ var _ = Describe("Podman rmi", func() {
`
podmanTest.BuildImage(dockerfile, "test2", "true")
session = podmanTest.PodmanNoCache([]string{"images", "-q", "-a"})
session := podmanTest.Podman([]string{"images", "-q", "-a"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
numOfImages := len(session.OutputToStringArray())
session = podmanTest.PodmanNoCache([]string{"rmi", "test2"})
session = podmanTest.Podman([]string{"rmi", "test2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"images", "-q", "-a"})
session = podmanTest.Podman([]string{"images", "-q", "-a"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(numOfImages - len(session.OutputToStringArray())).To(Equal(2))
session = podmanTest.PodmanNoCache([]string{"rmi", "test"})
session = podmanTest.Podman([]string{"rmi", "test"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"images", "-q", "-a"})
session = podmanTest.Podman([]string{"images", "-q", "-a"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(1))
Expect(len(session.OutputToStringArray())).To(Equal(12))
podmanTest.BuildImage(dockerfile, "test3", "true")
session = podmanTest.PodmanNoCache([]string{"rmi", ALPINE})
session = podmanTest.Podman([]string{"rmi", cirros})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "test3"})
session = podmanTest.Podman([]string{"rmi", "test3"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.PodmanNoCache([]string{"images", "-q", "-a"})
session = podmanTest.Podman([]string{"images", "-q", "-a"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToString())).To(Equal(0))
Expect(len(session.OutputToString())).To(Equal(142))
})
It("podman rmi -a with no images should be exit 0", func() {
session := podmanTest.PodmanNoCache([]string{"rmi", "-fa"})
session := podmanTest.Podman([]string{"rmi", "-fa"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session2 := podmanTest.PodmanNoCache([]string{"rmi", "-fa"})
session2 := podmanTest.Podman([]string{"rmi", "-fa"})
session2.WaitWithDefaultTimeout()
Expect(session2).Should(Exit(0))
})
It("podman rmi -a with parent|child images", func() {
dockerfile := `FROM quay.io/libpod/alpine:latest AS base
dockerfile := `FROM quay.io/libpod/cirros:latest AS base
RUN touch /1
ENV LOCAL=/1
RUN find $LOCAL
@ -265,21 +257,20 @@ RUN find $LOCAL
`
podmanTest.BuildImage(dockerfile, "test", "true")
session := podmanTest.PodmanNoCache([]string{"rmi", "-a"})
session := podmanTest.Podman([]string{"rmi", "-a"})
session.WaitWithDefaultTimeout()
fmt.Println(session.OutputToString())
Expect(session).Should(Exit(0))
images := podmanTest.PodmanNoCache([]string{"images", "-aq"})
images := podmanTest.Podman([]string{"images", "-aq"})
images.WaitWithDefaultTimeout()
Expect(images).Should(Exit(0))
Expect(len(images.OutputToStringArray())).To(Equal(0))
Expect(len(images.OutputToStringArray())).To(Equal(len(CACHE_IMAGES)))
})
// Don't rerun all tests; just assume that if we get that diagnostic,
// we're getting rmi
It("podman image rm is the same as rmi", func() {
session := podmanTest.PodmanNoCache([]string{"image", "rm"})
session := podmanTest.Podman([]string{"image", "rm"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(125))
match, _ := session.ErrorGrepString("image name or ID must be specified")

View File

@ -572,12 +572,12 @@ USER bin`
})
It("podman run tagged image", func() {
podmanTest.RestoreArtifact(BB)
tag := podmanTest.PodmanNoCache([]string{"tag", "busybox", "bb"})
podmanTest.AddImageToRWStore(BB)
tag := podmanTest.Podman([]string{"tag", BB, "bb"})
tag.WaitWithDefaultTimeout()
Expect(tag.ExitCode()).To(Equal(0))
session := podmanTest.PodmanNoCache([]string{"run", "--rm", "bb", "ls"})
session := podmanTest.Podman([]string{"run", "--rm", "bb", "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
@ -1339,42 +1339,30 @@ WORKDIR /madethis`
})
It("podman run a container with --pull never should fail if no local store", func() {
// Make sure ALPINE image does not exist. Ignore errors
session := podmanTest.PodmanNoCache([]string{"rmi", "--force", "never", ALPINE})
session.WaitWithDefaultTimeout()
session = podmanTest.PodmanNoCache([]string{"run", "--pull", "never", ALPINE, "ls"})
session := podmanTest.Podman([]string{"run", "--pull", "never", "docker.io/library/debian:latest", "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(125))
})
It("podman run container with --pull missing and only pull once", func() {
// Make sure ALPINE image does not exist. Ignore errors
session := podmanTest.PodmanNoCache([]string{"rmi", "--force", "never", ALPINE})
session.WaitWithDefaultTimeout()
session = podmanTest.PodmanNoCache([]string{"run", "--pull", "missing", ALPINE, "ls"})
session := podmanTest.Podman([]string{"run", "--pull", "missing", cirros, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
session = podmanTest.PodmanNoCache([]string{"run", "--pull", "missing", ALPINE, "ls"})
session = podmanTest.Podman([]string{"run", "--pull", "missing", cirros, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.ErrorToString()).ToNot(ContainSubstring("Trying to pull"))
})
It("podman run container with --pull missing should pull image multiple times", func() {
// Make sure ALPINE image does not exist. Ignore errors
session := podmanTest.PodmanNoCache([]string{"rmi", "--force", "never", ALPINE})
session.WaitWithDefaultTimeout()
session = podmanTest.PodmanNoCache([]string{"run", "--pull", "always", ALPINE, "ls"})
session := podmanTest.Podman([]string{"run", "--pull", "always", cirros, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
session = podmanTest.PodmanNoCache([]string{"run", "--pull", "always", ALPINE, "ls"})
session = podmanTest.Podman([]string{"run", "--pull", "always", cirros, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))

View File

@ -28,7 +28,6 @@ var _ = Describe("Podman save", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
@ -41,7 +40,7 @@ var _ = Describe("Podman save", func() {
It("podman save output flag", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.PodmanNoCache([]string{"save", "-o", outfile, ALPINE})
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
@ -49,7 +48,7 @@ var _ = Describe("Podman save", func() {
It("podman save oci flag", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.PodmanNoCache([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
@ -58,7 +57,7 @@ var _ = Describe("Podman save", func() {
Skip("Pipe redirection in ginkgo probably won't work")
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.PodmanNoCache([]string{"save", ALPINE, ">", outfile})
save := podmanTest.Podman([]string{"save", ALPINE, ">", outfile})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
@ -66,7 +65,7 @@ var _ = Describe("Podman save", func() {
It("podman save quiet flag", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.PodmanNoCache([]string{"save", "-q", "-o", outfile, ALPINE})
save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
@ -74,7 +73,7 @@ var _ = Describe("Podman save", func() {
It("podman save bogus image", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.PodmanNoCache([]string{"save", "-o", outfile, "FOOBAR"})
save := podmanTest.Podman([]string{"save", "-o", outfile, "FOOBAR"})
save.WaitWithDefaultTimeout()
Expect(save).To(ExitWithError())
})
@ -85,7 +84,7 @@ var _ = Describe("Podman save", func() {
}
outdir := filepath.Join(podmanTest.TempDir, "save")
save := podmanTest.PodmanNoCache([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE})
save := podmanTest.Podman([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
@ -96,7 +95,7 @@ var _ = Describe("Podman save", func() {
}
outdir := filepath.Join(podmanTest.TempDir, "save")
save := podmanTest.PodmanNoCache([]string{"save", "--format", "docker-dir", "-o", outdir, ALPINE})
save := podmanTest.Podman([]string{"save", "--format", "docker-dir", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
@ -107,7 +106,7 @@ var _ = Describe("Podman save", func() {
}
outdir := filepath.Join(podmanTest.TempDir, "save")
save := podmanTest.PodmanNoCache([]string{"save", "--compress", "--format", "docker-dir", "-o", outdir, ALPINE})
save := podmanTest.Podman([]string{"save", "--compress", "--format", "docker-dir", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
@ -115,12 +114,13 @@ var _ = Describe("Podman save", func() {
It("podman save bad filename", func() {
outdir := filepath.Join(podmanTest.TempDir, "save:colon")
save := podmanTest.PodmanNoCache([]string{"save", "--compress", "--format", "docker-dir", "-o", outdir, ALPINE})
save := podmanTest.Podman([]string{"save", "--compress", "--format", "docker-dir", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save).To(ExitWithError())
})
It("podman save remove signature", func() {
podmanTest.AddImageToRWStore(ALPINE)
SkipIfRootless("FIXME: Need get in rootless push sign")
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
@ -187,13 +187,13 @@ default-docker:
It("podman save image with digest reference", func() {
// pull a digest reference
session := podmanTest.PodmanNoCache([]string{"pull", ALPINELISTDIGEST})
session := podmanTest.Podman([]string{"pull", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
// save a digest reference should exit without error.
outfile := filepath.Join(podmanTest.TempDir, "temp.tar")
save := podmanTest.PodmanNoCache([]string{"save", "-o", outfile, ALPINELISTDIGEST})
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINELISTDIGEST})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
@ -204,7 +204,7 @@ default-docker:
It("podman save --multi-image-archive (untagged images)", func() {
// Refer to images via ID instead of tag.
session := podmanTest.PodmanNoCache([]string{"images", "--format", "{{.ID}}"})
session := podmanTest.Podman([]string{"images", "--format", "{{.ID}}"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
ids := session.OutputToStringArray()
@ -219,17 +219,17 @@ default-docker:
func multiImageSave(podmanTest *PodmanTestIntegration, images []string) {
// Create the archive.
outfile := filepath.Join(podmanTest.TempDir, "temp.tar")
session := podmanTest.PodmanNoCache(append([]string{"save", "-o", outfile, "--multi-image-archive"}, images...))
session := podmanTest.Podman(append([]string{"save", "-o", outfile, "--multi-image-archive"}, images...))
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
// Remove all images.
session = podmanTest.PodmanNoCache([]string{"rmi", "-af"})
session = podmanTest.Podman([]string{"rmi", "-af"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
// Now load the archive.
session = podmanTest.PodmanNoCache([]string{"load", "-i", outfile})
session = podmanTest.Podman([]string{"load", "-i", outfile})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
// Grep for each image in the `podman load` output.
@ -240,7 +240,7 @@ func multiImageSave(podmanTest *PodmanTestIntegration, images []string) {
// Make sure that each image has really been loaded.
for _, image := range images {
session = podmanTest.PodmanNoCache([]string{"image", "exists", image})
session = podmanTest.Podman([]string{"image", "exists", image})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
}

View File

@ -226,17 +226,17 @@ registries = ['{{.Host}}:{{.Port}}']`
podmanTest.RestoreArtifact(ALPINE)
image := fmt.Sprintf("%s/my-alpine", registryEndpoints[3].Address())
push := podmanTest.PodmanNoCache([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push.WaitWithDefaultTimeout()
Expect(push.ExitCode()).To(Equal(0))
search := podmanTest.PodmanNoCache([]string{"search", image, "--tls-verify=false"})
search := podmanTest.Podman([]string{"search", image, "--tls-verify=false"})
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Equal(0))
Expect(search.OutputToString()).ShouldNot(BeEmpty())
// podman search v2 registry with empty query
searchEmpty := podmanTest.PodmanNoCache([]string{"search", fmt.Sprintf("%s/", registryEndpoints[3].Address()), "--tls-verify=false"})
searchEmpty := podmanTest.Podman([]string{"search", fmt.Sprintf("%s/", registryEndpoints[3].Address()), "--tls-verify=false"})
searchEmpty.WaitWithDefaultTimeout()
Expect(searchEmpty.ExitCode()).To(BeZero())
Expect(len(searchEmpty.OutputToStringArray())).To(BeNumerically(">=", 1))
@ -262,7 +262,7 @@ registries = ['{{.Host}}:{{.Port}}']`
podmanTest.RestoreArtifact(ALPINE)
image := fmt.Sprintf("%s/my-alpine", registryEndpoints[4].Address())
push := podmanTest.PodmanNoCache([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push.WaitWithDefaultTimeout()
Expect(push.ExitCode()).To(Equal(0))
@ -276,7 +276,7 @@ registries = ['{{.Host}}:{{.Port}}']`
defer podmanTest.RestartRemoteService()
}
search := podmanTest.PodmanNoCache([]string{"search", image})
search := podmanTest.Podman([]string{"search", image})
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Equal(0))
@ -306,7 +306,7 @@ registries = ['{{.Host}}:{{.Port}}']`
podmanTest.RestoreArtifact(ALPINE)
image := fmt.Sprintf("%s/my-alpine", registryEndpoints[5].Address())
push := podmanTest.PodmanNoCache([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push.WaitWithDefaultTimeout()
Expect(push.ExitCode()).To(Equal(0))
@ -319,7 +319,7 @@ registries = ['{{.Host}}:{{.Port}}']`
defer podmanTest.RestartRemoteService()
}
search := podmanTest.PodmanNoCache([]string{"search", image, "--tls-verify=true"})
search := podmanTest.Podman([]string{"search", image, "--tls-verify=true"})
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Equal(0))
@ -349,7 +349,7 @@ registries = ['{{.Host}}:{{.Port}}']`
podmanTest.RestoreArtifact(ALPINE)
image := fmt.Sprintf("%s/my-alpine", registryEndpoints[6].Address())
push := podmanTest.PodmanNoCache([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push.WaitWithDefaultTimeout()
Expect(push.ExitCode()).To(Equal(0))
@ -363,7 +363,7 @@ registries = ['{{.Host}}:{{.Port}}']`
defer podmanTest.RestartRemoteService()
}
search := podmanTest.PodmanNoCache([]string{"search", image})
search := podmanTest.Podman([]string{"search", image})
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Equal(0))
@ -403,7 +403,7 @@ registries = ['{{.Host}}:{{.Port}}']`
}
podmanTest.RestoreArtifact(ALPINE)
push := podmanTest.PodmanNoCache([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:6000/my-alpine"})
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:6000/my-alpine"})
push.WaitWithDefaultTimeout()
Expect(push.ExitCode()).To(Equal(0))
@ -418,7 +418,7 @@ registries = ['{{.Host}}:{{.Port}}']`
defer podmanTest.RestartRemoteService()
}
search := podmanTest.PodmanNoCache([]string{"search", "my-alpine"})
search := podmanTest.Podman([]string{"search", "my-alpine"})
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Equal(0))

View File

@ -66,15 +66,16 @@ var _ = Describe("podman system df", func() {
})
It("podman system df image with no tag", func() {
session := podmanTest.PodmanNoCache([]string{"create", ALPINE})
podmanTest.AddImageToRWStore(ALPINE)
session := podmanTest.Podman([]string{"create", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"image", "untag", ALPINE})
session = podmanTest.Podman([]string{"image", "untag", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"system", "df"})
session = podmanTest.Podman([]string{"system", "df"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})

View File

@ -46,10 +46,7 @@ var _ = Describe("podman system reset", func() {
Expect(session.ExitCode()).To(Equal(0))
l := len(session.OutputToStringArray())
session = podmanTest.Podman([]string{"pull", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
podmanTest.AddImageToRWStore(ALPINE)
session = podmanTest.Podman([]string{"volume", "create", "data"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))

View File

@ -22,7 +22,7 @@ var _ = Describe("Podman tag", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
podmanTest.AddImageToRWStore(ALPINE)
})
AfterEach(func() {
@ -33,11 +33,11 @@ var _ = Describe("Podman tag", func() {
})
It("podman tag shortname:latest", func() {
session := podmanTest.PodmanNoCache([]string{"tag", ALPINE, "foobar:latest"})
session := podmanTest.Podman([]string{"tag", ALPINE, "foobar:latest"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
results := podmanTest.PodmanNoCache([]string{"inspect", "foobar:latest"})
results := podmanTest.Podman([]string{"inspect", "foobar:latest"})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
inspectData := results.InspectImageJSON()
@ -46,11 +46,11 @@ var _ = Describe("Podman tag", func() {
})
It("podman tag shortname", func() {
session := podmanTest.PodmanNoCache([]string{"tag", ALPINE, "foobar"})
session := podmanTest.Podman([]string{"tag", ALPINE, "foobar"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
results := podmanTest.PodmanNoCache([]string{"inspect", "foobar:latest"})
results := podmanTest.Podman([]string{"inspect", "foobar:latest"})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
inspectData := results.InspectImageJSON()
@ -59,11 +59,11 @@ var _ = Describe("Podman tag", func() {
})
It("podman tag shortname:tag", func() {
session := podmanTest.PodmanNoCache([]string{"tag", ALPINE, "foobar:new"})
session := podmanTest.Podman([]string{"tag", ALPINE, "foobar:new"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
results := podmanTest.PodmanNoCache([]string{"inspect", "foobar:new"})
results := podmanTest.Podman([]string{"inspect", "foobar:new"})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
inspectData := results.InspectImageJSON()
@ -72,15 +72,15 @@ var _ = Describe("Podman tag", func() {
})
It("podman tag shortname image no tag", func() {
session := podmanTest.PodmanNoCache([]string{"tag", ALPINE, "foobar"})
session := podmanTest.Podman([]string{"tag", ALPINE, "foobar"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
results := podmanTest.PodmanNoCache([]string{"tag", "foobar", "barfoo"})
results := podmanTest.Podman([]string{"tag", "foobar", "barfoo"})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
verify := podmanTest.PodmanNoCache([]string{"inspect", "barfoo"})
verify := podmanTest.Podman([]string{"inspect", "barfoo"})
verify.WaitWithDefaultTimeout()
Expect(verify.ExitCode()).To(Equal(0))
})

View File

@ -214,7 +214,7 @@ var _ = Describe("Toolbox-specific testing", func() {
useradd := fmt.Sprintf("useradd --home-dir %s --shell %s --uid %s %s",
homeDir, shell, uid, username)
passwd := fmt.Sprintf("passwd --delete %s", username)
podmanTest.AddImageToRWStore(fedoraToolbox)
session = podmanTest.Podman([]string{"create", "--name", "test", "--userns=keep-id", "--user", "root:root", fedoraToolbox, "sh", "-c",
fmt.Sprintf("%s; %s; echo READY; sleep 1000", useradd, passwd)})
session.WaitWithDefaultTimeout()
@ -250,6 +250,7 @@ var _ = Describe("Toolbox-specific testing", func() {
groupadd := fmt.Sprintf("groupadd --gid %s %s", gid, groupName)
podmanTest.AddImageToRWStore(fedoraToolbox)
session = podmanTest.Podman([]string{"create", "--name", "test", "--userns=keep-id", "--user", "root:root", fedoraToolbox, "sh", "-c",
fmt.Sprintf("%s; echo READY; sleep 1000", groupadd)})
session.WaitWithDefaultTimeout()
@ -294,6 +295,7 @@ var _ = Describe("Toolbox-specific testing", func() {
usermod := fmt.Sprintf("usermod --append --groups wheel --home %s --shell %s --uid %s --gid %s %s",
homeDir, shell, uid, gid, username)
podmanTest.AddImageToRWStore(fedoraToolbox)
session = podmanTest.Podman([]string{"create", "--name", "test", "--userns=keep-id", "--user", "root:root", fedoraToolbox, "sh", "-c",
fmt.Sprintf("%s; %s; %s; echo READY; sleep 1000", useradd, groupadd, usermod)})
session.WaitWithDefaultTimeout()
@ -338,6 +340,7 @@ var _ = Describe("Toolbox-specific testing", func() {
// These should be most of the switches that Toolbox uses to create a "toolbox" container
// https://github.com/containers/toolbox/blob/master/src/cmd/create.go
podmanTest.AddImageToRWStore(fedoraToolbox)
session = podmanTest.Podman([]string{"create",
"--dns", "none",
"--hostname", "toolbox",
@ -374,6 +377,7 @@ var _ = Describe("Toolbox-specific testing", func() {
currentUser, err := user.Current()
Expect(err).To(BeNil())
podmanTest.AddImageToRWStore(fedoraToolbox)
session = podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:%s", currentUser.HomeDir, currentUser.HomeDir), "--userns=keep-id", fedoraToolbox, "sh", "-c", "echo $HOME"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))

View File

@ -23,7 +23,7 @@ var _ = Describe("Podman image tree", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
podmanTest.RestoreArtifact(BB)
podmanTest.AddImageToRWStore(BB)
})
AfterEach(func() {
@ -35,24 +35,26 @@ var _ = Describe("Podman image tree", func() {
It("podman image tree", func() {
SkipIfRemote("Does not work on remote client")
dockerfile := `FROM quay.io/libpod/busybox:latest
Skip("dont understand why this fails")
podmanTest.AddImageToRWStore(cirros)
dockerfile := `FROM quay.io/libpod/cirros:latest
RUN mkdir hello
RUN touch test.txt
ENV foo=bar
`
podmanTest.BuildImage(dockerfile, "test:latest", "true")
session := podmanTest.PodmanNoCache([]string{"image", "tree", "test:latest"})
session := podmanTest.Podman([]string{"image", "tree", "test:latest"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"image", "tree", "--whatrequires", "quay.io/libpod/busybox:latest"})
session = podmanTest.Podman([]string{"image", "tree", "--whatrequires", "quay.io/libpod/cirros:latest"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "test:latest"})
session = podmanTest.Podman([]string{"rmi", "test:latest"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"rmi", "quay.io/libpod/busybox:latest"})
session = podmanTest.Podman([]string{"rmi", "quay.io/libpod/cirros:latest"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})

View File

@ -22,7 +22,6 @@ var _ = Describe("Podman untag", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
@ -33,42 +32,37 @@ var _ = Describe("Podman untag", func() {
})
It("podman untag all", func() {
setup := podmanTest.PodmanNoCache([]string{"pull", ALPINE})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
tags := []string{ALPINE, "registry.com/foo:bar", "localhost/foo:bar"}
podmanTest.AddImageToRWStore(cirros)
tags := []string{cirros, "registry.com/foo:bar", "localhost/foo:bar"}
cmd := []string{"tag"}
cmd = append(cmd, tags...)
session := podmanTest.PodmanNoCache(cmd)
session := podmanTest.Podman(cmd)
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
// Make sure that all tags exists.
for _, t := range tags {
session = podmanTest.PodmanNoCache([]string{"image", "exists", t})
session = podmanTest.Podman([]string{"image", "exists", t})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
}
// No arguments -> remove all tags.
session = podmanTest.PodmanNoCache([]string{"untag", ALPINE})
session = podmanTest.Podman([]string{"untag", cirros})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
// Make sure that none of tags exists anymore.
for _, t := range tags {
session = podmanTest.PodmanNoCache([]string{"image", "exists", t})
session = podmanTest.Podman([]string{"image", "exists", t})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(1))
}
})
It("podman tag/untag - tag normalization", func() {
setup := podmanTest.PodmanNoCache([]string{"pull", ALPINE})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
podmanTest.AddImageToRWStore(cirros)
tests := []struct {
tag, normalized string
@ -82,19 +76,19 @@ var _ = Describe("Podman untag", func() {
// Make sure that the user input is normalized correctly for
// `podman tag` and `podman untag`.
for _, tt := range tests {
session := podmanTest.PodmanNoCache([]string{"tag", ALPINE, tt.tag})
session := podmanTest.Podman([]string{"tag", cirros, tt.tag})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"image", "exists", tt.normalized})
session = podmanTest.Podman([]string{"image", "exists", tt.normalized})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"untag", ALPINE, tt.tag})
session = podmanTest.Podman([]string{"untag", cirros, tt.tag})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"image", "exists", tt.normalized})
session = podmanTest.Podman([]string{"image", "exists", tt.normalized})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(1))
}