github.com/akerouanton/docker@v1.11.0-rc3/integration-cli/docker_cli_update_test.go (about)

     1  package main
     2  
     3  import (
     4  	"strings"
     5  	"time"
     6  
     7  	"github.com/docker/docker/pkg/integration/checker"
     8  	"github.com/go-check/check"
     9  )
    10  
    11  func (s *DockerSuite) TestUpdateRestartPolicy(c *check.C) {
    12  	out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "sh", "-c", "sleep 1 && false")
    13  	timeout := 60 * time.Second
    14  	if daemonPlatform == "windows" {
    15  		timeout = 180 * time.Second
    16  	}
    17  
    18  	id := strings.TrimSpace(string(out))
    19  
    20  	// update restart policy to on-failure:5
    21  	dockerCmd(c, "update", "--restart=on-failure:5", id)
    22  
    23  	err := waitExited(id, timeout)
    24  	c.Assert(err, checker.IsNil)
    25  
    26  	count := inspectField(c, id, "RestartCount")
    27  	c.Assert(count, checker.Equals, "5")
    28  
    29  	maximumRetryCount := inspectField(c, id, "HostConfig.RestartPolicy.MaximumRetryCount")
    30  	c.Assert(maximumRetryCount, checker.Equals, "5")
    31  }