1
0
mirror of https://github.com/docker/cli.git synced 2026-01-15 07:40:57 +03:00

Add test for net=container and links

Signed-off-by: willhf <willhf@gmail.com>
Upstream-commit: 6dba2d01b5198b43a2fab80176cf2888656c6b56
Component: engine
This commit is contained in:
willhf
2015-03-23 19:50:33 -07:00
parent bb8cd4ea0b
commit bc8854a576
2 changed files with 7 additions and 1 deletions

View File

@@ -125,7 +125,7 @@ func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe
return nil, nil, cmd, ErrConflictHostNetworkAndLinks
}
if *flNetMode == "container" && flLinks.Len() > 0 {
if strings.HasPrefix(*flNetMode, "container") && flLinks.Len() > 0 {
return nil, nil, cmd, ErrConflictContainerNetworkAndLinks
}

View File

@@ -57,3 +57,9 @@ func TestNetHostname(t *testing.T) {
t.Fatalf("Expected error ErrConflictNetworkHostname, got: %s", err)
}
}
func TestConflictContainerNetworkAndLinks(t *testing.T) {
if _, _, _, err := parseRun([]string{"--net=container:other", "--link=zip:zap", "img", "cmd"}); err != ErrConflictContainerNetworkAndLinks {
t.Fatalf("Expected error ErrConflictContainerNetworkAndLinks, got: %s", err)
}
}