2014-04-18 05:43:01 +08:00
|
|
|
package daemon
|
2014-03-24 15:16:40 +08:00
|
|
|
|
|
|
|
|
import (
|
2014-04-01 15:07:42 +08:00
|
|
|
"testing"
|
|
|
|
|
|
2014-07-25 06:19:50 +08:00
|
|
|
"github.com/docker/docker/runconfig"
|
|
|
|
|
"github.com/docker/docker/utils"
|
2014-03-24 15:16:40 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestMergeLxcConfig(t *testing.T) {
|
2014-09-30 06:40:26 +08:00
|
|
|
hostConfig := &runconfig.HostConfig{
|
|
|
|
|
LxcConf: []utils.KeyValuePair{
|
|
|
|
|
{Key: "lxc.cgroups.cpuset", Value: "1,2"},
|
|
|
|
|
},
|
2014-03-24 15:16:40 +08:00
|
|
|
}
|
|
|
|
|
|
2014-12-09 08:45:42 +08:00
|
|
|
out, err := mergeLxcConfIntoOptions(hostConfig)
|
|
|
|
|
if err != nil {
|
2014-12-13 02:58:56 +08:00
|
|
|
t.Fatalf("Failed to merge Lxc Config: %s", err)
|
2014-12-09 08:45:42 +08:00
|
|
|
}
|
2014-09-30 06:40:26 +08:00
|
|
|
|
|
|
|
|
cpuset := out[0]
|
2014-03-24 15:16:40 +08:00
|
|
|
if expected := "cgroups.cpuset=1,2"; cpuset != expected {
|
|
|
|
|
t.Fatalf("expected %s got %s", expected, cpuset)
|
|
|
|
|
}
|
|
|
|
|
}
|