utils_test.go 608 B

123456789101112131415161718192021222324252627
  1. package runtime
  2. import (
  3. "github.com/dotcloud/docker/runconfig"
  4. "testing"
  5. )
  6. func TestMergeLxcConfig(t *testing.T) {
  7. var (
  8. hostConfig = &runconfig.HostConfig{
  9. LxcConf: []runconfig.KeyValuePair{
  10. {Key: "lxc.cgroups.cpuset", Value: "1,2"},
  11. },
  12. }
  13. driverConfig = make(map[string][]string)
  14. )
  15. mergeLxcConfIntoOptions(hostConfig, driverConfig)
  16. if l := len(driverConfig["lxc"]); l > 1 {
  17. t.Fatalf("expected lxc options len of 1 got %d", l)
  18. }
  19. cpuset := driverConfig["lxc"][0]
  20. if expected := "cgroups.cpuset=1,2"; cpuset != expected {
  21. t.Fatalf("expected %s got %s", expected, cpuset)
  22. }
  23. }