Merge pull request #6307 from baude/v2remoteinit

enable remote integration tests for init
This commit is contained in:
OpenShift Merge Robot
2020-05-21 15:57:23 +02:00
committed by GitHub
2 changed files with 8 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"io" "io"
"os" "os"
"strings"
"github.com/containers/common/pkg/config" "github.com/containers/common/pkg/config"
"github.com/containers/image/v5/docker/reference" "github.com/containers/image/v5/docker/reference"
@ -405,6 +406,11 @@ func (ic *ContainerEngine) ContainerInit(ctx context.Context, namesOrIds []strin
} }
for _, ctr := range ctrs { for _, ctr := range ctrs {
err := containers.ContainerInit(ic.ClientCxt, ctr.ID) err := containers.ContainerInit(ic.ClientCxt, ctr.ID)
// When using all, it is NOT considered an error if a container
// has already been init'd.
if err != nil && options.All && strings.Contains(errors.Cause(err).Error(), define.ErrCtrStateInvalid.Error()) {
err = nil
}
reports = append(reports, &entities.ContainerInitReport{ reports = append(reports, &entities.ContainerInitReport{
Err: err, Err: err,
Id: ctr.ID, Id: ctr.ID,

View File

@ -90,7 +90,6 @@ var _ = Describe("Podman init", func() {
}) })
It("podman init all three containers, one running", func() { It("podman init all three containers, one running", func() {
Skip(v2remotefail)
session := podmanTest.Podman([]string{"create", "--name", "test1", "-d", ALPINE, "ls"}) session := podmanTest.Podman([]string{"create", "--name", "test1", "-d", ALPINE, "ls"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0)) Expect(session.ExitCode()).To(Equal(0))
@ -121,11 +120,10 @@ var _ = Describe("Podman init", func() {
}) })
It("podman init running container errors", func() { It("podman init running container errors", func() {
Skip(v2remotefail) session := podmanTest.Podman([]string{"run", "--name", "init_test", "-d", ALPINE, "top"})
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "top"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0)) Expect(session.ExitCode()).To(Equal(0))
init := podmanTest.Podman([]string{"init", "--latest"}) init := podmanTest.Podman([]string{"init", "init_test"})
init.WaitWithDefaultTimeout() init.WaitWithDefaultTimeout()
Expect(init.ExitCode()).To(Equal(125)) Expect(init.ExitCode()).To(Equal(125))
}) })