Add test for net=container and links

Signed-off-by: willhf <willhf@gmail.com>
This commit is contained in:
willhf 2015-03-23 19:50:33 -07:00
parent e6b7d93072
commit 6dba2d01b5
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)
}
}