mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-04 04:31:28 +00:00
Add test for net=container and links
Signed-off-by: willhf <willhf@gmail.com>
This commit is contained in:
+1
-1
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user