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:
@@ -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