summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-04-25 13:51:33 -0500
committerBrent Baude <bbaude@redhat.com>2020-04-27 09:08:27 -0500
commita7b3310db567309e8c21c4c49a37de9d18646a4c (patch)
tree73809829c0c27b609a1bdce71b99ade0b7c09cca
parent2afe579c064923841a55d57458fac4d91bec8173 (diff)
downloadpodman-a7b3310db567309e8c21c4c49a37de9d18646a4c.tar.gz
podman-a7b3310db567309e8c21c4c49a37de9d18646a4c.tar.bz2
podman-a7b3310db567309e8c21c4c49a37de9d18646a4c.zip
enable integration tests for restart
enable integrations tests for container restart. fixed bug where --running was not being honored. Signed-off-by: Brent Baude <bbaude@redhat.com>
-rw-r--r--pkg/domain/infra/abi/containers.go17
-rw-r--r--pkg/domain/infra/tunnel/containers.go4
-rw-r--r--test/e2e/restart_test.go1
3 files changed, 18 insertions, 4 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 9844d1d96..e09891760 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -217,12 +217,23 @@ func (ic *ContainerEngine) ContainerKill(ctx context.Context, namesOrIds []strin
}
func (ic *ContainerEngine) ContainerRestart(ctx context.Context, namesOrIds []string, options entities.RestartOptions) ([]*entities.RestartReport, error) {
var (
+ ctrs []*libpod.Container
+ err error
reports []*entities.RestartReport
)
- ctrs, err := getContainersByContext(options.All, options.Latest, namesOrIds, ic.Libpod)
- if err != nil {
- return nil, err
+
+ if options.Running {
+ ctrs, err = ic.Libpod.GetRunningContainers()
+ if err != nil {
+ return nil, err
+ }
+ } else {
+ ctrs, err = getContainersByContext(options.All, options.Latest, namesOrIds, ic.Libpod)
+ if err != nil {
+ return nil, err
+ }
}
+
for _, con := range ctrs {
timeout := con.StopTimeout()
if options.Timeout != nil {
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go
index 18d6613f4..32f9c4e36 100644
--- a/pkg/domain/infra/tunnel/containers.go
+++ b/pkg/domain/infra/tunnel/containers.go
@@ -115,11 +115,15 @@ func (ic *ContainerEngine) ContainerRestart(ctx context.Context, namesOrIds []st
t := int(*options.Timeout)
timeout = &t
}
+
ctrs, err := getContainersByContext(ic.ClientCxt, options.All, namesOrIds)
if err != nil {
return nil, err
}
for _, c := range ctrs {
+ if options.Running && c.State != define.ContainerStateRunning.String() {
+ continue
+ }
reports = append(reports, &entities.RestartReport{
Id: c.ID,
Err: containers.Restart(ic.ClientCxt, c.ID, timeout),
diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go
index 9bbeb4f68..2b515f53b 100644
--- a/test/e2e/restart_test.go
+++ b/test/e2e/restart_test.go
@@ -17,7 +17,6 @@ var _ = Describe("Podman restart", func() {
)
BeforeEach(func() {
- Skip(v2fail)
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)