Merge pull request #2787 from hashicorp/f-docker-test-mac

Test #2652 - Docker MAC Address option
This commit is contained in:
Michael Schurter 2017-07-07 16:22:10 -07:00 committed by GitHub
commit 95a9a5da71
2 changed files with 25 additions and 9 deletions

View file

@ -830,6 +830,25 @@ func TestDockerDriver_DNS(t *testing.T) {
}
}
func TestDockerDriver_MACAddress(t *testing.T) {
task, _, _ := dockerTask()
task.Config["mac_address"] = "00:16:3e:00:00:00"
client, handle, cleanup := dockerSetup(t, task)
defer cleanup()
waitForExist(t, client, handle.(*DockerHandle))
container, err := client.InspectContainer(handle.(*DockerHandle).ContainerID())
if err != nil {
t.Fatalf("err: %v", err)
}
if container.NetworkSettings.MacAddress != task.Config["mac_address"] {
t.Errorf("expected mac_address=%q but found %q", task.Config["mac_address"], container.NetworkSettings.MacAddress)
}
}
func TestDockerWorkDir(t *testing.T) {
task, _, _ := dockerTask()
task.Config["work_dir"] = "/some/path"

View file

@ -79,7 +79,7 @@ The `docker` driver supports the following configuration in the job spec. Only
to use.
* `dns_servers` - (Optional) A list of DNS servers for the container to use
(e.g. ["8.8.8.8", "8.8.4.4"]). *Docker API v1.10 and above only*
(e.g. ["8.8.8.8", "8.8.4.4"]). Requires Docker v1.10 or greater.
* `extra_hosts` - (Optional) A list of hosts, given as host:IP, to be added to
`/etc/hosts`.
@ -103,10 +103,10 @@ The `docker` driver supports the following configuration in the job spec. Only
Nomad agent to be configured to allow privileged containers.
* `ipv4_address` - (Optional) The IPv4 address to be used for the container when
using user defined networks. Requires docker 1.13.0 or greater.
using user defined networks. Requires Docker 1.13 or greater.
* `ipv6_address` - (Optional) The IPv6 address to be used for the container when
using user defined networks. Requires docker 1.13.0 or greater.
using user defined networks. Requires Docker 1.13 or greater.
* `labels` - (Optional) A key-value map of labels to set to the containers on
start.
@ -151,6 +151,9 @@ The `docker` driver supports the following configuration in the job spec. Only
}
```
* `mac_address` - (Optional) The MAC address for the container to use (e.g.
"02:68:b3:29:da:98").
* `network_aliases` - (Optional) A list of network-scoped aliases, provide a way for a
container to be discovered by an alternate name by any other container within
the scope of a particular network. Network-scoped alias is supported only for
@ -185,12 +188,6 @@ The `docker` driver supports the following configuration in the job spec. Only
nomad agent and docker daemon to be configured to allow privileged
containers.
* `mac_address` - (Optional) The mac address for the container to use
(e.g. "02:68:b3:29:da:98").
* `dns_search_domains` - (Optional) A list of DNS search domains for the container
to use.
* `security_opt` - (Optional) A list of string flags to pass directly to
[`--security-opt`](https://docs.docker.com/engine/reference/run/#security-configuration).
For example: