mirror of
https://github.com/containers/podman.git
synced 2025-06-20 00:51:16 +08:00
Test fixes for remote integration
Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
@ -6,6 +6,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/containers/libpod/libpod/define"
|
||||||
|
|
||||||
"github.com/containers/common/pkg/config"
|
"github.com/containers/common/pkg/config"
|
||||||
"github.com/containers/libpod/cmd/podman/common"
|
"github.com/containers/libpod/cmd/podman/common"
|
||||||
"github.com/containers/libpod/cmd/podman/registry"
|
"github.com/containers/libpod/cmd/podman/registry"
|
||||||
@ -203,7 +205,7 @@ func pullImage(imageName string) error {
|
|||||||
}
|
}
|
||||||
if !br.Value || pullPolicy == config.PullImageAlways {
|
if !br.Value || pullPolicy == config.PullImageAlways {
|
||||||
if pullPolicy == config.PullImageNever {
|
if pullPolicy == config.PullImageNever {
|
||||||
return errors.New("unable to find a name and tag match for busybox in repotags: no such image")
|
return errors.Wrapf(define.ErrNoSuchImage, "unable to find a name and tag match for %s in repotags", imageName)
|
||||||
}
|
}
|
||||||
_, pullErr := registry.ImageEngine().Pull(registry.GetContext(), imageName, entities.ImagePullOptions{
|
_, pullErr := registry.ImageEngine().Pull(registry.GetContext(), imageName, entities.ImagePullOptions{
|
||||||
Authfile: cliVals.Authfile,
|
Authfile: cliVals.Authfile,
|
||||||
|
@ -128,5 +128,7 @@ func setExitCode(err error) {
|
|||||||
registry.SetExitCode(1)
|
registry.SetExitCode(1)
|
||||||
case cause == define.ErrCtrStateInvalid:
|
case cause == define.ErrCtrStateInvalid:
|
||||||
registry.SetExitCode(2)
|
registry.SetExitCode(2)
|
||||||
|
case strings.Contains(cause.Error(), define.ErrCtrStateInvalid.Error()):
|
||||||
|
registry.SetExitCode(2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ func Export(ctx context.Context, nameOrID string, w io.Writer, format *string, c
|
|||||||
_, err = io.Copy(w, response.Body)
|
_, err = io.Copy(w, response.Body)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return response.Process(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prune removes unused images from local storage. The optional filters can be used to further
|
// Prune removes unused images from local storage. The optional filters can be used to further
|
||||||
|
@ -190,7 +190,6 @@ func (ir *ImageEngine) Save(ctx context.Context, nameOrId string, tags []string,
|
|||||||
f *os.File
|
f *os.File
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
switch options.Format {
|
switch options.Format {
|
||||||
case "oci-dir", "docker-dir":
|
case "oci-dir", "docker-dir":
|
||||||
f, err = ioutil.TempFile("", "podman_save")
|
f, err = ioutil.TempFile("", "podman_save")
|
||||||
|
@ -57,46 +57,21 @@ func (ir *ImageEngine) ManifestAdd(ctx context.Context, opts entities.ManifestAd
|
|||||||
}
|
}
|
||||||
manifestAddOpts.Annotation = annotations
|
manifestAddOpts.Annotation = annotations
|
||||||
}
|
}
|
||||||
listID, err := manifests.Add(ctx, opts.Images[1], manifestAddOpts)
|
listID, err := manifests.Add(ir.ClientCxt, opts.Images[1], manifestAddOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return listID, errors.Wrapf(err, "error adding to manifest list %s", opts.Images[1])
|
return listID, errors.Wrapf(err, "error adding to manifest list %s", opts.Images[1])
|
||||||
}
|
}
|
||||||
return listID, nil
|
return listID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME There is no endpoint for annotate and therefor this code is currently invalid
|
|
||||||
// ManifestAnnotate updates an entry of the manifest list
|
// ManifestAnnotate updates an entry of the manifest list
|
||||||
func (ir *ImageEngine) ManifestAnnotate(ctx context.Context, names []string, opts entities.ManifestAnnotateOptions) (string, error) {
|
func (ir *ImageEngine) ManifestAnnotate(ctx context.Context, names []string, opts entities.ManifestAnnotateOptions) (string, error) {
|
||||||
return "", errors.New("not implemented")
|
return "", errors.New("not implemented")
|
||||||
// manifestAnnotateOpts := image.ManifestAnnotateOpts{
|
|
||||||
// Arch: opts.Arch,
|
|
||||||
// Features: opts.Features,
|
|
||||||
// OS: opts.OS,
|
|
||||||
// OSFeatures: opts.OSFeatures,
|
|
||||||
// OSVersion: opts.OSVersion,
|
|
||||||
// Variant: opts.Variant,
|
|
||||||
// }
|
|
||||||
// if len(opts.Annotation) > 0 {
|
|
||||||
// annotations := make(map[string]string)
|
|
||||||
// for _, annotationSpec := range opts.Annotation {
|
|
||||||
// spec := strings.SplitN(annotationSpec, "=", 2)
|
|
||||||
// if len(spec) != 2 {
|
|
||||||
// return "", errors.Errorf("no value given for annotation %q", spec[0])
|
|
||||||
// }
|
|
||||||
// annotations[spec[0]] = spec[1]
|
|
||||||
// }
|
|
||||||
// manifestAnnotateOpts.Annotation = annotations
|
|
||||||
// }
|
|
||||||
// updatedListID, err := manifests.Annotate(ctx, names[0], names[1], manifestAnnotateOpts)
|
|
||||||
// if err != nil {
|
|
||||||
// return updatedListID, errors.Wrapf(err, "error annotating %s of manifest list %s", names[1], names[0])
|
|
||||||
// }
|
|
||||||
// return fmt.Sprintf("%s :%s", updatedListID, names[1]), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ManifestRemove removes the digest from manifest list
|
// ManifestRemove removes the digest from manifest list
|
||||||
func (ir *ImageEngine) ManifestRemove(ctx context.Context, names []string) (string, error) {
|
func (ir *ImageEngine) ManifestRemove(ctx context.Context, names []string) (string, error) {
|
||||||
updatedListID, err := manifests.Remove(ctx, names[0], names[1])
|
updatedListID, err := manifests.Remove(ir.ClientCxt, names[0], names[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return updatedListID, errors.Wrapf(err, "error removing from manifest %s", names[0])
|
return updatedListID, errors.Wrapf(err, "error removing from manifest %s", names[0])
|
||||||
}
|
}
|
||||||
@ -105,6 +80,6 @@ func (ir *ImageEngine) ManifestRemove(ctx context.Context, names []string) (stri
|
|||||||
|
|
||||||
// ManifestPush pushes a manifest list or image index to the destination
|
// ManifestPush pushes a manifest list or image index to the destination
|
||||||
func (ir *ImageEngine) ManifestPush(ctx context.Context, names []string, opts entities.ManifestPushOptions) error {
|
func (ir *ImageEngine) ManifestPush(ctx context.Context, names []string, opts entities.ManifestPushOptions) error {
|
||||||
_, err := manifests.Push(ctx, names[0], &names[1], &opts.All)
|
_, err := manifests.Push(ir.ClientCxt, names[0], &names[1], &opts.All)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ var (
|
|||||||
INTEGRATION_ROOT string
|
INTEGRATION_ROOT string
|
||||||
CGROUP_MANAGER = "systemd"
|
CGROUP_MANAGER = "systemd"
|
||||||
ARTIFACT_DIR = "/tmp/.artifacts"
|
ARTIFACT_DIR = "/tmp/.artifacts"
|
||||||
RESTORE_IMAGES = []string{ALPINE, BB}
|
RESTORE_IMAGES = []string{ALPINE, BB, nginx}
|
||||||
defaultWaitTimeout = 90
|
defaultWaitTimeout = 90
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -239,11 +239,11 @@ var _ = Describe("Podman create", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman create --pull", func() {
|
It("podman create --pull", func() {
|
||||||
session := podmanTest.PodmanNoCache([]string{"create", "--pull", "never", "--name=foo", "nginx"})
|
session := podmanTest.PodmanNoCache([]string{"create", "--pull", "never", "--name=foo", "debian"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(ExitWithError())
|
Expect(session).To(ExitWithError())
|
||||||
|
|
||||||
session = podmanTest.PodmanNoCache([]string{"create", "--pull", "always", "--name=foo", "nginx"})
|
session = podmanTest.PodmanNoCache([]string{"create", "--pull", "always", "--name=foo", "debian"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
})
|
})
|
||||||
|
@ -90,7 +90,7 @@ var _ = Describe("Podman images", func() {
|
|||||||
session = podmanTest.PodmanNoCache([]string{"images", "-qn"})
|
session = podmanTest.PodmanNoCache([]string{"images", "-qn"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 2))
|
Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 3))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman images with digests", func() {
|
It("podman images with digests", func() {
|
||||||
@ -164,13 +164,13 @@ var _ = Describe("Podman images", func() {
|
|||||||
retapline := podmanTest.PodmanNoCache([]string{"images", "-f", "reference=a*pine"})
|
retapline := podmanTest.PodmanNoCache([]string{"images", "-f", "reference=a*pine"})
|
||||||
retapline.WaitWithDefaultTimeout()
|
retapline.WaitWithDefaultTimeout()
|
||||||
Expect(retapline).Should(Exit(0))
|
Expect(retapline).Should(Exit(0))
|
||||||
Expect(len(retapline.OutputToStringArray())).To(Equal(2))
|
Expect(len(retapline.OutputToStringArray())).To(Equal(3))
|
||||||
Expect(retapline.LineInOutputContains("alpine")).To(BeTrue())
|
Expect(retapline.LineInOutputContains("alpine")).To(BeTrue())
|
||||||
|
|
||||||
retapline = podmanTest.PodmanNoCache([]string{"images", "-f", "reference=alpine"})
|
retapline = podmanTest.PodmanNoCache([]string{"images", "-f", "reference=alpine"})
|
||||||
retapline.WaitWithDefaultTimeout()
|
retapline.WaitWithDefaultTimeout()
|
||||||
Expect(retapline).Should(Exit(0))
|
Expect(retapline).Should(Exit(0))
|
||||||
Expect(len(retapline.OutputToStringArray())).To(Equal(2))
|
Expect(len(retapline.OutputToStringArray())).To(Equal(3))
|
||||||
Expect(retapline.LineInOutputContains("alpine")).To(BeTrue())
|
Expect(retapline.LineInOutputContains("alpine")).To(BeTrue())
|
||||||
|
|
||||||
retnone := podmanTest.PodmanNoCache([]string{"images", "-q", "-f", "reference=bogus"})
|
retnone := podmanTest.PodmanNoCache([]string{"images", "-q", "-f", "reference=bogus"})
|
||||||
@ -321,12 +321,12 @@ ENV foo=bar
|
|||||||
session := podmanTest.PodmanNoCache([]string{"images"})
|
session := podmanTest.PodmanNoCache([]string{"images"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(len(session.OutputToStringArray())).To(Equal(4))
|
Expect(len(session.OutputToStringArray())).To(Equal(5))
|
||||||
|
|
||||||
session2 := podmanTest.PodmanNoCache([]string{"images", "--all"})
|
session2 := podmanTest.PodmanNoCache([]string{"images", "--all"})
|
||||||
session2.WaitWithDefaultTimeout()
|
session2.WaitWithDefaultTimeout()
|
||||||
Expect(session2).Should(Exit(0))
|
Expect(session2).Should(Exit(0))
|
||||||
Expect(len(session2.OutputToStringArray())).To(Equal(6))
|
Expect(len(session2.OutputToStringArray())).To(Equal(7))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman images filter by label", func() {
|
It("podman images filter by label", func() {
|
||||||
|
@ -100,7 +100,7 @@ var _ = Describe("Podman kill", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman kill latest container", func() {
|
It("podman kill latest container", func() {
|
||||||
Skip(v2remotefail)
|
SkipIfRemote()
|
||||||
session := podmanTest.RunTopContainer("")
|
session := podmanTest.RunTopContainer("")
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
@ -28,7 +28,6 @@ var _ = Describe("Podman manifest", func() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
Skip(v2remotefail)
|
|
||||||
tempdir, err = CreateTempDirInTempDir()
|
tempdir, err = CreateTempDirInTempDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
@ -103,6 +102,7 @@ var _ = Describe("Podman manifest", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman manifest annotate", func() {
|
It("podman manifest annotate", func() {
|
||||||
|
SkipIfRemote()
|
||||||
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
|
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
@ -155,6 +155,7 @@ var _ = Describe("Podman manifest", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman manifest push", func() {
|
It("podman manifest push", func() {
|
||||||
|
Skip(v2remotefail)
|
||||||
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
|
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
@ -184,6 +185,7 @@ var _ = Describe("Podman manifest", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman manifest push purge", func() {
|
It("podman manifest push purge", func() {
|
||||||
|
Skip(v2remotefail)
|
||||||
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
|
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
@ -132,7 +132,6 @@ var _ = Describe("Podman pause", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman remove a paused container by id without force", func() {
|
It("podman remove a paused container by id without force", func() {
|
||||||
Skip(v2remotefail)
|
|
||||||
session := podmanTest.RunTopContainer("")
|
session := podmanTest.RunTopContainer("")
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
@ -175,7 +174,6 @@ var _ = Describe("Podman pause", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman stop a paused container by id", func() {
|
It("podman stop a paused container by id", func() {
|
||||||
Skip(v2remotefail)
|
|
||||||
session := podmanTest.RunTopContainer("")
|
session := podmanTest.RunTopContainer("")
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
@ -272,7 +270,6 @@ var _ = Describe("Podman pause", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("Pause a bunch of running containers", func() {
|
It("Pause a bunch of running containers", func() {
|
||||||
Skip(v2remotefail)
|
|
||||||
for i := 0; i < 3; i++ {
|
for i := 0; i < 3; i++ {
|
||||||
name := fmt.Sprintf("test%d", i)
|
name := fmt.Sprintf("test%d", i)
|
||||||
run := podmanTest.Podman([]string{"run", "-dt", "--name", name, nginx})
|
run := podmanTest.Podman([]string{"run", "-dt", "--name", name, nginx})
|
||||||
|
@ -68,7 +68,6 @@ var _ = Describe("Podman save", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman save bogus image", func() {
|
It("podman save bogus image", func() {
|
||||||
Skip(v2remotefail)
|
|
||||||
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
|
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
|
||||||
|
|
||||||
save := podmanTest.PodmanNoCache([]string{"save", "-o", outfile, "FOOBAR"})
|
save := podmanTest.PodmanNoCache([]string{"save", "-o", outfile, "FOOBAR"})
|
||||||
|
@ -198,7 +198,6 @@ var _ = Describe("Podman stop", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman stop all containers with one stopped", func() {
|
It("podman stop all containers with one stopped", func() {
|
||||||
Skip(v2remotefail)
|
|
||||||
session := podmanTest.RunTopContainer("test1")
|
session := podmanTest.RunTopContainer("test1")
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
@ -59,7 +59,7 @@ var _ = Describe("Podman untag", func() {
|
|||||||
results := podmanTest.PodmanNoCache([]string{"images"})
|
results := podmanTest.PodmanNoCache([]string{"images"})
|
||||||
results.WaitWithDefaultTimeout()
|
results.WaitWithDefaultTimeout()
|
||||||
Expect(results.ExitCode()).To(Equal(0))
|
Expect(results.ExitCode()).To(Equal(0))
|
||||||
Expect(results.OutputToStringArray()).To(HaveLen(5))
|
Expect(results.OutputToStringArray()).To(HaveLen(6))
|
||||||
Expect(results.LineInOuputStartsWith("docker.io/library/alpine")).To(BeTrue())
|
Expect(results.LineInOuputStartsWith("docker.io/library/alpine")).To(BeTrue())
|
||||||
Expect(results.LineInOuputStartsWith("localhost/foo")).To(BeTrue())
|
Expect(results.LineInOuputStartsWith("localhost/foo")).To(BeTrue())
|
||||||
Expect(results.LineInOuputStartsWith("localhost/bar")).To(BeTrue())
|
Expect(results.LineInOuputStartsWith("localhost/bar")).To(BeTrue())
|
||||||
|
Reference in New Issue
Block a user