mirror of https://github.com/docker/docs.git
integration-cli: remove not necessary -d again
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
38439733d2
commit
e44689139d
|
@ -230,7 +230,7 @@ func (s *DockerSuite) TestContainerApiStartVolumesFrom(c *check.C) {
|
||||||
volName := "voltst"
|
volName := "voltst"
|
||||||
volPath := "/tmp"
|
volPath := "/tmp"
|
||||||
|
|
||||||
dockerCmd(c, "run", "-d", "--name", volName, "-v", volPath, "busybox")
|
dockerCmd(c, "run", "--name", volName, "-v", volPath, "busybox")
|
||||||
|
|
||||||
name := "TestContainerApiStartVolumesFrom"
|
name := "TestContainerApiStartVolumesFrom"
|
||||||
config := map[string]interface{}{
|
config := map[string]interface{}{
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
func (s *DockerSuite) TestVolumesApiList(c *check.C) {
|
func (s *DockerSuite) TestVolumesApiList(c *check.C) {
|
||||||
prefix, _ := getPrefixAndSlashFromDaemonPlatform()
|
prefix, _ := getPrefixAndSlashFromDaemonPlatform()
|
||||||
dockerCmd(c, "run", "-d", "-v", prefix+"/foo", "busybox")
|
dockerCmd(c, "run", "-v", prefix+"/foo", "busybox")
|
||||||
|
|
||||||
status, b, err := sockRequest("GET", "/volumes", nil)
|
status, b, err := sockRequest("GET", "/volumes", nil)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
|
@ -31,7 +31,7 @@ func setupImage(c *check.C) (digest.Digest, error) {
|
||||||
func setupImageWithTag(c *check.C, tag string) (digest.Digest, error) {
|
func setupImageWithTag(c *check.C, tag string) (digest.Digest, error) {
|
||||||
containerName := "busyboxbydigest"
|
containerName := "busyboxbydigest"
|
||||||
|
|
||||||
dockerCmd(c, "run", "-d", "-e", "digest=1", "--name", containerName, "busybox")
|
dockerCmd(c, "run", "-e", "digest=1", "--name", containerName, "busybox")
|
||||||
|
|
||||||
// tag the image to upload it to the private registry
|
// tag the image to upload it to the private registry
|
||||||
repoAndTag := repoName + ":" + tag
|
repoAndTag := repoName + ":" + tag
|
||||||
|
@ -354,17 +354,19 @@ func (s *DockerRegistrySuite) TestPsListContainersFilterAncestorImageByDigest(c
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
// run a container based on that
|
// run a container based on that
|
||||||
out, _ := dockerCmd(c, "run", "-d", imageReference, "echo", "hello")
|
dockerCmd(c, "run", "--name=test1", imageReference, "echo", "hello")
|
||||||
expectedID := strings.TrimSpace(out)
|
expectedID, err := getIDByName("test1")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
// run a container based on the a descendant of that too
|
// run a container based on the a descendant of that too
|
||||||
out, _ = dockerCmd(c, "run", "-d", imageName1, "echo", "hello")
|
dockerCmd(c, "run", "--name=test2", imageName1, "echo", "hello")
|
||||||
expectedID1 := strings.TrimSpace(out)
|
expectedID1, err := getIDByName("test2")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
expectedIDs := []string{expectedID, expectedID1}
|
expectedIDs := []string{expectedID, expectedID1}
|
||||||
|
|
||||||
// Invalid imageReference
|
// Invalid imageReference
|
||||||
out, _ = dockerCmd(c, "ps", "-a", "-q", "--no-trunc", fmt.Sprintf("--filter=ancestor=busybox@%s", digest))
|
out, _ := dockerCmd(c, "ps", "-a", "-q", "--no-trunc", fmt.Sprintf("--filter=ancestor=busybox@%s", digest))
|
||||||
// Filter container for ancestor filter should be empty
|
// Filter container for ancestor filter should be empty
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, "")
|
c.Assert(strings.TrimSpace(out), checker.Equals, "")
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithVolumesRefs(c *check.C) {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if out, err := s.d.Cmd("run", "-d", "--name", "volrestarttest1", "-v", "/foo", "busybox"); err != nil {
|
if out, err := s.d.Cmd("run", "--name", "volrestarttest1", "-v", "/foo", "busybox"); err != nil {
|
||||||
c.Fatal(err, out)
|
c.Fatal(err, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,15 +1156,11 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverDefault(c *check.C) {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "-d", "busybox", "echo", "testline")
|
out, err := s.d.Cmd("run", "--name=test", "busybox", "echo", "testline")
|
||||||
if err != nil {
|
c.Assert(err, check.IsNil, check.Commentf(out))
|
||||||
c.Fatal(out, err)
|
id, err := s.d.getIDByName("test")
|
||||||
}
|
c.Assert(err, check.IsNil)
|
||||||
id := strings.TrimSpace(out)
|
|
||||||
|
|
||||||
if out, err := s.d.Cmd("wait", id); err != nil {
|
|
||||||
c.Fatal(out, err)
|
|
||||||
}
|
|
||||||
logPath := filepath.Join(s.d.root, "containers", id, id+"-json.log")
|
logPath := filepath.Join(s.d.root, "containers", id, id+"-json.log")
|
||||||
|
|
||||||
if _, err := os.Stat(logPath); err != nil {
|
if _, err := os.Stat(logPath); err != nil {
|
||||||
|
@ -1198,15 +1194,13 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverDefaultOverride(c *check.C) {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "-d", "--log-driver=none", "busybox", "echo", "testline")
|
out, err := s.d.Cmd("run", "--name=test", "--log-driver=none", "busybox", "echo", "testline")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Fatal(out, err)
|
c.Fatal(out, err)
|
||||||
}
|
}
|
||||||
id := strings.TrimSpace(out)
|
id, err := s.d.getIDByName("test")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
if out, err := s.d.Cmd("wait", id); err != nil {
|
|
||||||
c.Fatal(out, err)
|
|
||||||
}
|
|
||||||
logPath := filepath.Join(s.d.root, "containers", id, id+"-json.log")
|
logPath := filepath.Join(s.d.root, "containers", id, id+"-json.log")
|
||||||
|
|
||||||
if _, err := os.Stat(logPath); err == nil || !os.IsNotExist(err) {
|
if _, err := os.Stat(logPath); err == nil || !os.IsNotExist(err) {
|
||||||
|
@ -1219,14 +1213,12 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverNone(c *check.C) {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "-d", "busybox", "echo", "testline")
|
out, err := s.d.Cmd("run", "--name=test", "busybox", "echo", "testline")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Fatal(out, err)
|
c.Fatal(out, err)
|
||||||
}
|
}
|
||||||
id := strings.TrimSpace(out)
|
id, err := s.d.getIDByName("test")
|
||||||
if out, err := s.d.Cmd("wait", id); err != nil {
|
c.Assert(err, check.IsNil)
|
||||||
c.Fatal(out, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
logPath := filepath.Join(s.d.folder, "graph", "containers", id, id+"-json.log")
|
logPath := filepath.Join(s.d.folder, "graph", "containers", id, id+"-json.log")
|
||||||
|
|
||||||
|
@ -1240,15 +1232,13 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneOverride(c *check.C) {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "-d", "--log-driver=json-file", "busybox", "echo", "testline")
|
out, err := s.d.Cmd("run", "--name=test", "--log-driver=json-file", "busybox", "echo", "testline")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Fatal(out, err)
|
c.Fatal(out, err)
|
||||||
}
|
}
|
||||||
id := strings.TrimSpace(out)
|
id, err := s.d.getIDByName("test")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
if out, err := s.d.Cmd("wait", id); err != nil {
|
|
||||||
c.Fatal(out, err)
|
|
||||||
}
|
|
||||||
logPath := filepath.Join(s.d.root, "containers", id, id+"-json.log")
|
logPath := filepath.Join(s.d.root, "containers", id, id+"-json.log")
|
||||||
|
|
||||||
if _, err := os.Stat(logPath); err != nil {
|
if _, err := os.Stat(logPath); err != nil {
|
||||||
|
@ -1568,7 +1558,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithSocketAsVolume(c *check.C) {
|
||||||
|
|
||||||
socket := filepath.Join(s.d.folder, "docker.sock")
|
socket := filepath.Join(s.d.folder, "docker.sock")
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "-d", "--restart=always", "-v", socket+":/sock", "busybox")
|
out, err := s.d.Cmd("run", "--restart=always", "-v", socket+":/sock", "busybox")
|
||||||
c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
|
c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
|
||||||
c.Assert(s.d.Restart(), check.IsNil)
|
c.Assert(s.d.Restart(), check.IsNil)
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,10 +138,9 @@ func (s *DockerSuite) TestLogsTail(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestLogsFollowStopped(c *check.C) {
|
func (s *DockerSuite) TestLogsFollowStopped(c *check.C) {
|
||||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
|
dockerCmd(c, "run", "--name=test", "busybox", "echo", "hello")
|
||||||
|
id, err := getIDByName("test")
|
||||||
id := strings.TrimSpace(out)
|
c.Assert(err, check.IsNil)
|
||||||
dockerCmd(c, "wait", id)
|
|
||||||
|
|
||||||
logsCmd := exec.Command(dockerBinary, "logs", "-f", id)
|
logsCmd := exec.Command(dockerBinary, "logs", "-f", id)
|
||||||
c.Assert(logsCmd.Start(), checker.IsNil)
|
c.Assert(logsCmd.Start(), checker.IsNil)
|
||||||
|
|
|
@ -208,7 +208,7 @@ func assertContainerList(out string, expected []string) bool {
|
||||||
func (s *DockerSuite) TestPsListContainersSize(c *check.C) {
|
func (s *DockerSuite) TestPsListContainersSize(c *check.C) {
|
||||||
// Problematic on Windows as it doesn't report the size correctly @swernli
|
// Problematic on Windows as it doesn't report the size correctly @swernli
|
||||||
testRequires(c, DaemonIsLinux)
|
testRequires(c, DaemonIsLinux)
|
||||||
dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
|
dockerCmd(c, "run", "-d", "busybox")
|
||||||
|
|
||||||
baseOut, _ := dockerCmd(c, "ps", "-s", "-n=1")
|
baseOut, _ := dockerCmd(c, "ps", "-s", "-n=1")
|
||||||
baseLines := strings.Split(strings.Trim(baseOut, "\n "), "\n")
|
baseLines := strings.Split(strings.Trim(baseOut, "\n "), "\n")
|
||||||
|
@ -218,11 +218,12 @@ func (s *DockerSuite) TestPsListContainersSize(c *check.C) {
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
name := "test_size"
|
name := "test_size"
|
||||||
out, _ := dockerCmd(c, "run", "--name", name, "busybox", "sh", "-c", "echo 1 > test")
|
dockerCmd(c, "run", "--name", name, "busybox", "sh", "-c", "echo 1 > test")
|
||||||
id, err := getIDByName(name)
|
id, err := getIDByName(name)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
runCmd := exec.Command(dockerBinary, "ps", "-s", "-n=1")
|
runCmd := exec.Command(dockerBinary, "ps", "-s", "-n=1")
|
||||||
|
var out string
|
||||||
|
|
||||||
wait := make(chan struct{})
|
wait := make(chan struct{})
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -244,7 +245,6 @@ func (s *DockerSuite) TestPsListContainersSize(c *check.C) {
|
||||||
expectedSize := fmt.Sprintf("%d B", (2 + baseBytes))
|
expectedSize := fmt.Sprintf("%d B", (2 + baseBytes))
|
||||||
foundSize := lines[1][sizeIndex:]
|
foundSize := lines[1][sizeIndex:]
|
||||||
c.Assert(foundSize, checker.Contains, expectedSize, check.Commentf("Expected size %q, got %q", expectedSize, foundSize))
|
c.Assert(foundSize, checker.Contains, expectedSize, check.Commentf("Expected size %q, got %q", expectedSize, foundSize))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) {
|
func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) {
|
||||||
|
@ -303,17 +303,17 @@ func (s *DockerSuite) TestPsListContainersFilterID(c *check.C) {
|
||||||
|
|
||||||
func (s *DockerSuite) TestPsListContainersFilterName(c *check.C) {
|
func (s *DockerSuite) TestPsListContainersFilterName(c *check.C) {
|
||||||
// start container
|
// start container
|
||||||
out, _ := dockerCmd(c, "run", "-d", "--name=a_name_to_match", "busybox")
|
dockerCmd(c, "run", "--name=a_name_to_match", "busybox")
|
||||||
firstID := strings.TrimSpace(out)
|
id, err := getIDByName("a_name_to_match")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
// start another container
|
// start another container
|
||||||
runSleepingContainer(c, "--name=b_name_to_match")
|
runSleepingContainer(c, "--name=b_name_to_match")
|
||||||
|
|
||||||
// filter containers by name
|
// filter containers by name
|
||||||
out, _ = dockerCmd(c, "ps", "-a", "-q", "--filter=name=a_name_to_match")
|
out, _ := dockerCmd(c, "ps", "-a", "-q", "--filter=name=a_name_to_match")
|
||||||
containerOut := strings.TrimSpace(out)
|
containerOut := strings.TrimSpace(out)
|
||||||
c.Assert(containerOut, checker.Equals, firstID[:12], check.Commentf("Expected id %s, got %s for exited filter, output: %q", firstID[:12], containerOut, out))
|
c.Assert(containerOut, checker.Equals, id[:12], check.Commentf("Expected id %s, got %s for exited filter, output: %q", id[:12], containerOut, out))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test for the ancestor filter for ps.
|
// Test for the ancestor filter for ps.
|
||||||
|
@ -345,24 +345,29 @@ func (s *DockerSuite) TestPsListContainersFilterAncestorImage(c *check.C) {
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
// start containers
|
// start containers
|
||||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
|
dockerCmd(c, "run", "--name=first", "busybox", "echo", "hello")
|
||||||
firstID := strings.TrimSpace(out)
|
firstID, err := getIDByName("first")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
// start another container
|
// start another container
|
||||||
out, _ = dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
|
dockerCmd(c, "run", "--name=second", "busybox", "echo", "hello")
|
||||||
secondID := strings.TrimSpace(out)
|
secondID, err := getIDByName("second")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
// start third container
|
// start third container
|
||||||
out, _ = dockerCmd(c, "run", "-d", imageName1, "echo", "hello")
|
dockerCmd(c, "run", "--name=third", imageName1, "echo", "hello")
|
||||||
thirdID := strings.TrimSpace(out)
|
thirdID, err := getIDByName("third")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
// start fourth container
|
// start fourth container
|
||||||
out, _ = dockerCmd(c, "run", "-d", imageName1Tagged, "echo", "hello")
|
dockerCmd(c, "run", "--name=fourth", imageName1Tagged, "echo", "hello")
|
||||||
fourthID := strings.TrimSpace(out)
|
fourthID, err := getIDByName("fourth")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
// start fifth container
|
// start fifth container
|
||||||
out, _ = dockerCmd(c, "run", "-d", imageName2, "echo", "hello")
|
dockerCmd(c, "run", "--name=fifth", imageName2, "echo", "hello")
|
||||||
fifthID := strings.TrimSpace(out)
|
fifthID, err := getIDByName("fifth")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
var filterTestSuite = []struct {
|
var filterTestSuite = []struct {
|
||||||
filterName string
|
filterName string
|
||||||
|
@ -387,6 +392,7 @@ func (s *DockerSuite) TestPsListContainersFilterAncestorImage(c *check.C) {
|
||||||
{imageID2, []string{fifthID}},
|
{imageID2, []string{fifthID}},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var out string
|
||||||
for _, filter := range filterTestSuite {
|
for _, filter := range filterTestSuite {
|
||||||
out, _ = dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=ancestor="+filter.filterName)
|
out, _ = dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=ancestor="+filter.filterName)
|
||||||
checkPsAncestorFilterOutput(c, out, filter.filterName, filter.expectedIDs)
|
checkPsAncestorFilterOutput(c, out, filter.filterName, filter.expectedIDs)
|
||||||
|
@ -421,19 +427,22 @@ func checkPsAncestorFilterOutput(c *check.C, out string, filterName string, expe
|
||||||
|
|
||||||
func (s *DockerSuite) TestPsListContainersFilterLabel(c *check.C) {
|
func (s *DockerSuite) TestPsListContainersFilterLabel(c *check.C) {
|
||||||
// start container
|
// start container
|
||||||
out, _ := dockerCmd(c, "run", "-d", "-l", "match=me", "-l", "second=tag", "busybox")
|
dockerCmd(c, "run", "--name=first", "-l", "match=me", "-l", "second=tag", "busybox")
|
||||||
firstID := strings.TrimSpace(out)
|
firstID, err := getIDByName("first")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
// start another container
|
// start another container
|
||||||
out, _ = dockerCmd(c, "run", "-d", "-l", "match=me too", "busybox")
|
dockerCmd(c, "run", "--name=second", "-l", "match=me too", "busybox")
|
||||||
secondID := strings.TrimSpace(out)
|
secondID, err := getIDByName("second")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
// start third container
|
// start third container
|
||||||
out, _ = dockerCmd(c, "run", "-d", "-l", "nomatch=me", "busybox")
|
dockerCmd(c, "run", "--name=third", "-l", "nomatch=me", "busybox")
|
||||||
thirdID := strings.TrimSpace(out)
|
thirdID, err := getIDByName("third")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
// filter containers by exact match
|
// filter containers by exact match
|
||||||
out, _ = dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=label=match=me")
|
out, _ := dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=label=match=me")
|
||||||
containerOut := strings.TrimSpace(out)
|
containerOut := strings.TrimSpace(out)
|
||||||
c.Assert(containerOut, checker.Equals, firstID, check.Commentf("Expected id %s, got %s for exited filter, output: %q", firstID, containerOut, out))
|
c.Assert(containerOut, checker.Equals, firstID, check.Commentf("Expected id %s, got %s for exited filter, output: %q", firstID, containerOut, out))
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *DockerSuite) TestRestartStoppedContainer(c *check.C) {
|
func (s *DockerSuite) TestRestartStoppedContainer(c *check.C) {
|
||||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "foobar")
|
dockerCmd(c, "run", "--name=test", "busybox", "echo", "foobar")
|
||||||
|
cleanedContainerID, err := getIDByName("test")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
cleanedContainerID := strings.TrimSpace(out)
|
out, _ := dockerCmd(c, "logs", cleanedContainerID)
|
||||||
dockerCmd(c, "wait", cleanedContainerID)
|
|
||||||
|
|
||||||
out, _ = dockerCmd(c, "logs", cleanedContainerID)
|
|
||||||
c.Assert(out, checker.Equals, "foobar\n")
|
c.Assert(out, checker.Equals, "foobar\n")
|
||||||
|
|
||||||
dockerCmd(c, "restart", cleanedContainerID)
|
dockerCmd(c, "restart", cleanedContainerID)
|
||||||
|
|
|
@ -20,6 +20,7 @@ import (
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/integration/checker"
|
"github.com/docker/docker/pkg/integration/checker"
|
||||||
"github.com/docker/docker/pkg/mount"
|
"github.com/docker/docker/pkg/mount"
|
||||||
|
"github.com/docker/docker/pkg/stringutils"
|
||||||
"github.com/docker/docker/runconfig"
|
"github.com/docker/docker/runconfig"
|
||||||
"github.com/docker/go-connections/nat"
|
"github.com/docker/go-connections/nat"
|
||||||
"github.com/docker/libnetwork/netutils"
|
"github.com/docker/libnetwork/netutils"
|
||||||
|
@ -1816,8 +1817,10 @@ func (s *DockerSuite) TestRunWriteHostsFileAndNotCommit(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func eqToBaseDiff(out string, c *check.C) bool {
|
func eqToBaseDiff(out string, c *check.C) bool {
|
||||||
out1, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
|
name := "eqToBaseDiff" + stringutils.GenerateRandomAlphaOnlyString(32)
|
||||||
cID := strings.TrimSpace(out1)
|
dockerCmd(c, "run", "--name", name, "busybox", "echo", "hello")
|
||||||
|
cID, err := getIDByName(name)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
baseDiff, _ := dockerCmd(c, "diff", cID)
|
baseDiff, _ := dockerCmd(c, "diff", cID)
|
||||||
baseArr := strings.Split(baseDiff, "\n")
|
baseArr := strings.Split(baseDiff, "\n")
|
||||||
|
|
|
@ -13,11 +13,10 @@ import (
|
||||||
func (s *DockerSuite) TestStartAttachReturnsOnError(c *check.C) {
|
func (s *DockerSuite) TestStartAttachReturnsOnError(c *check.C) {
|
||||||
// Windows does not support link
|
// Windows does not support link
|
||||||
testRequires(c, DaemonIsLinux)
|
testRequires(c, DaemonIsLinux)
|
||||||
dockerCmd(c, "run", "-d", "--name", "test", "busybox")
|
dockerCmd(c, "run", "--name", "test", "busybox")
|
||||||
dockerCmd(c, "wait", "test")
|
|
||||||
|
|
||||||
// Expect this to fail because the above container is stopped, this is what we want
|
// Expect this to fail because the above container is stopped, this is what we want
|
||||||
out, _, err := dockerCmdWithError("run", "-d", "--name", "test2", "--link", "test:test", "busybox")
|
out, _, err := dockerCmdWithError("run", "--name", "test2", "--link", "test:test", "busybox")
|
||||||
// err shouldn't be nil because container test2 try to link to stopped container
|
// err shouldn't be nil because container test2 try to link to stopped container
|
||||||
c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
||||||
|
|
||||||
|
|
|
@ -474,7 +474,6 @@ func (d *Daemon) waitRun(contID string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Daemon) getBaseDeviceSize(c *check.C) int64 {
|
func (d *Daemon) getBaseDeviceSize(c *check.C) int64 {
|
||||||
|
|
||||||
infoCmdOutput, _, err := runCommandPipelineWithOutput(
|
infoCmdOutput, _, err := runCommandPipelineWithOutput(
|
||||||
exec.Command(dockerBinary, "-H", d.sock(), "info"),
|
exec.Command(dockerBinary, "-H", d.sock(), "info"),
|
||||||
exec.Command("grep", "Base Device Size"),
|
exec.Command("grep", "Base Device Size"),
|
||||||
|
@ -524,6 +523,23 @@ func (d *Daemon) LogFileName() string {
|
||||||
return d.logFile.Name()
|
return d.logFile.Name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *Daemon) getIDByName(name string) (string, error) {
|
||||||
|
return d.inspectFieldWithError(name, "Id")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Daemon) inspectFilter(name, filter string) (string, error) {
|
||||||
|
format := fmt.Sprintf("{{%s}}", filter)
|
||||||
|
out, err := d.Cmd("inspect", "-f", format, name)
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("failed to inspect %s: %s", name, out)
|
||||||
|
}
|
||||||
|
return strings.TrimSpace(out), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Daemon) inspectFieldWithError(name, field string) (string, error) {
|
||||||
|
return d.inspectFilter(name, fmt.Sprintf(".%s", field))
|
||||||
|
}
|
||||||
|
|
||||||
func daemonHost() string {
|
func daemonHost() string {
|
||||||
daemonURLStr := "unix://" + opts.DefaultUnixSocket
|
daemonURLStr := "unix://" + opts.DefaultUnixSocket
|
||||||
if daemonHostVar := os.Getenv("DOCKER_HOST"); daemonHostVar != "" {
|
if daemonHostVar := os.Getenv("DOCKER_HOST"); daemonHostVar != "" {
|
||||||
|
|
Loading…
Reference in New Issue