mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
go-fmt
This commit is contained in:
@@ -119,20 +119,20 @@ func createContainer(ctx *ExecContext, task *structs.Task, logger *log.Logger) d
|
||||
logger.Printf("[DEBUG] driver.docker: using %d cpu shares for %s", hostConfig.CPUShares, task.Config["image"])
|
||||
|
||||
mode, ok := task.Config["network_mode"]
|
||||
if !ok || mode == "" {
|
||||
// docker default
|
||||
logger.Printf("[WARN] driver.docker: no mode specified for networking, defaulting to bridge")
|
||||
mode = "bridge"
|
||||
}
|
||||
if !ok || mode == "" {
|
||||
// docker default
|
||||
logger.Printf("[WARN] driver.docker: no mode specified for networking, defaulting to bridge")
|
||||
mode = "bridge"
|
||||
}
|
||||
|
||||
// Ignore the container mode for now
|
||||
switch mode {
|
||||
case "default", "bridge", "none", "host":
|
||||
logger.Printf("[DEBUG] driver.docker: using %s as network mode", mode)
|
||||
default:
|
||||
logger.Printf("[WARN] invalid setting for network mode %s, defaulting to bridge mode on docker0", mode)
|
||||
mode = "bridge"
|
||||
}
|
||||
// Ignore the container mode for now
|
||||
switch mode {
|
||||
case "default", "bridge", "none", "host":
|
||||
logger.Printf("[DEBUG] driver.docker: using %s as network mode", mode)
|
||||
default:
|
||||
logger.Printf("[WARN] invalid setting for network mode %s, defaulting to bridge mode on docker0", mode)
|
||||
mode = "bridge"
|
||||
}
|
||||
hostConfig.NetworkMode = mode
|
||||
|
||||
// Setup port mapping (equivalent to -p on docker CLI). Ports must already be
|
||||
|
||||
@@ -289,16 +289,16 @@ func TestDocker_StartNVersions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDockerHostNet(t *testing.T) {
|
||||
task := &structs.Task{
|
||||
Config: map[string]string{
|
||||
"image": "redis",
|
||||
"network_mode": "host",
|
||||
},
|
||||
Resources: &structs.Resources{
|
||||
MemoryMB: 256,
|
||||
CPU: 512,
|
||||
},
|
||||
}
|
||||
task := &structs.Task{
|
||||
Config: map[string]string{
|
||||
"image": "redis",
|
||||
"network_mode": "host",
|
||||
},
|
||||
Resources: &structs.Resources{
|
||||
MemoryMB: 256,
|
||||
CPU: 512,
|
||||
},
|
||||
}
|
||||
driverCtx := testDriverContext(task.Name)
|
||||
ctx := testDriverExecContext(task, driverCtx)
|
||||
defer ctx.AllocDir.Destroy()
|
||||
|
||||
Reference in New Issue
Block a user