mirror of https://github.com/docker/docs.git
Add test for net=container and links
Signed-off-by: willhf <willhf@gmail.com>
This commit is contained in:
parent
e6b7d93072
commit
6dba2d01b5
|
@ -125,7 +125,7 @@ func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe
|
||||||
return nil, nil, cmd, ErrConflictHostNetworkAndLinks
|
return nil, nil, cmd, ErrConflictHostNetworkAndLinks
|
||||||
}
|
}
|
||||||
|
|
||||||
if *flNetMode == "container" && flLinks.Len() > 0 {
|
if strings.HasPrefix(*flNetMode, "container") && flLinks.Len() > 0 {
|
||||||
return nil, nil, cmd, ErrConflictContainerNetworkAndLinks
|
return nil, nil, cmd, ErrConflictContainerNetworkAndLinks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,3 +57,9 @@ func TestNetHostname(t *testing.T) {
|
||||||
t.Fatalf("Expected error ErrConflictNetworkHostname, got: %s", err)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue