Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
| ... | ... |
@@ -6,6 +6,7 @@ import ( |
| 6 | 6 |
"strings" |
| 7 | 7 |
|
| 8 | 8 |
"github.com/docker/docker/pkg/integration/checker" |
| 9 |
+ "github.com/docker/docker/runconfig" |
|
| 9 | 10 |
"github.com/go-check/check" |
| 10 | 11 |
) |
| 11 | 12 |
|
| ... | ... |
@@ -202,7 +203,7 @@ func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) {
|
| 202 | 202 |
// Running container linking to a container with --net host should have failed |
| 203 | 203 |
c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
| 204 | 204 |
// Running container linking to a container with --net host should have failed |
| 205 |
- c.Assert(out, checker.Contains, "--net=host can't be used with links. This would result in undefined behavior") |
|
| 205 |
+ c.Assert(out, checker.Contains, runconfig.ErrConflictHostNetworkAndLinks.Error()) |
|
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 | 208 |
func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *check.C) {
|
| ... | ... |
@@ -3384,17 +3384,17 @@ func (s *DockerSuite) TestRunContainerNetModeWithDnsMacHosts(c *check.C) {
|
| 3384 | 3384 |
} |
| 3385 | 3385 |
|
| 3386 | 3386 |
out, _, err = dockerCmdWithError("run", "--dns", "1.2.3.4", "--net=container:parent", "busybox")
|
| 3387 |
- if err == nil || !strings.Contains(out, "Conflicting options: --dns and the network mode") {
|
|
| 3387 |
+ if err == nil || !strings.Contains(out, runconfig.ErrConflictNetworkAndDNS.Error()) {
|
|
| 3388 | 3388 |
c.Fatalf("run --net=container with --dns should error out")
|
| 3389 | 3389 |
} |
| 3390 | 3390 |
|
| 3391 | 3391 |
out, _, err = dockerCmdWithError("run", "--mac-address", "92:d0:c6:0a:29:33", "--net=container:parent", "busybox")
|
| 3392 |
- if err == nil || !strings.Contains(out, "--mac-address and the network mode") {
|
|
| 3392 |
+ if err == nil || !strings.Contains(out, runconfig.ErrConflictContainerNetworkAndMac.Error()) {
|
|
| 3393 | 3393 |
c.Fatalf("run --net=container with --mac-address should error out")
|
| 3394 | 3394 |
} |
| 3395 | 3395 |
|
| 3396 | 3396 |
out, _, err = dockerCmdWithError("run", "--add-host", "test:192.168.2.109", "--net=container:parent", "busybox")
|
| 3397 |
- if err == nil || !strings.Contains(out, "--add-host and the network mode") {
|
|
| 3397 |
+ if err == nil || !strings.Contains(out, runconfig.ErrConflictNetworkHosts.Error()) {
|
|
| 3398 | 3398 |
c.Fatalf("run --net=container with --add-host should error out")
|
| 3399 | 3399 |
} |
| 3400 | 3400 |
} |
| ... | ... |
@@ -3405,17 +3405,17 @@ func (s *DockerSuite) TestRunContainerNetModeWithExposePort(c *check.C) {
|
| 3405 | 3405 |
dockerCmd(c, "run", "-d", "--name", "parent", "busybox", "top") |
| 3406 | 3406 |
|
| 3407 | 3407 |
out, _, err := dockerCmdWithError("run", "-p", "5000:5000", "--net=container:parent", "busybox")
|
| 3408 |
- if err == nil || !strings.Contains(out, "Conflicting options: -p, -P, --publish-all, --publish and the network mode (--net)") {
|
|
| 3408 |
+ if err == nil || !strings.Contains(out, runconfig.ErrConflictNetworkPublishPorts.Error()) {
|
|
| 3409 | 3409 |
c.Fatalf("run --net=container with -p should error out")
|
| 3410 | 3410 |
} |
| 3411 | 3411 |
|
| 3412 | 3412 |
out, _, err = dockerCmdWithError("run", "-P", "--net=container:parent", "busybox")
|
| 3413 |
- if err == nil || !strings.Contains(out, "Conflicting options: -p, -P, --publish-all, --publish and the network mode (--net)") {
|
|
| 3413 |
+ if err == nil || !strings.Contains(out, runconfig.ErrConflictNetworkPublishPorts.Error()) {
|
|
| 3414 | 3414 |
c.Fatalf("run --net=container with -P should error out")
|
| 3415 | 3415 |
} |
| 3416 | 3416 |
|
| 3417 | 3417 |
out, _, err = dockerCmdWithError("run", "--expose", "5000", "--net=container:parent", "busybox")
|
| 3418 |
- if err == nil || !strings.Contains(out, "Conflicting options: --expose and the network mode (--net)") {
|
|
| 3418 |
+ if err == nil || !strings.Contains(out, runconfig.ErrConflictNetworkExposePorts.Error()) {
|
|
| 3419 | 3419 |
c.Fatalf("run --net=container with --expose should error out")
|
| 3420 | 3420 |
} |
| 3421 | 3421 |
} |
| ... | ... |
@@ -17,29 +17,29 @@ import ( |
| 17 | 17 |
|
| 18 | 18 |
var ( |
| 19 | 19 |
// ErrConflictContainerNetworkAndLinks conflict between --net=container and links |
| 20 |
- ErrConflictContainerNetworkAndLinks = fmt.Errorf("Conflicting options: --net=container can't be used with links. This would result in undefined behavior")
|
|
| 20 |
+ ErrConflictContainerNetworkAndLinks = fmt.Errorf("Conflicting options: container type network can't be used with links. This would result in undefined behavior")
|
|
| 21 | 21 |
// ErrConflictUserDefinedNetworkAndLinks conflict between --net=<NETWORK> and links |
| 22 |
- ErrConflictUserDefinedNetworkAndLinks = fmt.Errorf("Conflicting options: --net=<NETWORK> can't be used with links. This would result in undefined behavior")
|
|
| 22 |
+ ErrConflictUserDefinedNetworkAndLinks = fmt.Errorf("Conflicting options: networking can't be used with links. This would result in undefined behavior")
|
|
| 23 | 23 |
// ErrConflictSharedNetwork conflict between private and other networks |
| 24 | 24 |
ErrConflictSharedNetwork = fmt.Errorf("Container sharing network namespace with another container or host cannot be connected to any other network")
|
| 25 | 25 |
// ErrConflictHostNetwork conflict from being disconnected from host network or connected to host network. |
| 26 | 26 |
ErrConflictHostNetwork = fmt.Errorf("Container cannot be disconnected from host network or connected to host network")
|
| 27 | 27 |
// ErrConflictNoNetwork conflict between private and other networks |
| 28 |
- ErrConflictNoNetwork = fmt.Errorf("Container cannot be connected to multiple networks with one of the networks in --none mode")
|
|
| 28 |
+ ErrConflictNoNetwork = fmt.Errorf("Container cannot be connected to multiple networks with one of the networks in private (none) mode")
|
|
| 29 | 29 |
// ErrConflictNetworkAndDNS conflict between --dns and the network mode |
| 30 |
- ErrConflictNetworkAndDNS = fmt.Errorf("Conflicting options: --dns and the network mode (--net)")
|
|
| 30 |
+ ErrConflictNetworkAndDNS = fmt.Errorf("Conflicting options: dns and the network mode")
|
|
| 31 | 31 |
// ErrConflictNetworkHostname conflict between the hostname and the network mode |
| 32 |
- ErrConflictNetworkHostname = fmt.Errorf("Conflicting options: -h and the network mode (--net)")
|
|
| 32 |
+ ErrConflictNetworkHostname = fmt.Errorf("Conflicting options: hostname and the network mode")
|
|
| 33 | 33 |
// ErrConflictHostNetworkAndLinks conflict between --net=host and links |
| 34 |
- ErrConflictHostNetworkAndLinks = fmt.Errorf("Conflicting options: --net=host can't be used with links. This would result in undefined behavior")
|
|
| 34 |
+ ErrConflictHostNetworkAndLinks = fmt.Errorf("Conflicting options: host type networking can't be used with links. This would result in undefined behavior")
|
|
| 35 | 35 |
// ErrConflictContainerNetworkAndMac conflict between the mac address and the network mode |
| 36 |
- ErrConflictContainerNetworkAndMac = fmt.Errorf("Conflicting options: --mac-address and the network mode (--net)")
|
|
| 36 |
+ ErrConflictContainerNetworkAndMac = fmt.Errorf("Conflicting options: mac-address and the network mode")
|
|
| 37 | 37 |
// ErrConflictNetworkHosts conflict between add-host and the network mode |
| 38 |
- ErrConflictNetworkHosts = fmt.Errorf("Conflicting options: --add-host and the network mode (--net)")
|
|
| 39 |
- // ErrConflictNetworkPublishPorts conflict between the pulbish options and the network mode |
|
| 40 |
- ErrConflictNetworkPublishPorts = fmt.Errorf("Conflicting options: -p, -P, --publish-all, --publish and the network mode (--net)")
|
|
| 38 |
+ ErrConflictNetworkHosts = fmt.Errorf("Conflicting options: custom host-to-IP mapping and the network mode")
|
|
| 39 |
+ // ErrConflictNetworkPublishPorts conflict between the publish options and the network mode |
|
| 40 |
+ ErrConflictNetworkPublishPorts = fmt.Errorf("Conflicting options: port publishing and the container type network mode")
|
|
| 41 | 41 |
// ErrConflictNetworkExposePorts conflict between the expose option and the network mode |
| 42 |
- ErrConflictNetworkExposePorts = fmt.Errorf("Conflicting options: --expose and the network mode (--net)")
|
|
| 42 |
+ ErrConflictNetworkExposePorts = fmt.Errorf("Conflicting options: port exposing and the container type network mode")
|
|
| 43 | 43 |
) |
| 44 | 44 |
|
| 45 | 45 |
// DefaultSHMSize is the default size (64MB) of the SHM which will be mounted in the container |