2014-04-17 17:43:01 -04:00
|
|
|
package daemon
|
2014-03-24 03:16:40 -04:00
|
|
|
|
|
|
|
import (
|
2014-04-01 03:07:42 -04:00
|
|
|
"testing"
|
|
|
|
|
2014-03-24 03:16:40 -04:00
|
|
|
"github.com/dotcloud/docker/runconfig"
|
2014-03-27 04:25:01 -04:00
|
|
|
"github.com/dotcloud/docker/utils"
|
2014-03-24 03:16:40 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestMergeLxcConfig(t *testing.T) {
|
|
|
|
var (
|
|
|
|
hostConfig = &runconfig.HostConfig{
|
2014-03-27 04:25:01 -04:00
|
|
|
LxcConf: []utils.KeyValuePair{
|
2014-03-24 03:16:40 -04:00
|
|
|
{Key: "lxc.cgroups.cpuset", Value: "1,2"},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
driverConfig = make(map[string][]string)
|
|
|
|
)
|
|
|
|
|
|
|
|
mergeLxcConfIntoOptions(hostConfig, driverConfig)
|
|
|
|
if l := len(driverConfig["lxc"]); l > 1 {
|
|
|
|
t.Fatalf("expected lxc options len of 1 got %d", l)
|
|
|
|
}
|
|
|
|
|
|
|
|
cpuset := driverConfig["lxc"][0]
|
|
|
|
if expected := "cgroups.cpuset=1,2"; cpuset != expected {
|
|
|
|
t.Fatalf("expected %s got %s", expected, cpuset)
|
|
|
|
}
|
|
|
|
}
|